提交 8551c354 编写于 作者: C Christoph Hellwig 提交者: Yongqiang Liu

block: remove the bd_openers checks in blk_drop_partitions

mainline inclusion
from mainline-v5.7-rc4
commit 10c70d95
category: bugfix
bugzilla: 186898, https://gitee.com/openeuler/kernel/issues/I5ALMJ
CVE: NA

--------------------------------

When replacing the bd_super check with a bd_openers I followed a logical
conclusion, which turns out to be utterly wrong.  When a block device has
bd_super sets it has a mount file system on it (although not every
mounted file system sets bd_super), but that also implies it doesn't even
have partitions to start with.

So instead of trying to come up with a logical check for all openers,
just remove the check entirely.

Fixes: d3ef5536 ("block: fix busy device checking in blk_drop_partitions")
Fixes: cb6b771b ("block: fix busy device checking in blk_drop_partitions again")
Reported-by: NMichal Koutný <mkoutny@suse.com>
Reported-by: NYang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NLi Nan <linan122@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 c14c928e
...@@ -464,7 +464,7 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev) ...@@ -464,7 +464,7 @@ static int drop_partitions(struct gendisk *disk, struct block_device *bdev)
struct hd_struct *part; struct hd_struct *part;
int res; int res;
if (bdev->bd_part_count || bdev->bd_openers > 1) if (bdev->bd_part_count)
return -EBUSY; return -EBUSY;
res = invalidate_partition(disk, 0); res = invalidate_partition(disk, 0);
if (res) if (res)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册