All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nilay Shroff <nilay@linux.ibm.com>
To: Daniel Wagner <dwagner@suse.de>
Cc: linux-nvme@lists.infradead.org, yi.zhang@redhat.com, hch@lst.de,
	kbusch@kernel.org, sagi@grimberg.me, hare@suse.de,
	axboe@kernel.dk, shinichiro.kawasaki@wdc.com, gjoyce@ibm.com
Subject: Re: [PATCHv3] nvme: correctly account for namespace head reference counter
Date: Thu, 26 Jun 2025 13:59:22 +0530	[thread overview]
Message-ID: <45316d0a-97fd-4f0c-aabd-30015be94059@linux.ibm.com> (raw)
In-Reply-To: <c2233513-6736-4c2c-a757-96f205286f18@flourine.local>



On 6/26/25 1:18 PM, Daniel Wagner wrote:
> On Thu, Jun 26, 2025 at 10:49:19AM +0530, Nilay Shroff wrote:
>> This change prevents stale kobject entries from lingering in sysfs and
>> eliminates the module reload failures observed just after running
>> nvme/058.
>>
>> [1] https://lore.kernel.org/all/CAHj4cs8fOBS-eSjsd5LUBzy7faKXJtgLkCN+mDy_-ezCLLLq+Q@mail.gmail.com/
>>
>> Reported-by: yi.zhang@redhat.com
>> Closes: https://lore.kernel.org/all/CAHj4cs8fOBS-eSjsd5LUBzy7faKXJtgLkCN+mDy_-ezCLLLq+Q@mail.gmail.com/
>> Fixes: 62188639ec16 ("nvme-multipath: introduce delayed removal of the multipath head node")
>> Tested-by: yi.zhang@redhat.com
>> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
> 
> Reviewed-by: Daniel Wagner <dwagner@suse.de>
> 
>>  		list_del_init(&ns->head->entry);
>> +		/*
>> +		 * If multipath is not configured, we still create a namespace
>> +		 * head (nshead), but head->disk is not initialized in that case.
>> +		 * As a result, only a single reference to nshead is held (via
>> +		 * kref_init()) when it is created. Therefore, ensure that we
>> +		 * do not release the reference to nshead twice if head->disk
>> +		 * is not present.
>> +		 */
>> +		if (ns->head->disk)
>> +			last_path = true;
> 
> just nitpicking: what about renaming the variable to something like
> 'multipath' which matches more with the comment.

The variable @last_path is meant to indicate that we're releasing/removing the last
remaining path to the namespace, which is relevant only when NVMe multipath is enabled
(i.e., ns->head->disk is set). So if we rename @last_path to @multipath, it could
become less intuitive, as the name wouldn't reflect the actual logic — that we're
conditionally releasing the nshead reference only when the last path to the namespace 
is being removed. Hence, in this context, IMO, @last_path is more semantically accurate
and self-explanatory.

Moreover, in nvme_ns_remove() as well we use @last_path in the same context as
mentioned above. 

Thanks,
--Nilay


  reply	other threads:[~2025-06-26  9:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26  5:19 [PATCHv3] nvme: correctly account for namespace head reference counter Nilay Shroff
2025-06-26  7:34 ` Hannes Reinecke
2025-06-26  7:48 ` Daniel Wagner
2025-06-26  8:29   ` Nilay Shroff [this message]
2025-06-26  8:41     ` Daniel Wagner
2025-06-30  6:36 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45316d0a-97fd-4f0c-aabd-30015be94059@linux.ibm.com \
    --to=nilay@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=gjoyce@ibm.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yi.zhang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.