Move grabbing s_umount to callers of grab_super()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 23 Mar 2010 15:11:05 +0000 (11:11 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 21 May 2010 22:31:17 +0000 (18:31 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/block_dev.c
fs/super.c

index 6dcee88c2e5d275fe7df4b3e82caa52375779a74..39cb6591d37d3c97dabf03baabed4e8b620d42a8 100644 (file)
@@ -245,6 +245,7 @@ struct super_block *freeze_bdev(struct block_device *bdev)
        sb = get_active_super(bdev);
        if (!sb)
                goto out;
+       down_write(&sb->s_umount);
        if (sb->s_flags & MS_RDONLY) {
                sb->s_frozen = SB_FREEZE_TRANS;
                up_write(&sb->s_umount);
index dba74e71875136fe6a7baca1a0cf525248d44e67..61fa181faa4318e66a930af8a4ba0adfaa5586f1 100644 (file)
@@ -210,7 +210,6 @@ static int grab_super(struct super_block *s) __releases(sb_lock)
 {
        if (atomic_inc_not_zero(&s->s_active)) {
                spin_unlock(&sb_lock);
-               down_write(&s->s_umount);
                return 1;
        }
        /* it's going away */
@@ -317,6 +316,7 @@ retry:
                                up_write(&s->s_umount);
                                destroy_super(s);
                        }
+                       down_write(&old->s_umount);
                        return old;
                }
        }
@@ -466,7 +466,7 @@ EXPORT_SYMBOL(get_super);
  *
  * Scans the superblock list and finds the superblock of the file system
  * mounted on the device given.  Returns the superblock with an active
- * reference and s_umount held exclusively or %NULL if none was found.
+ * reference or %NULL if none was found.
  */
 struct super_block *get_active_super(struct block_device *bdev)
 {