[Bug 208365] [umass] Cannot fsck 3TB USB disk

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Mar 29 11:30:36 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208365

--- Comment #10 from Hans Petter Selasky <hselasky at FreeBSD.org> ---
I'm able to reproduce the problem using the following kernel patch and
test-program on the latest and greatest 11-current:

diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c
index c96b26d..a4c0af7 100644
--- a/sys/x86/x86/busdma_machdep.c
+++ b/sys/x86/x86/busdma_machdep.c
@@ -97,6 +97,13 @@ bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t
paddr)
 {
        int retval;

+       if (tc->flags & BUS_DMA_KEEP_PG_OFFSET) {
+               if ((paddr % 3) == 0) {
+                       printf("F");
+                       return (1);
+               }
+       }
+
        retval = 0;
        do {
                if (((paddr > tc->lowaddr && paddr <= tc->highaddr) ||

cat << EOF > test.c
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>

int main()
{
        int fd = open("/dev/da0", O_RDONLY);
        char buffer[65536];
        int y;

        if (fd < 0)
                return (0);

        y = 65536;
        while (1) {
                (void) malloc(512);
                if (lseek(fd, 0, 0) < 0)
                        printf("ERROR seek\n");
                if (read(fd, buffer, y) != y)
                        printf("ERROR read\n");
        }
        close(fd);

        return (0);
}
EOF


Memory stick is connected through USB 3.0 port XHCI.

It appears that when bounce pages are mixed with non-bounce pages the problem
happens.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-amd64 mailing list