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

Christoph Hellwig hch at lst.de
Wed Jun 24 02:39:03 EDT 2020


On Tue, Jun 23, 2020 at 05:18:51PM -0700, Sagi Grimberg wrote:
> -	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?



More information about the Linux-nvme mailing list