f2fs: fix freezing filesystem during resize
authorChristian Brauner <brauner@kernel.org>
Sun, 6 Apr 2025 20:28:52 +0000 (22:28 +0200)
committerChristian Brauner <brauner@kernel.org>
Fri, 9 May 2025 10:41:24 +0000 (12:41 +0200)
commit1afe9e7da8c0ab3c17d4a469ed4c0607024cf0d4
treeb87758b5f2a4c14a7942b424c7b6501bb21659f5
parent05b158d4fd111492e2fa675ad65bc4b0622c0556
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>
fs/f2fs/gc.c