[PATCH v2 04/34] ext2: don't set SB_RDONLY after filesystem errors
Jan Kara
jack at suse.cz
Wed Nov 11 06:15:11 PST 2026
On Tue 10-11-26 22:50:47, Christian Brauner wrote:
> 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.
OK, so instead of BUGing in jfs_evict_inode(), shouldn't JFS just do
something like:
- BUG_ON(!list_empty(&ji->anon_inode_list));
+ if (!list_empty(&ji->anon_inode_list)) {
+ WARN_ON_ONCE(!sb_emergency_ro(inode->i_sb));
+ /* This needs helper in fs/jfs/jfs_txnmgr.c */
+ TXN_LOCK();
+ list_del_init(&ji->anon_inode_list);
+ TXN_UNLOCK();
+ }
So that JFS doesn't block everybody else? Because conceptually, once sb is
marked as emergency read-only, we really want to stop writeback so letting
sync_inodes() run seems moot.
> > 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.
Argh, also NFS I assume. OK, that won't be easy to get rid of AFAICT (we
generally don't have mount available there).
Honza
--
Jan Kara <jack at suse.com>
SUSE Labs, CR
More information about the linux-mtd
mailing list