Commit 00f20694 authored by Yu Kuai's avatar Yu Kuai Committed by Yongqiang Liu
Browse files

block: check 'bd_super' before rescanning partition

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6BHNT


CVE: NA

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

This commit revert following three patches:

1) commit 8551c354 ("block: remove the bd_openers checks in
blk_drop_partitions")
2) commit c14c928e ("block: fix busy device checking in
blk_drop_partitions again")
3) commit db4eff3b ("block: fix busy device checking in
blk_drop_partitions")

Before commit 8551c354 ("block: remove the bd_openers checks in
blk_drop_partitions"), if block device is opened already, rescan will fail
by checking bd_openers. And the commit remove such checking because
checking bd_openers is not logical, for example, if block device is
opened by someone else, rescan will always fail.

However, after the commit, we meet a problem that rescan a block device
with a mounted filesystem(ext4) will cause data lost. Since that mount
ext4 will set bd_super, fix the problem by checking bd_super instead of
bd_openers.

Noted that some filesystem(for example, ext4/xfs log device, btrfs) doesn't
set bd_super, such problem still exists.

Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 6398c1f1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment