]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: clean the old superblocks before freeing the device
authorJeff Mahoney <jeffm@suse.com>
Tue, 20 Sep 2016 12:50:21 +0000 (08:50 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2016 16:08:44 +0000 (18:08 +0200)
commitfac07e69e32b61fd2801401605af3ddf20573ed6
tree75f6575c0d9aecef3d981ff0083222b2c4932be9
parente6e2b38d304501b245a8897af0f59a798649b7d3
btrfs: clean the old superblocks before freeing the device

btrfs_rm_device frees the block device but then re-opens it using
the saved device name.  A race exists between the close and the
re-open that allows the block size to be changed.  The result
is getting stuck forever in the reclaim loop in __getblk_slow.

This patch moves the superblock cleanup before closing the block
device, which is also consistent with other callers.  We also don't
need a private copy of dev_name as the whole routine operates under
the uuid_mutex.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c