All of lore.kernel.org
 help / color / mirror / Atom feed
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 23:03:24 +0100	[thread overview]
Message-ID: <983f47533ee56b2a954de97dc7e02cbcbc4f9841.camel@suse.com> (raw)
In-Reply-To: <2bea9c3e-2a61-a51e-c13b-796adabe6f71@acm.org>

On Tue, 2023-01-17 at 13:52 -0800, Bart Van Assche wrote:
> On 1/17/23 13:48, Martin Wilck wrote:
> > Yes, that was my suggestion. Just defer the scsi_device_put() call
> > in
> > alua_rtpg_queue() in the case where the actual RTPG handler is not
> > queued. I won't have time for that before next week though.
> 
> Hi Martin,
> 
> Do you agree that the call trace shared by Steffen is not sufficient
> to 
> conclude that this change is necessary?

Hmm, I suppose I missed your point... to re-iterate my thinking:

 1 alua_queue_rtpg() must take a ref to the sdev before queueing work,
   whether or not the caller already has one
 2 queue_delayed_work() can fail
 3 if queue_delayed_work() fails, alua_queue_rtpg() must drop the ref
   it just took
 4 BUT (and this is what I guess I missed) this ref can't be the last
   one dropped, because the caller of alua_rtpg_queue() must still hold
   a reference. And scsi_device_put() only sleeps if the last ref is
   dropped. Therefore the issue in Steffen's call stack should
   indeed be fixed just by removing the might_sleep(). If all callers
   callers of alua_rtpg_queue() must hold an sdev reference (I believe 
   they do), we can indeed remove the might_sleep() entirely.

Is this correct reasoning, and what you meant previously? If yes, I
agree, and I apologize for not realizing it in the first place. 
But I think this is subtle enough to deserve a comment in the code.

Thanks
Martin


  reply	other threads:[~2023-01-17 22:25 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
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 [this message]
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=983f47533ee56b2a954de97dc7e02cbcbc4f9841.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 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.