diff mbox series

[01/10] scsi/sd: use blk_cleanup_queue() insted of put_disk()

Message ID 20210823202930.137278-2-mcgrof@kernel.org (mailing list archive)
State Superseded, archived
Delegated to: Mike Snitzer
Headers show
Series block: first batch of add_disk() error handling conversions | expand

Commit Message

Luis Chamberlain Aug. 23, 2021, 8:29 p.m. UTC
The single put_disk() is useful if you know you're not doing
a cleanup after add_disk(), but since we want to add support
for that, just use the normal form of blk_cleanup_disk() to
cleanup the queue and put the disk.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/scsi/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Aug. 24, 2021, 5:52 a.m. UTC | #1
On Mon, Aug 23, 2021 at 01:29:21PM -0700, Luis Chamberlain wrote:
> The single put_disk() is useful if you know you're not doing
> a cleanup after add_disk(), but since we want to add support
> for that, just use the normal form of blk_cleanup_disk() to
> cleanup the queue and put the disk.

Hmm, I don't think this is correct.  The request_queue is owned by the
core SCSI code.

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
Luis Chamberlain Aug. 27, 2021, 6:27 p.m. UTC | #2
On Tue, Aug 24, 2021 at 06:52:53AM +0100, Christoph Hellwig wrote:
> On Mon, Aug 23, 2021 at 01:29:21PM -0700, Luis Chamberlain wrote:
> > The single put_disk() is useful if you know you're not doing
> > a cleanup after add_disk(), but since we want to add support
> > for that, just use the normal form of blk_cleanup_disk() to
> > cleanup the queue and put the disk.
> 
> Hmm, I don't think this is correct.  The request_queue is owned by the
> core SCSI code.

Alright, I'll drop this one. For the life of me I can't find the respective
probe call on the scsi layer.

  Luis

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
Christoph Hellwig Aug. 28, 2021, 7:26 a.m. UTC | #3
On Fri, Aug 27, 2021 at 11:27:36AM -0700, Luis Chamberlain wrote:
> On Tue, Aug 24, 2021 at 06:52:53AM +0100, Christoph Hellwig wrote:
> > On Mon, Aug 23, 2021 at 01:29:21PM -0700, Luis Chamberlain wrote:
> > > The single put_disk() is useful if you know you're not doing
> > > a cleanup after add_disk(), but since we want to add support
> > > for that, just use the normal form of blk_cleanup_disk() to
> > > cleanup the queue and put the disk.
> > 
> > Hmm, I don't think this is correct.  The request_queue is owned by the
> > core SCSI code.
> 
> Alright, I'll drop this one. For the life of me I can't find the respective
> probe call on the scsi layer.

What probe call?  SCSI allocates the request_queue using the normal
blk_mq_init_queue function in scsi_alloc_sdev.  It it then used to
send SCSI passthrough commands for probing before eventually binding
an upper level driver using the driver model (or something not binding
one at all if there is none for the device type).

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 610ebba0d66e..7d5217905374 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3508,7 +3508,7 @@  static int sd_probe(struct device *dev)
  out_free_index:
 	ida_free(&sd_index_ida, index);
  out_put:
-	put_disk(gd);
+	blk_cleanup_disk(gd);
  out_free:
 	sd_zbc_release_disk(sdkp);
 	kfree(sdkp);