[dm-devel] [PATCH 7/8] dm: delay registering the gendisk

Yu Kuai yukuai1 at huaweicloud.com
Fri Jul 15 03:24:16 UTC 2022


Hi, Christoph!

在 2022/07/07 15:20, Yu Kuai 写道:
> 在 2022/07/07 13:24, Christoph Hellwig 写道:
>> On Thu, Jul 07, 2022 at 11:29:26AM +0800, Yu Kuai wrote:
>>> We found that this patch fix a nullptr crash in our test:
>>
>>> Do you think it's ok to backport this patch(and all realted patches) to
>>> lts, or it's better to fix that bio can be submitted with queue
>>> uninitialized from block layer?
>>
>> Given how long ago this was I do not remember offhand how much prep
>> work this would require.  The patch itself is of course tiny and
>> backportable, but someone will need to do the work and figure out how
>> much else would have to be backported.
> 
> Ok, I'll try to figure out that, and backport them.(At least to 5.10.y)

While reviewing the code, I didn't found any protection that
bd_link_disk_holder() won't concurrent with
bd_register_pending_holders(). If they do can concurrent,
following scenario is problematic:

t1				t2
device_add_disk
  disk->slave_dir = kobject_create_and_add
				bd_link_disk_holder
				 __link_disk_holder
				 list_add
  bd_register_pending_holders
   list_for_each_entry
    __link_disk_holder -> -EEXIST

In this case, I think maybe ignore '-EEXIST' is fine.

I'm not familiar with dm, and I'm not sure if I missed something,
please kindly correct me if I'm wrong.

Thanks,
Kuai



More information about the dm-devel mailing list