]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: check superblock mapped prior to committing
authorJon Derrick <jonathan.derrick@intel.com>
Mon, 2 Jul 2018 22:45:18 +0000 (18:45 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 2 Jul 2018 22:45:18 +0000 (18:45 -0400)
commit5812f1a4d65fc4be6c0d6ea6e3275d57e1f7c566
tree5e7904cf0721942898da5e47ff811091252644f4
parentb9279858a0eb173a46b3f7cd6e79cc5316908c90
ext4: check superblock mapped prior to committing

This patch attempts to close a hole leading to a BUG seen with hot
removals during writes [1].

A block device (NVME namespace in this test case) is formatted to EXT4
without partitions. It's mounted and write I/O is run to a file, then
the device is hot removed from the slot. The superblock attempts to be
written to the drive which is no longer present.

The typical chain of events leading to the BUG:
ext4_commit_super()
  __sync_dirty_buffer()
    submit_bh()
      submit_bh_wbc()
        BUG_ON(!buffer_mapped(bh));

This fix checks for the superblock's buffer head being mapped prior to
syncing.

[1] https://www.spinics.net/lists/linux-ext4/msg56527.html

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
fs/ext4/super.c