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

Zhihao Cheng chengzhihao1 at huawei.com
Tue Nov 10 17:53:56 PST 2026


在 2026/11/11 5:54, Christian Brauner 写道:
> 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.
> 
Agreed
> 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.
Agreed.

> 
>> 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.
Oh, I understand now, you mean the SB_RDONLY flag in vfs layer.
> 
>> 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().
Great.
> 
> .
> 




More information about the linux-mtd mailing list