[PATCH v2] nvme: invalidate paths during rescan

Daniel Wagner dwagner at suse.de
Wed Aug 11 08:22:46 PDT 2021


Hi Sagi,

On Tue, Aug 10, 2021 at 06:18:01PM -0700, Sagi Grimberg wrote:
> > +void nvme_mpath_invalidate_paths(struct nvme_ns *ns)
> 
> invalidate is not a great name for this very specific case here.

Okay, I opted for nvme_mpath_revalidate_paths() as we already have
nvme_revalidate_zones() which does also capacity checks too.

> > +{
> > +	struct nvme_ns_head *head = ns->head;
> > +	sector_t capacity = get_capacity(head->disk);
> > +	int node;
> > +
> > +	for_each_node(node)
> > +		rcu_assign_pointer(head->current_path[node], NULL);
> 
> Here the ns can get re-selected as the current path.

This is on purpose. By clearing all current_path the next
nvme_find_path() will select a valid current_path which might be the
same path.

> > +
> > +	list_for_each_entry_rcu(ns, &head->list, siblings) {
> > +		if (capacity != get_capacity(ns->disk))
> > +			set_bit(NVME_NS_INVALIDATED, &ns->flags);
> 
> maybe instead of invalidated reverse the polarity with
> NVME_NS_READY? clear it here and set it in update_ns_info?

Will do, see next version.

Thanks for the feedback!

Daniel



More information about the Linux-nvme mailing list