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: NYu Kuai <yukuai3@huawei.com> Reviewed-by: NHou Tao <houtao1@huawei.com> Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
Showing
想要评论请 注册 或 登录