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

Christian Brauner brauner at kernel.org
Thu Nov 12 04:01:34 PST 2026


On Wed, Nov 11, 2026 at 03:15:11PM +0100, Jan Kara wrote:
> 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();
> +	}

Fwiw, this leaks the inode's anonymous tlocks. They're from TxLock which
is shared by all jfs mounts. txLock() also sets mp->lid and pinned the
metapages with metapage_nohomeok().

So the helper would have to tear all of that down like txAbort() does
and drop the pins. Doable, I guess not sure if this belongs into the
series.

> 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.

Meh, but a check in sync_filesystem() doesn't stop writeback? The
flusher doesn't know about the emergency state and keeps calling
->writepages() and ->write_inode().

And kill_block_super() calls sync_blockdev() after
generic_shutdown_super() so everything in the bdev mapping
(FAT, bitmaps, inode table blocks) gets writeback anyway. All the check
does is make syncfs() return without writing anything and make unmount
drop whatever the flusher hasn't gotten to yet. Which might be the goal
you're after?

> Argh, also NFS I assume. OK, that won't be easy to get rid of AFAICT (we
> generally don't have mount available there).

So nfsd_setxattr() takes write access to the export's mount via
fh_want_write(). So this would get EROFS from the VFS. Afaict it's
ecryptfs and IMA? ima_fix_xattr() only checks IS_RDONLY().

-- 



More information about the linux-mtd mailing list