All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Hector Martin <marcan@marcan.st>,
	Sven Peter <sven@svenpeter.dev>, Keith Busch <kbusch@kernel.org>,
	Sagi Grimberg <sagi@grimberg.me>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/4] scsi: remove an extra queue reference
Date: Wed, 19 Oct 2022 09:23:02 +0800	[thread overview]
Message-ID: <Y09Rdh0O23cvizeQ@T590> (raw)
In-Reply-To: <Y09QCb5A+iL/Igoj@T590>

On Wed, Oct 19, 2022 at 09:16:57AM +0800, Ming Lei wrote:
> On Tue, Oct 18, 2022 at 03:57:18PM +0200, Christoph Hellwig wrote:
> > Now that blk_mq_destroy_queue does not release the queue reference, there
> > is no need for a second queue reference to be held by the scsi_device.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  drivers/scsi/scsi_scan.c  | 1 -
> >  drivers/scsi/scsi_sysfs.c | 1 -
> >  2 files changed, 2 deletions(-)
> > 
> > diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> > index 5d27f5196de6f..0a95fa787fdf4 100644
> > --- a/drivers/scsi/scsi_scan.c
> > +++ b/drivers/scsi/scsi_scan.c
> > @@ -344,7 +344,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
> >  	sdev->request_queue = q;
> >  	q->queuedata = sdev;
> >  	__scsi_init_queue(sdev->host, q);
> > -	WARN_ON_ONCE(!blk_get_queue(q));
> >  
> >  	depth = sdev->host->cmd_per_lun ?: 1;
> >  
> > diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> > index 1214c6f07bc64..c95177ca6ed26 100644
> > --- a/drivers/scsi/scsi_sysfs.c
> > +++ b/drivers/scsi/scsi_sysfs.c
> > @@ -1478,7 +1478,6 @@ void __scsi_remove_device(struct scsi_device *sdev)
> >  	mutex_unlock(&sdev->state_mutex);
> >  
> >  	blk_mq_destroy_queue(sdev->request_queue);
> > -	blk_put_queue(sdev->request_queue);
> 
> The above put is counter-pair of blk_get_queue() in scsi_alloc_sdev, and
> the original blk_put_queue() in blk_mq_destroy_queue() is counter-pair of
> the initial get in blk_alloc_queue().
> 
> Now blk_put_queue() is moved out of blk_mq_destroy_queue(), I am wondering
> how the scsi queue lifetime can work correctly with this patch? Or is there
> bug in current scsi code?

oops, the above blk_put_queue() is actually added in the 1st patch, so
this patch is fine, sorry for the noise.


thanks,
Ming


  reply	other threads:[~2022-10-19  1:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 13:57 don't drop the queue reference in blk_mq_destroy_queue Christoph Hellwig
2022-10-18 13:57 ` [PATCH 1/4] blk-mq: move the call to blk_put_queue out of blk_mq_destroy_queue Christoph Hellwig
2022-10-18 20:44   ` Chaitanya Kulkarni
2022-10-19  8:19   ` Sagi Grimberg
2022-10-25 14:23   ` Jens Axboe
2022-10-25 14:25     ` Jens Axboe
2022-10-18 13:57 ` [PATCH 2/4] scsi: remove an extra queue reference Christoph Hellwig
2022-10-18 20:44   ` Chaitanya Kulkarni
2022-10-19  1:16   ` Ming Lei
2022-10-19  1:23     ` Ming Lei [this message]
2022-10-19  8:19   ` Sagi Grimberg
2022-10-18 13:57 ` [PATCH 3/4] nvme-pci: " Christoph Hellwig
2022-10-18 20:44   ` Chaitanya Kulkarni
2022-10-19  8:19   ` Sagi Grimberg
2022-10-18 13:57 ` [PATCH 4/4] nvme-apple: " Christoph Hellwig
2022-10-18 17:51   ` Sven Peter
2022-10-18 20:45   ` Chaitanya Kulkarni
2022-10-19  8:19   ` Sagi Grimberg
2022-10-18 15:16 ` don't drop the queue reference in blk_mq_destroy_queue Keith Busch
2022-10-25 14:26 ` Jens Axboe

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=Y09Rdh0O23cvizeQ@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=martin.petersen@oracle.com \
    --cc=sagi@grimberg.me \
    --cc=sven@svenpeter.dev \
    /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.