[PATCH v2 04/34] ext2: don't set SB_RDONLY after filesystem errors
Christian Brauner
brauner at kernel.org
Tue Nov 10 13:50:47 PST 2026
On Thu, Nov 05, 2026 at 10:22:07AM +0100, Jan Kara wrote:
> So shouldn't we just modify the sb_rdonly() check in sync_filesystem() to
> use also sb_emergency_ro() and don't bother with modifying individual
> filesystems?
The VFS patch I posted in v1 thread did that. I dropped it because
of jfs. jfs keeps anonymous tlocks for every allocation that writeback
hasn't committed yet. If sync_filesystem() bails after the error nothing
commits them before evict_inodes() and jfs_evict_inode() hits the
BUG_ON() for a non-empty anon_inode_list on umount.
Which is what happened before the series because the error set
SB_RDONLY. jfs_reconfigure() relies on the same sync_filesystem() call
when going read-only after the error.
jfs could commit them itself before evict_inodes() but that means a
->kill_sb() wrapper and a txQuiesce()-like walk over the global
anon_list filtered by superblock. I don't think that's worth it.
> Also if we have the check in sync_filesystem(), then freeze_super() is
> generally going to fail so this check could trigger only if
> sb_emergency_ro() was set after sync_filesystem() ran and before we called
> ->freeze_fs(). Since sb_emergency_ro() checking is pretty much guaranteed
> to be racy (it is just a best effort framework to limit damage), we
> probably don't have to bother with checking in ->freeze_fs() handlers.
Ok, I'll drop it. ext2_freeze() then writes the superblock with
EXT2_ERROR_FS in it which is fine.
> Is this really needed? All the xattr operations go through mnt_want_write()
> / mnt_want_write_file() so this should be caught in VFS...
Not the ones ecryptfs does on the lower filesystem...
Hm, maybe we should make ecryptfs get write access to the lower mount
instead and drop the xattr checks from the filesystems. Not sure.
More information about the linux-mtd
mailing list