Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: Nilay Shroff <nilay@linux.ibm.com>,
	hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH v3 2/2] nvme: fix cdev lifetime
Date: Thu, 16 Jul 2026 17:33:52 +0100	[thread overview]
Message-ID: <d00a2702-4713-4f29-a7ee-7eff52aa5c23@oracle.com> (raw)
In-Reply-To: <01c56065-b785-4cc6-87b7-47a0078ebc67@linux.ibm.com>

On 16/07/2026 16:03, Nilay Shroff wrote:
> On 7/13/26 4: 12 PM, John Garry wrote: > Fix the lifetime for the cdev by making
> adding the cdev add take a > reference to the NS head and drop that reference in
> the > nvme_ns_head. cdev_device release function. > > The same problem
> 
> 
> On 7/13/26 4:12 PM, John Garry wrote:
>> Fix the lifetime for the cdev by making adding the cdev add take a
>> reference to the NS head and drop that reference in the
>> nvme_ns_head.cdev_device release function.
>> 
>> The same problem exists for the NS cdev lifetime, so resolve that issue
>> through a similar method by taking a reference to the NS for the lifetime
>> of the cdev. Note that nvme_ns_chr_open() -> nvme_ns_open() also takes a
>> reference to the NS. Now that should not be needed, but that code is
>> common to bdev ioctl, so keep as is.
> 
> The bdev ioctl uses nvme_ns_open() and nvme_ns_release(). So, IMO, you may also
> remove nvme_ns_chr_open() and nvme_ns_chr_release() methods.

nvme_ns_chr_open() and nvme_ns_chr_release() call nvme_ns_open() and 
nvme_ns_relase(), respectively, and they do more than get and put a ref 
to the NS - specifically they also check that they are not called for 
multipath mode (as the NS bdev/cdev should be hidden) and take/put a 
reference to the controller ops module. Why are those addition actions 
not required for the cdev? Or should it be done when we add/del the cdev 
(like in this patch)?

> 
> Otherwise this looks good.
> 
> Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
> 

thanks


  reply	other threads:[~2026-07-16 16:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 10:42 [PATCH v3 0/2] nvme: fix cdev lifetime series John Garry
2026-07-13 10:42 ` [PATCH v3 1/2] nvme: add nvme_get_ns_head() John Garry
2026-07-13 12:06   ` Christoph Hellwig
2026-07-16 15:03   ` Nilay Shroff
2026-07-13 10:42 ` [PATCH v3 2/2] nvme: fix cdev lifetime John Garry
2026-07-13 12:06   ` Christoph Hellwig
2026-07-16 15:03   ` Nilay Shroff
2026-07-16 16:33     ` John Garry [this message]
2026-07-16 18:03 ` [PATCH v3 0/2] nvme: fix cdev lifetime series Keith Busch

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=d00a2702-4713-4f29-a7ee-7eff52aa5c23@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=nilay@linux.ibm.com \
    --cc=sagi@grimberg.me \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox