[PATCH v2 04/34] ext2: don't set SB_RDONLY after filesystem errors

Christian Brauner brauner at kernel.org
Fri Nov 13 01:38:28 PST 2026


On Thu, Nov 12, 2026 at 07:27:45PM +0100, Jan Kara wrote:
> On Thu 12-11-26 18:03:55, Christian Brauner wrote:
> > Ok, so if I understood you correctly the changes below should be
> > implementing what you ask, @Jan.
> > 
> > It's a diff against v2:
> > 
> > - jfs: free the anonymous tlocks when evicting an inode the way
> >   txUnlock() does. That's also a mainline fix.
> > 
> > - fs: sync_filesystem() and sync(2) skip a superblock in the emergency
> >   state. syncfs(2) and Q_SYNC return EROFS.
> > 
> > - fs: refuse to freeze a superblock in the emergency state. Otherwise
> >   freeze doesn't sync anything anymore and the flusher keeps writing to
> >   the frozen filesystem.
> > 
> >   That means, FIFREEZE and dm suspend with lockfs now fail with EROFS on
> >   an errored ext2, fat etc. I think you said that you expect freeze to
> >   fail anyway. I think that's right.
> > 
> >   The exfat, ntfs, btrfs and ext4 shutdown ioctls then have to skip the
> >   freeze after an error.
> > 
> > - ext2, fat, affs, ufs and hfs: drop the ->write_inode() refusals.
> >   Otherwise the flusher writes data and bitmaps but never the inodes.
> > 
> > - ext2, jfs, nilfs2, ocfs2 and ubifs: their ->sync_fs() checks are dead
> >   now and go.
> > 
> > - ubifs: drop dirty folios and inodes after an error. Without the sync
> >   at remount the flusher otherwise hits ubifs' asserts after a remount
> >   to read-only.
> > 
> > With that nothing is synced on request after an error anymore.
> > 
> > syncfs, fsync and Q_SYNC return EROFS without writing anything and
> > sync(2) and umount skip the filesystem's own sync.
> > 
> > The flusher and the block device flushes in sync(2) and
> > kill_block_super() still write. So what ends up on disk is the same as
> > on mainline today:
> > 
> > Is that what you had in mind?
> 
> Wow, that was quick! Indeed this looks like what I had in mind and I like
> the result. Thanks for implementing it so quickly.

No problem. We're paying off technical debt, big time... So I my motto
is "let's go", so we can focus on the fun things again.



More information about the linux-mtd mailing list