linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Martin Wilck <mwilck@suse.com>, Christoph Hellwig <hch@lst.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Ming Lei <ming.lei@redhat.com>,
	Bart Van Assche <Bart.VanAssche@sandisk.com>,
	James Bottomley <jejb@linux.vnet.ibm.com>,
	linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v2 3/3] scsi: simplify scsi_stop_queue()
Date: Wed, 7 Jun 2023 09:39:24 -0700	[thread overview]
Message-ID: <c9f55fc9-3c60-5a6c-be2d-0c313c345bb2@acm.org> (raw)
In-Reply-To: <7ee70331d921854e2b27de3d072d0d8f8ce97f3b.camel@suse.com>

On 6/7/23 08:38, Martin Wilck wrote:
> On Wed, 2023-06-07 at 07:05 -0700, Bart Van Assche wrote:
>> On 6/7/23 02:26, Martin Wilck wrote:
>>> On Wed, 2023-06-07 at 07:27 +0200, Christoph Hellwig wrote:
>>>> On Tue, Jun 06, 2023 at 09:38:45PM +0200, mwilck@suse.com wrote:
>>>>>    scsi_target_block(struct device *dev)
>>>>>    {
>>>>> +       struct Scsi_Host *shost = dev_to_shost(dev);
>>>>> +
>>>>>           if (scsi_is_target_device(dev))
>>>>>                   starget_for_each_device(to_scsi_target(dev),
>>>>> NULL,
>>>>>                                           device_block);
>>>>>           else
>>>>>                   device_for_each_child(dev, NULL,
>>>>> target_block);
>>>>> +
>>>>> +       /* Wait for ongoing scsi_queue_rq() calls to finish. */
>>>>> +       if (!WARN_ON_ONCE(!shost))
>>>>
>>>> How could host ever be NULL here?  I can't see why we'd want this
>>>> check.
>>>
>>> The reason is simple: I wasn't certain if dev_to_shost() could
>>> return
>>> NULL, and preferred skipping the wait over an Oops. I hear you say
>>> that
>>> dev_to_shost() can't go wrong, so I'll remove the NULL test.
>>
>> I propose to pass shost as the first argument to scsi_target_block()
>> instead of using dev_to_shost() inside scsi_target_block(). Except in
>> __iscsi_block_session(), shost is already available as a local
>> variable.
> 
> If we do this, it might actually be cleaner to just pass the tag set to
> wait for.

Wouldn't that be close to a layering violation? Shouldn't SCSI APIs accept
pointers to SCSI objects instead of pointers to block layer abstractions?

Thanks,

Bart.


  reply	other threads:[~2023-06-07 16:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06 19:38 [PATCH v2 0/3] scsi: fixes for targets with many LUNs mwilck
2023-06-06 19:38 ` [PATCH v2 1/3] bsg: increase number of devices mwilck
2023-06-07  5:10   ` Christoph Hellwig
2023-06-06 19:38 ` [PATCH v2 2/3] scsi: sg: " mwilck
2023-06-07  5:10   ` Christoph Hellwig
2023-06-06 19:38 ` [PATCH v2 3/3] scsi: simplify scsi_stop_queue() mwilck
2023-06-07  5:27   ` Christoph Hellwig
2023-06-07  9:26     ` Martin Wilck
2023-06-07  9:36       ` Martin Wilck
2023-06-07 13:34         ` Christoph Hellwig
2023-06-07 14:05       ` Bart Van Assche
2023-06-07 14:08         ` Christoph Hellwig
2023-06-07 15:38         ` Martin Wilck
2023-06-07 16:39           ` Bart Van Assche [this message]
2023-06-07 17:56             ` Martin Wilck
2023-06-06 20:33 ` [PATCH v2 0/3] scsi: fixes for targets with many LUNs Bart Van Assche
2023-06-07  1:20 ` Ming Lei

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=c9f55fc9-3c60-5a6c-be2d-0c313c345bb2@acm.org \
    --to=bvanassche@acm.org \
    --cc=Bart.VanAssche@sandisk.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=mwilck@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).