summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2018-02-26 13:01:42 +0100
committerJens Axboe <axboe@kernel.dk>2018-02-26 17:48:42 +0100
commit560e7cb2f3c7f09bbfb36cd0b900e24fddd20282 (patch)
tree62ae10aef5f6b0c59124a14a89f22dd37ce20f09 /include
parentgenhd: Fix BUG in blkdev_open() (diff)
downloadlinux-560e7cb2f3c7f09bbfb36cd0b900e24fddd20282.tar.xz
linux-560e7cb2f3c7f09bbfb36cd0b900e24fddd20282.zip
blockdev: Avoid two active bdev inodes for one device
When blkdev_open() races with device removal and creation it can happen that unhashed bdev inode gets associated with newly created gendisk like: CPU0 CPU1 blkdev_open() bdev = bd_acquire() del_gendisk() bdev_unhash_inode(bdev); remove device create new device with the same number __blkdev_get() disk = get_gendisk() - gets reference to gendisk of the new device Now another blkdev_open() will not find original 'bdev' as it got unhashed, create a new one and associate it with the same 'disk' at which point problems start as we have two independent page caches for one device. Fix the problem by verifying that the bdev inode didn't get unhashed before we acquired gendisk reference. That way we make sure gendisk can get associated only with visible bdev inodes. Tested-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions