Re: [PATCH v5 01/27] libmultipath: Add initial framework

John Garry <[email protected]>
Newsgroups org.kernel.vger.linux-scsi,dev.linux.lists.sashiko-reviews
Organization Oracle Corporation
Message-ID <[email protected]>
On 27/07/2026 16:05, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] The static workqueue `mpath_wq` is allocated but never used to queue work.
> - [Low] Missing `#include <linux/wait_bit.h>` in `lib/multipath.c` causes a build issue.
> --
> 
> --- Patch [1]: [PATCH v5 01/27] libmultipath: Add initial framework ---
> commit 10e613ef081274ac617a43c354384f9ddc32f1f5
> Author: John Garry <[email protected]>
> 
> libmultipath: Add initial framework
> 
> Add initial framework for libmultipath to support path management, path
> selection, and failover handling.
> 
>> diff --git a/lib/multipath.c b/lib/multipath.c
>> new file mode 100644
>> index 0000000000000..9cc398d266adf
>> --- /dev/null
>> +++ b/lib/multipath.c
> [ ... ]
>> +void mpath_put_head(struct mpath_head *mpath_head)
>> +{
>> +	refcount_t *refcount = &mpath_head->refcount;
>> +
>> +	if (refcount_dec_and_test(&mpath_head->refcount))
>> +		wake_up_var(refcount);
> 
> [Severity: Low]
> Does this code build without including <linux/wait_bit.h>?
> 
> It appears that the wake_up_var() macro used here, and the wait_var_event()
> macro used in mpath_head_uninit(), are defined in <linux/wait_bit.h>.
> This header does not seem to be included directly or implicitly through
> <linux/multipath.h> or <linux/module.h>.

yes, it compiles

> 
>> +}
>> +EXPORT_SYMBOL_GPL(mpath_put_head);
> [ ... ]
>> +static int __init mpath_init(void)
>> +{
>> +	mpath_wq = alloc_workqueue("mpath-wq",
>> +			WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);
> 
> [Severity: Low]
> Is it necessary to allocate this workqueue here?
> 
> It looks like the static variable mpath_wq is allocated and initialized, but
> no work is ever actually queued to it. Could this allocation be removed
> until it is needed?

it's used later

> 
>> +	if (!mpath_wq)
>> +		return -ENOMEM;
>> +	return 0;
>> +}
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.