Make sure that all callers of remount hold s_umount exclusive
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 6 May 2009 03:48:50 +0000 (23:48 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Jun 2009 01:36:07 +0000 (21:36 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/super.c

index cb19fffc7681f9d5b96bfa22c8050df0728bcaca..49f670cb9a830fc71ebe91a83eb41fbc7f99efdd 100644 (file)
@@ -579,7 +579,7 @@ static void do_emergency_remount(struct work_struct *work)
        list_for_each_entry(sb, &super_blocks, s_list) {
                sb->s_count++;
                spin_unlock(&sb_lock);
-               down_read(&sb->s_umount);
+               down_write(&sb->s_umount);
                if (sb->s_root && sb->s_bdev && !(sb->s_flags & MS_RDONLY)) {
                        /*
                         * ->remount_fs needs lock_kernel().
@@ -590,7 +590,8 @@ static void do_emergency_remount(struct work_struct *work)
                        do_remount_sb(sb, MS_RDONLY, NULL, 1);
                        unlock_kernel();
                }
-               drop_super(sb);
+               up_write(&sb->s_umount);
+               put_super(sb);
                spin_lock(&sb_lock);
        }
        spin_unlock(&sb_lock);