[PATCH v2 3/3] nvme/multipath: fix stale ana state for namespaces just added by scan work

Sagi Grimberg sagi at grimberg.me
Mon Sep 13 23:24:30 PDT 2021


>>> Scan work initially adds new namespaces to ctrl->namespaces TAIL.
>>> They make the list unordered temporarily until nvme_scan_work()
>>> finally sorts the list.
>>>
>>> Solution:
>>> In order to preserve the way ctrl->namespaces is updated and sorted,
>>> make nvme_update_ana_state() deal with the case where ctrl->namespaces
>>> is not fully sorted and has new namespaces appended with potentially
>>> lower nsids.
>>> nvme_update_ana_state() keeps track of the nsid seen in the list,
>>> detects the unsorted case (rare), and restarts scanning of desc->nsids.
>>
>> Can we dust off the patch from Chaitanya to switch to an always sorted
>> xarray instead of papering over this delayed sort?
> 
> Yeah, that's what I was going to say. :)

I agree it should not happen with xarray as inserts preserve sorting,
but that patch has the non-trivial removal of the namespaces_rwsem which
synchronizes in a lot in a lot of error recovery flows. It's very
possible that xarray will introduce regressions.

Anton, is it possible to rerun tests with the xarray patch applied?
The latest one is:
[PATCH V6] nvme-core: use xarray for ctrl ns tracking



More information about the Linux-nvme mailing list