[PATCH v2 28/34] ubifs: don't set SB_RDONLY after errors

Christian Brauner brauner at kernel.org
Tue Nov 10 13:54:09 PST 2026


On Fri, Oct 30, 2026 at 11:42:15AM +0800, Zhihao Cheng wrote:
> If we remove the c->ro_error check, ubifs_remount_ro->ubifs_wbuf_sync
> will return EROFS and trigger ubifs_ro_mode() again, I think we can
> retain the pre-check placement to trigger more error printing.

ubifs_ro_mode() doesn't do anything once c->ro_error is set so that
won't print anything again. But there's no point in syncing the
write-buffers and writing the master node after an error.

So I'll skip both in ubifs_remount_ro() when c->ro_error is set like
ubifs_put_super() does and only cancel the write-buffer timers. The
remount to read-only itself has to keep working because the error
doesn't set SB_RDONLY anymore.

> BTW, a remount to read-write after an error is refused too.

Only if c->ro_mount is set. ubifs_ro_mode() sets SB_RDONLY but never
c->ro_mount. So after an error on a read-write mount ubifs_reconfigure()
takes neither branch and reconfigure_super() clears SB_RDONLY again.

> The sb_rdonly won't affect the sync_fs_one_sb() after an error, and
> sb_emergency_ro check in not added into sync_fs_one_sb, should we add
> the c->ro_error check in ubifs_sync_fs() to prevent the failure
> ubifs_wbuf_sync executing?

Yes, I'll return -EROFS from ubifs_sync_fs() when c->ro_error is set.
After the !wait check so sync_filesystem() still gets to sync_inodes_sb().



More information about the linux-mtd mailing list