LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tao Wang <wat@codeaurora.org>
To: quic_wat@quicinc.com, linyyuan@qti.qualcomm.com,
hongwus@qti.qualcomm.com, zhijunw@qti.qualcomm.com,
wat@codeaurora.org
Cc: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org (open list:USB XHCI DRIVER),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] usb: xhci-ring: USB SSD may fail to unmount if disconnect during data transferring.
Date: Thu, 12 Aug 2021 20:02:07 +0800 [thread overview]
Message-ID: <1628769727-45046-1-git-send-email-wat@codeaurora.org> (raw)
From: Tao Wang <quic_wat@quicinc.com>
it stuck in usb_kill_urb() due to urb use_count will not become zero,
this means urb giveback is not happen.
in xhci_handle_cmd_set_deq() will giveback urb if td's cancel_status
equal to TD_CLEARING_CACHE,
but in xhci_invalidate_cancelled_tds(), only last canceled td's
cancel_status change to TD_CLEARING_CACHE,
thus giveback only happen to last urb.
this change set all cancelled_td's cancel_status to TD_CLEARING_CACHE
rather than the last one, so all urb can giveback.
Signed-off-by: Tao Wang <quic_wat@quicinc.com>
---
drivers/usb/host/xhci-ring.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 8fea44b..c7dd7c0 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -960,19 +960,19 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep)
td_to_noop(xhci, ring, td, false);
td->cancel_status = TD_CLEARED;
}
- }
- if (cached_td) {
- cached_td->cancel_status = TD_CLEARING_CACHE;
-
- err = xhci_move_dequeue_past_td(xhci, slot_id, ep->ep_index,
- cached_td->urb->stream_id,
- cached_td);
- /* Failed to move past cached td, try just setting it noop */
- if (err) {
- td_to_noop(xhci, ring, cached_td, false);
- cached_td->cancel_status = TD_CLEARED;
+ if (cached_td) {
+ cached_td->cancel_status = TD_CLEARING_CACHE;
+
+ err = xhci_move_dequeue_past_td(xhci, slot_id, ep->ep_index,
+ cached_td->urb->stream_id,
+ cached_td);
+ /* Failed to move past cached td, try just setting it noop */
+ if (err) {
+ td_to_noop(xhci, ring, cached_td, false);
+ cached_td->cancel_status = TD_CLEARED;
+ }
+ cached_td = NULL;
}
- cached_td = NULL;
}
return 0;
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next reply other threads:[~2021-08-12 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 12:02 Tao Wang [this message]
2021-08-13 1:44 ` wat
2021-08-13 2:03 ` wat
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=1628769727-45046-1-git-send-email-wat@codeaurora.org \
--to=wat@codeaurora.org \
--cc=gregkh@linuxfoundation.org \
--cc=hongwus@qti.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linyyuan@qti.qualcomm.com \
--cc=mathias.nyman@intel.com \
--cc=quic_wat@quicinc.com \
--cc=zhijunw@qti.qualcomm.com \
--subject='Re: [PATCH] usb: xhci-ring: USB SSD may fail to unmount if disconnect during data transferring.' \
/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
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).