On Wed, Jun 10, 2020 at 11:57:39AM +0200, Jan Kara wrote: > > So I guess it may still lead to inconsistency. How about add this checking > > into ext4_journal_get_write_access() ? > > Yes, this also occured to me later. Adding the check to > ext4_journal_get_write_access() should be safer. There's another thing which we could do. One of the issues is that we allow buffered writeback for block devices once the change to the block has been committed. What if we add a change to block device writeback code and in fs/buffer.c so that optionally, the file system can specify a callback function can get called when an I/O error has been reflected back up from the block layer? It seems unfortunate that currently, we can immediately report the I/O error for buffered writes to *files*, but for metadata blocks, we would only be able to report the problem when we next try to modify it. Making changes to fs/buffer.c might be controversial, but I think it might be result in a better solution. - Ted