From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"maxg@mellanox.com" <maxg@mellanox.com>,
"israelr@mellanox.com" <israelr@mellanox.com>,
"hare@suse.de" <hare@suse.de>
Subject: Re: [PATCH 0/3] Unblock SCSI devices even if the LLD is being unloaded
Date: Sat, 18 Mar 2017 20:49:57 +0000 [thread overview]
Message-ID: <1489870182.2339.17.camel@sandisk.com> (raw)
In-Reply-To: <1489841099.2917.3.camel@HansenPartnership.com>
On Sat, 2017-03-18 at 07:44 -0500, James Bottomley wrote:
> On Fri, 2017-03-17 at 16:40 +0000, Bart Van Assche wrote:
> > Does your comment mean that you think there is a scenario in which
> > scsi_target_block() or scsi_target_unblock() can be called while the
> > text area of a SCSI LLD is being released? I have reviewed all the
> > callers of these functions but I have not found such a scenario.
> > scsi_target_block() and scsi_target_unblock() are either called from
> > a SCSI transport layer implementation (FC, iSCSI, SRP) or from a SCSI
> > LLD kernel module (snic_disc). All these kernel modules only call
> > scsi_target_*block() for resources (rport or SCSI target
> > respectively) that are removed before the code area of
> > these modules is released. This is why I think that calling
> > scsi_target_*block() without increasing the SCSI LLD module reference
> > count is safe.
>
> The transport code is above the HBA module code and in that code
> unblock could be racing with module removal. The original premise was
> that once the dev/target/host goes into DEL, nothing can call into
> queuecommand or get a reference to the device, so nothing halts removal
> after that, but you changed that with your code, which is why it's now
> unsafe.
Hello James,
Thank you for having provided more background information about the design
goals of the SCSI code. However, regarding scsi_target_*block(), I think it
is safe even for transport modules to call these functions without obtaining
an additional reference on the SCSI LLD kernel module. The transport
implementation won't attempt to block or unblock a SCSI target anymore once
unloading of the LLD text has started. SCSI LLDs release the attached
transport before unloading of the SCSI LLD kernel module text starts and
SCSI transport modules guarantee that scsi_target_*block() won't be called
anymore after the transport module has been released.
If you do not agree with the above please provide a call sequence for an
existing SCSI LLD or transport module that illustrates the race you
described.
Thanks,
Bart.
next prev parent reply other threads:[~2017-03-18 20:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 20:56 [PATCH 0/3] Unblock SCSI devices even if the LLD is being unloaded Bart Van Assche
2017-03-16 20:56 ` [PATCH 1/3] __scsi_iterate_devices(): Make the get and put functions arguments Bart Van Assche
2017-03-16 20:56 ` [PATCH 2/3] Introduce starget_for_all_devices() and shost_for_all_devices() Bart Van Assche
2017-03-18 17:14 ` kbuild test robot
2017-03-16 20:56 ` [PATCH 3/3] Ensure that scsi_target_unblock() examines all devices Bart Van Assche
2017-03-18 20:22 ` kbuild test robot
2017-03-16 22:53 ` [PATCH 0/3] Unblock SCSI devices even if the LLD is being unloaded James Bottomley
2017-03-16 23:19 ` Bart Van Assche
2017-03-17 12:54 ` James Bottomley
2017-03-17 16:40 ` Bart Van Assche
2017-03-18 12:44 ` James Bottomley
2017-03-18 20:49 ` Bart Van Assche [this message]
2017-04-10 17:46 ` Bart Van Assche
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=1489870182.2339.17.camel@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=hare@suse.de \
--cc=israelr@mellanox.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=maxg@mellanox.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