mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
f2fs: fix freezing filesystem during resize
Using FREEZE_HOLDER_USERSPACE has two consequences: (1) If userspace freezes the filesystem after mnt_drop_write_file() but before freeze_super() was called filesystem resizing will fail because the freeze isn't marked as nestable. (2) If the kernel has successfully frozen the filesystem via FREEZE_HOLDER_USERSPACE userspace can simply undo it by using the FITHAW ioctl. Fix both issues by using FREEZE_HOLDER_KERNEL. It will nest with FREEZE_HOLDER_USERSPACE and cannot be undone by userspace. And it is the correct thing to do because the kernel temporarily freezes the filesystem. Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
05b158d4fd
commit
1afe9e7da8
1 changed files with 3 additions and 3 deletions
|
@ -2271,12 +2271,12 @@ out_drop_write:
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
err = freeze_super(sbi->sb, FREEZE_HOLDER_USERSPACE, NULL);
|
||||
err = freeze_super(sbi->sb, FREEZE_HOLDER_KERNEL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (f2fs_readonly(sbi->sb)) {
|
||||
err = thaw_super(sbi->sb, FREEZE_HOLDER_USERSPACE, NULL);
|
||||
err = thaw_super(sbi->sb, FREEZE_HOLDER_KERNEL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
return -EROFS;
|
||||
|
@ -2333,6 +2333,6 @@ recover_out:
|
|||
out_err:
|
||||
f2fs_up_write(&sbi->cp_global_sem);
|
||||
f2fs_up_write(&sbi->gc_lock);
|
||||
thaw_super(sbi->sb, FREEZE_HOLDER_USERSPACE, NULL);
|
||||
thaw_super(sbi->sb, FREEZE_HOLDER_KERNEL, NULL);
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue