From owner-freebsd-bugs@freebsd.org Fri Jan 8 17:10:36 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B81B9A6717F for ; Fri, 8 Jan 2016 17:10:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9010F15DD for ; Fri, 8 Jan 2016 17:10:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u08HAaZ8032564 for ; Fri, 8 Jan 2016 17:10:36 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 205932] [panic] Kernel panic when copying from ext2fs partition to UFS partition Date: Fri, 08 Jan 2016 17:10:36 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 10.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: damjan.jov@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2016 17:10:36 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D205932 --- Comment #6 from Damjan Jovanovic --- (In reply to Will B from comment #5) In the "cp" tool, function copy_file() in file /usr/src/bin/cp/utils.c has 2 ways of copying a file: mmap + write, and read + write. mmap + write is used only when all of the following are true: * VM_AND_BUFFER_CACHE_SYNCHRONIZED is defined (it is, in Makefile) * It's a regular file (according to S_ISREG()) * The file's size is > 0 * The file's size is <=3D 8 MiB * Calling mmap() succeeds You say it happens on different files each time. My guess is all of the fil= es that it happens on, are regular non-empty files <=3D 8 MiB in size. There's 2 known bugs where mmap() succeeds but reading the mapped contents = can cause problems: 1. The serious bug 205938 where struct buf leaks from ext4_bmapext(), causi= ng a panic on every attempt to read even 1 byte of the mapped data. Because your trace shows the panic happens with lbn=3D0 (the very first block of the fil= e) this is probably the problem here. This bug was fixed in CURRENT yesterday, which is newer than your 10.2-RELEASE. You could try the patch from that bu= g, it does apply and work for me (for a different mmap problem) on 10.2-RELEAS= E. 2. Even with that bug fixed, sparse blocks will at best contain garbage data read from the wrong disk blocks instead of zeroes, corrupting the copied fi= le you create (maybe a panic is also possible?). This is bug 205816 which I previously mentioned. This isn't even fixed in CURRENT, but there is a patc= h on that bug you can try. (BTW you could also use ext4fuse from ports instead of the in-kernel ext2fs driver since it doesn't suffer from problem 1, but it does suffer from prob= lem 2, and I don't know/have a patch for it) With both those patches, copying files from EXT4 should be reliable and correct, but very slow in the mmap + write case (about 250 kB/second with 1= 00% CPU usage) which is unbearably slow if you have lots of files <=3D 8 MiB. I= have a 1 line patch to speed it up about 100-fold, but it only works on CURRENT - 10.2 panics with it. Will keep trying. This is the sad state of current EXT4 support outside Linux... --=20 You are receiving this mail because: You are the assignee for the bug.=