From: "WeitaoWang-oc@zhaoxin.com" <WeitaoWang-oc@zhaoxin.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <oneukum@suse.com>, <stern@rowland.harvard.edu>,
<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-scsi@vger.kernel.org>,
<usb-storage@lists.one-eyed-alien.net>, <WeitaoWang@zhaoxin.com>,
<stable@vger.kernel.org>
Subject: Re: [PATCH v3] USB:UAS:return ENODEV when submit urbs fail with device not attached
Date: Thu, 7 Mar 2024 01:58:06 +0800 [thread overview]
Message-ID: <3d5254cf-27de-b689-352b-45698e265f5e@zhaoxin.com> (raw)
In-Reply-To: <2024030530-trinity-triangle-c334@gregkh>
On 2024/3/5 21:25, Greg KH wrote:
>
>
> On Fri, Mar 01, 2024 at 03:33:49AM +0800, Weitao Wang wrote:
>> In the scenario of entering hibernation with udisk in the system, if the
>> udisk was gone or resume fail in the thaw phase of hibernation. Its state
>> will be set to NOTATTACHED. At this point, usb_hub_wq was already freezed
>> and can't not handle disconnect event. Next, in the poweroff phase of
>> hibernation, SYNCHRONIZE_CACHE SCSI command will be sent to this udisk
>> when poweroff this scsi device, which will cause uas_submit_urbs to be
>> called to submit URB for sense/data/cmd pipe. However, these URBs will
>> submit fail as device was set to NOTATTACHED state. Then, uas_submit_urbs
>> will return a value SCSI_MLQUEUE_DEVICE_BUSY to the caller. That will lead
>> the SCSI layer go into an ugly loop and system fail to go into hibernation.
>>
>> On the other hand, when we specially check for -ENODEV in function
>> uas_queuecommand_lck, returning DID_ERROR to SCSI layer will cause device
>> poweroff fail and system shutdown instead of entering hibernation.
>>
>> To fix this issue, let uas_submit_urbs to return original generic error
>> when submitting URB failed. At the same time, we need to translate -ENODEV
>> to DID_NOT_CONNECT for the SCSI layer.
>>
>> Suggested-by: Oliver Neukum <oneukum@suse.com>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
>> ---
>> v2->v3
>> - Modify the description of this patch.
>> - An error is returned directly when submitting URB fails.
>
> This change breaks the build, please be more careful'
>
> drivers/usb/storage/uas.c: In function ‘uas_submit_urbs’:
> drivers/usb/storage/uas.c:559:21: error: unused variable ‘urb’ [-Werror=unused-variable]
> 559 | struct urb *urb;
> | ^~~
>
I'm sorry for the carelessness. Now, I have removed this unused variable
and completed the compilation test. I'll resubmit this patch with a new version.
Thanks
weitao
prev parent reply other threads:[~2024-03-06 9:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 19:33 Weitao Wang
2024-02-29 11:52 ` Oliver Neukum
2024-03-05 13:25 ` Greg KH
2024-03-06 17:58 ` WeitaoWang-oc [this message]
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=3d5254cf-27de-b689-352b-45698e265f5e@zhaoxin.com \
--to=weitaowang-oc@zhaoxin.com \
--cc=WeitaoWang@zhaoxin.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/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
all inboxes | Powered by JetHome®