Commit 4aa98cf7 authored by Al Viro's avatar Al Viro

Push BKL down into do_remount_sb()

[folded fix from Jiri Slaby]
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7f78d4cd
...@@ -1060,11 +1060,8 @@ static int do_umount(struct vfsmount *mnt, int flags) ...@@ -1060,11 +1060,8 @@ static int do_umount(struct vfsmount *mnt, int flags)
* we just try to remount it readonly. * we just try to remount it readonly.
*/ */
down_write(&sb->s_umount); down_write(&sb->s_umount);
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY))
lock_kernel();
retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); retval = do_remount_sb(sb, MS_RDONLY, NULL, 0);
unlock_kernel();
}
up_write(&sb->s_umount); up_write(&sb->s_umount);
return retval; return retval;
} }
...@@ -1515,11 +1512,8 @@ static int do_remount(struct path *path, int flags, int mnt_flags, ...@@ -1515,11 +1512,8 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
down_write(&sb->s_umount); down_write(&sb->s_umount);
if (flags & MS_BIND) if (flags & MS_BIND)
err = change_mount_flags(path->mnt, flags); err = change_mount_flags(path->mnt, flags);
else { else
lock_kernel();
err = do_remount_sb(sb, flags, data, 0); err = do_remount_sb(sb, flags, data, 0);
unlock_kernel();
}
if (!err) if (!err)
path->mnt->mnt_flags = mnt_flags; path->mnt->mnt_flags = mnt_flags;
up_write(&sb->s_umount); up_write(&sb->s_umount);
......
...@@ -542,25 +542,33 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) ...@@ -542,25 +542,33 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
shrink_dcache_sb(sb); shrink_dcache_sb(sb);
sync_filesystem(sb); sync_filesystem(sb);
lock_kernel();
/* If we are remounting RDONLY and current sb is read/write, /* If we are remounting RDONLY and current sb is read/write,
make sure there are no rw files opened */ make sure there are no rw files opened */
if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) { if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
if (force) if (force)
mark_files_ro(sb); mark_files_ro(sb);
else if (!fs_may_remount_ro(sb)) else if (!fs_may_remount_ro(sb)) {
unlock_kernel();
return -EBUSY; return -EBUSY;
}
retval = vfs_dq_off(sb, 1); retval = vfs_dq_off(sb, 1);
if (retval < 0 && retval != -ENOSYS) if (retval < 0 && retval != -ENOSYS) {
unlock_kernel();
return -EBUSY; return -EBUSY;
} }
}
remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY); remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
if (sb->s_op->remount_fs) { if (sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data); retval = sb->s_op->remount_fs(sb, &flags, data);
if (retval) if (retval) {
unlock_kernel();
return retval; return retval;
} }
}
sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
unlock_kernel();
if (remount_rw) if (remount_rw)
vfs_dq_quota_on_remount(sb); vfs_dq_quota_on_remount(sb);
return 0; return 0;
...@@ -581,9 +589,7 @@ static void do_emergency_remount(struct work_struct *work) ...@@ -581,9 +589,7 @@ static void do_emergency_remount(struct work_struct *work)
* *
* What lock protects sb->s_flags?? * What lock protects sb->s_flags??
*/ */
lock_kernel();
do_remount_sb(sb, MS_RDONLY, NULL, 1); do_remount_sb(sb, MS_RDONLY, NULL, 1);
unlock_kernel();
} }
up_write(&sb->s_umount); up_write(&sb->s_umount);
put_super(sb); put_super(sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment