[PATCH v2 for-5.8-rc 1/6] nvme: fix possible deadlock when I/O is blocked

Sagi Grimberg sagi at grimberg.me
Wed Jun 24 02:54:31 EDT 2020


>> Revert fab7772bfbcf ("nvme-multipath: revalidate nvme_ns_head gendisk
>> in nvme_validate_ns")
>>
>> When adding a new namespace to the head disk (via nvme_mpath_set_live)
>> we will see partition scan which triggers I/O on the mpath device node.
>> This process will usually be triggered from the scan_work which holds
>> the scan_lock. If I/O blocks (if we got ana change currently have only
>> available paths but none are accessible) this can deadlock on the head
>> disk bd_mutex as both partition scan I/O takes it, and head disk revalidation
>> takes it to check for resize (also triggered from scan_work on a different
>> path). See trace [1].
>>
>> This is no longer needed since commit cb224c3af4df ("nvme: Convert to
>> use set_capacity_revalidate_and_notify") which already updates resize
>> info without unnecessarily revalidating the disk.
> 
> Did you look if any other revalidation gets skipped this way? E.g.
> LBA size change?
> 
>  From purely the size POV this looks good, though.

The only reason the revalidate was added was to update on a size change,
which is redundant.

And if you look at revalidate, it only calls fops->revalidate_disk
(which is a noop in the mpath device) and checks the size change.

If you find this explanation sufficient, I'd love your Reviewed-by
tag ;)



More information about the Linux-nvme mailing list