Some devices(nbd) can becomes unoperatable via kill_bdev so its pagecache will be invalidated and all buffers becomes unmapped. In that situation we will trigger BUGON on submit_bh. #Testcase mkdir -p a/mnt cd a truncate -s 1G img mkfs.ext4 -F img qemu-nbd -c /dev/nbd0 img mount /dev/nbd0 /mnt cp -r /bin/ /mnt& # Disconnect nbd while cp is active qemu-nbd -d /dev/nbd0 Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx> --- fs/jbd2/journal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 81e6226..f2760c8 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1333,6 +1333,18 @@ static int jbd2_write_superblock(journal_t *journal, int write_op) if (!(journal->j_flags & JBD2_BARRIER)) write_op &= ~(REQ_FUA | REQ_FLUSH); lock_buffer(bh); + /* + * Some disk drives may invalidate its page cache on failure + * so sbh becomes unmapped. + */ + if (!buffer_mapped(bh)) { + /* Disk dissapeared under us, there is nothing we can + do but complain */ + printk(KERN_ERR "JBD2: journal superblock was invalidated " + "for %s.\n", journal->j_devname); + return -EIO; + } + if (buffer_write_io_error(bh)) { /* * Oh, dear. A previous attempt to write the journal -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html