[dm-devel] [PATCH] libmultipath: clear removed path from mpp

lixiaokeng lixiaokeng at huawei.com
Mon Nov 29 04:16:25 UTC 2021



On 2021/11/29 7:18, Martin Wilck wrote:

>>         /*
>> @@ -329,6 +331,20 @@ void set_path_removed(struct path *pp)
>>                 condlog(0, "%s: internal error: mpp == NULL", pp-
>>> dev);
>>                 return;
>>         }
>> +
>> +       /*
>> +        * The path is removed, clear it from mp->paths and mpp->pgs.
>> +        */
>> +       i = find_slot(mpp->paths, pp);
>> +       if (i != -1)
>> +               vector_del_slot(mpp->paths, i);
>> +
>> +       vector_foreach_slot(mpp->pg, pgp, j) {
>> +               i = find_slot(pgp->paths, (void *)pp);
>> +               if (i != -1)
>> +                       vector_del_slot(pgp->paths, i);
>> +       }
>> +
> 
> No, we can't do this. It would invalidate all the work we did for
> INIT_REMOVED. It's the very idea of INIT_REMOVED that we do NOT
> immediately clear the path from our data structures. The main problem
> is that INIT_REMOVED paths may still be part of the map in the kernel.
> Thus when we re-read the kernel state, the path will be re-added to
> mpp->paths.
> 
> We need to rework the free_multipath() logic. It might be sufficient
> to simply clear the references to the devices in mpp before calling
> orphan_paths(). Can you try the attached patch, please?
> 

Thanks for replay. The attached patch resolves this error.

I hopes that "Reported-by: Lixiaokeng <lixiaokeng at huawei>" is added to
the patch. Thanks again.

Regards,
Lixiaokeng





More information about the dm-devel mailing list