On 27.8.2019 19.35, Theodore Y. Ts'o wrote:
On Tue, Aug 27, 2019 at 08:00:14AM +0200, Harald Dunkel wrote:
FYI: "fsck -y" on an external USB drive (USB-C, ext4) gave
me a ton of messages

:
[  191.261939] xhci_hcd 0000:05:00.0: WARN Wrong bounce buffer write length: 
1024 != 0
[  191.263743] xhci_hcd 0000:05:00.0: WARN Wrong bounce buffer write length: 
1024 != 0
[  191.263788] xhci_hcd 0000:05:00.0: WARN Wrong bounce buffer write length: 
1024 != 0
[  191.263840] xhci_hcd 0000:05:00.0: WARN Wrong bounce buffer write length: 
1024 != 0
[  191.266857] xhci_hcd 0000:05:00.0: WARN Wrong bounce buffer write length: 
1024 != 0
:

Related to 597c56e372dab2c7f79b8d700aad3a5deebf9d1b, AFAICT.

Kernel is 4.19.67-1 (Debian proposed-updates).

+mathias.ny...@intel.com, linux-usb@vger.kernel.org
linux-ext4 to BCC

That's a USB XHCI issue, not an ext4 issue.  I'm handing this to the
XHCI maintainer and the Linux USB mailing list.


The warning message is incorrect, data should be fine.

Looks like this length check code was copied from the read side to the write 
side,
but some details were not updated.

Below code should fix it:

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3202,10 +3202,10 @@ static int xhci_align_td(struct xhci_hcd *xhci, struct 
urb *urb, u32 enqd_len,
        if (usb_urb_dir_out(urb)) {
                len = sg_pcopy_to_buffer(urb->sg, urb->num_sgs,
                                   seg->bounce_buf, new_buff_len, enqd_len);
-               if (len != seg->bounce_len)
+               if (len != new_buff_len)
                        xhci_warn(xhci,
                                "WARN Wrong bounce buffer write length: %zu != 
%d\n",
-                               len, seg->bounce_len);
+                               len, new_buff_len);
                seg->bounce_dma = dma_map_single(dev, seg->bounce_buf,
                                                 max_pkt, DMA_TO_DEVICE);
        } else {

I'll submit a proper patch

-Mathias

Reply via email to