Re: [PATCH] fs: don't return -EINVAL for successful nested thaw

Lars Ellenberg <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Fri, Aug 21, 2026 at 10:54:51AM +0200, Moritz Tanner wrote:
> This breaks bdev-initiated freezing. When a filesystem is frozen with
> FIFREEZE and additionally frozen via bdev_freeze() -- which nests by
> design, see fs_bdev_freeze() -- the subsequent bdev_thaw() receives
> -EINVAL from the holder op although its freeze reference was dropped,
> and therefore keeps bd_fsfreeze_count elevated.

The other thaw order is the same defect seen from userspace: while the
bdev freeze is still held, fsfreeze -u returns EINVAL although it did
drop its reference, and the filesystem stays frozen until the block
layer holder thaws it.

In-kernel holders get the spurious error as well, whenever a userspace
freeze is held at the same time: xfs_scrub's xchk_fsthaw() carries the
comment "This should always succeed, we have a kernel freeze", and
f2fs_ioc_gc_range() hands the error to userspace.

Tested-by: Lars Ellenberg <[email protected]>
Reviewed-by: Lars Ellenberg <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.