[PATCH v2 for-5.8-rc 4/6] nvme-multipath: fix deadlock due to head->lock

Sagi Grimberg sagi at grimberg.me
Wed Jun 24 03:00:58 EDT 2020


>> -	mutex_lock(&head->lock);
>> -	if (!(head->disk->flags & GENHD_FL_UP))
>> +	if (!test_and_set_bit(NVME_NS_HEAD_HAS_DISK, &head->flags))
>>   		device_add_disk(&head->subsys->dev, head->disk,
>>   				nvme_ns_id_attr_groups);
> 
> The HAS_DISK name is a little strange.  The disk obviously is set
> before, otherwise this call would dereference a NULL pointer :)
> 
> Maybe NVME_NSHEAD_LIVE?  or NVME_NSHEAD_DISK_LIVE?

I think I like NVME_NSHEAD_DISK_LIVE, which indicates better that
it relates to the gendisk and it is live (we called device_add_disk)



More information about the Linux-nvme mailing list