From: Martin Wilck <mwilck@suse.com>
To: Bart Van Assche <bvanassche@acm.org>,
Steffen Maier <maier@linux.ibm.com>,
linux-scsi <linux-scsi@vger.kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <jejb@linux.ibm.com>,
Sachin Sant <sachinp@linux.ibm.com>,
Hannes Reinecke <hare@suse.de>,
Benjamin Block <bblock@linux.ibm.com>,
linux-s390 <linux-s390@vger.kernel.org>
Subject: Re: kernel BUG scsi_dh_alua sleeping from invalid context && kernel WARNING do not call blocking ops when !TASK_RUNNING
Date: Tue, 17 Jan 2023 10:28:57 +0100 [thread overview]
Message-ID: <125f247806396f19fd27dcfa71f530b5b4a529a6.camel@suse.com> (raw)
In-Reply-To: <a9da2b27-882f-bc8e-3400-cb53440e2159@acm.org>
Hello Bart,
On Mon, 2023-01-16 at 09:48 -0800, Bart Van Assche wrote:
> On 1/16/23 08:57, Martin Wilck wrote:
> > Can we simply defer the scsi_device_put() to a workqueue?
>
> I'm concerned that would reintroduce a race condition when LLD kernel
> modules are removed.
I don't follow. Normally, alua_rtpg_queue() queues rtpg_work, and
alua_rtpg_work() will be called from the work queue and will eventually
call scsi_device_put() when the RTPG is finished.
alua_rtpg_queue() only calls scsi_device_put() if queueing rtpg_work
fails[*]. If we deferred this scsi_device_put() call to a work queue,
what would be the difference (wrt a module_put() race condition)
compared to the case where queue_delayed_work() succeeds?
In both cases, scsi_device_put() would be called from a work queue.
Given that alua_rtpg_queue() must take a reference to the scsi device
for the case that queueing succeeds, and that alua_rtpg_queue() is
sometimes called in atomic context, I think deferring the
scsi_device_put() call is the only option we have.
Thanks,
Martin
[*] or if queueing turns out to be unnecessary, in which case we could
optimize away the scsi_device_get() call.
next prev parent reply other threads:[~2023-01-17 9:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 14:59 kernel BUG scsi_dh_alua sleeping from invalid context && kernel WARNING do not call blocking ops when !TASK_RUNNING Steffen Maier
2023-01-16 16:57 ` Martin Wilck
2023-01-16 17:48 ` Bart Van Assche
2023-01-16 17:58 ` Martin Wilck
2023-01-17 9:28 ` Martin Wilck [this message]
2023-01-17 18:50 ` Bart Van Assche
2023-01-17 21:48 ` Martin Wilck
2023-01-17 21:52 ` Bart Van Assche
2023-01-17 22:03 ` Martin Wilck
2023-01-18 0:29 ` Bart Van Assche
2023-01-18 8:45 ` Martin Wilck
2023-01-18 16:17 ` Steffen Maier
2023-01-24 11:16 ` Steffen Maier
2023-01-24 11:36 ` Martin Wilck
2023-01-16 17:55 ` Bart Van Assche
2023-01-16 18:12 ` Steffen Maier
2023-01-16 18:31 ` Bart Van Assche
2023-01-17 7:46 ` Martin Wilck
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=125f247806396f19fd27dcfa71f530b5b4a529a6.camel@suse.com \
--to=mwilck@suse.com \
--cc=bblock@linux.ibm.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=jejb@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=maier@linux.ibm.com \
--cc=martin.petersen@oracle.com \
--cc=sachinp@linux.ibm.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