Re: [PATCH] super: remember whether freeze holds writer rwsems

From: Jan Kara

Date: Fri Sep 04 2026 - 06:06:12 EST


On Thu 03-09-26 21:50:45, Karl Mehltretter wrote:
> On Thu, Sep 03, 2026 at 12:40:42PM +0100, Jan Kara wrote:
> > This looks like one of these theoretical issues LLMs come up with. Frankly,
> > I just wouldn't bother. If the fs gets forcibly remounted RO due to
> > metadata errors, a frozen fs is likely the least of your worries.
> >
>
> You may be right that this is not worth fixing in generic VFS. I tried the
> real filesystem paths anyway:
>
> Without patch With patch
> ext2 next write hangs, unmount write and unmount complete
> gives three RCU warnings
> NILFS2 unmount gives three unmount completes cleanly
> RCU warnings
>
> These tests use FIFREEZE, FITHAW, and corrupted filesystem images.
> Other filesystems have similar error paths.
>
> The f2fs report fixed by 930c6ab93492 exercised the same sequence. The ext4
> change d3476f3dad4a removed the analogous SB_RDONLY assignment because it
> confused filesystem freezing.
>
> The VFS patch only makes thaw release what freeze acquired. It is needed
> because these filesystems change SB_RDONLY outside the remount path.

Yes, generally just flipping SB_RDONLY bit is problematic and can lead
to more surprises than just fs freezing issues. So yes, I think improving
filesystems so that they just don't set SB_RDONLY on error is a better way
of handling these problems. I'd certainly accept a patch for ext2 for this.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR