Re: [PATCH] fs: fix possible inconsistent mount device

From: Yu Kuai
Date: Fri Sep 02 2022 - 02:10:12 EST


Hi, Christoph!

在 2022/08/13 15:15, Christoph Hellwig 写道:
On Sat, Aug 13, 2022 at 03:09:58PM +0800, Yu Kuai wrote:
Thanks for your reply. Do you think it's better to remove the rename
support from dm? Or it's better to add such limit?

It will probably be hard to entirely remove it. But documentation
and a rate limited warning discouraging it seems like a good idea.
.


I just found that not just rename, mount concurrent with device
remove/create can trigger this problem as well:

t1: t2
// create dm-0 with name test1
// mount /dev/mapper/test1
mount_bdev
blkdev_get_by_path
lookup_bdev
// remove dm-0
// create dm-0 with different name test2
blkdev_get_by_dev
// succeed

Do you think it's ok to add such checking to prevent this problem?

Thanks,
Kuai