From owner-freebsd-usb@FreeBSD.ORG Thu Feb 28 23:07:31 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3A5F1065674 for ; Thu, 28 Feb 2008 23:07:31 +0000 (UTC) (envelope-from henrik@gulbra.net) Received: from av8-1-sn3.vrr.skanova.net (av8-1-sn3.vrr.skanova.net [81.228.9.183]) by mx1.freebsd.org (Postfix) with ESMTP id 54BFD8FC20 for ; Thu, 28 Feb 2008 23:07:31 +0000 (UTC) (envelope-from henrik@gulbra.net) Received: by av8-1-sn3.vrr.skanova.net (Postfix, from userid 502) id 8DCA938C07; Fri, 29 Feb 2008 00:07:29 +0100 (CET) Received: from smtp3-1-sn3.vrr.skanova.net (smtp3-1-sn3.vrr.skanova.net [81.228.9.101]) by av8-1-sn3.vrr.skanova.net (Postfix) with ESMTP id 33F1438BC4; Fri, 29 Feb 2008 00:07:29 +0100 (CET) Received: from [192.168.0.2] (81-235-156-87-no29.tbcn.telia.com [81.235.156.87]) by smtp3-1-sn3.vrr.skanova.net (Postfix) with ESMTP id C32B537E47; Fri, 29 Feb 2008 00:07:28 +0100 (CET) From: Henrik Gulbrandsen To: Octavian Covalschi , Torfinn Ingolfsen In-Reply-To: <20080228170826.1fa1cadd.torfinn.ingolfsen@broadpark.no> References: <20080228170826.1fa1cadd.torfinn.ingolfsen@broadpark.no> Content-Type: text/plain Date: Fri, 29 Feb 2008 00:06:57 +0100 Message-Id: <1204240017.82302.119.camel@Particle> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org Subject: Re: kernel panic when unmount removed usbdrive X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2008 23:07:31 -0000 I think I've already made my point regarding this bug, but since I stay on this mailing list primarily to see the fix through to completion, it would be silly not to comment when everyone else seems to do that :-) On Thu, 2008-02-28 at 09:27 -0600, Octavian Covalschi wrote: > this problem is known at least for 1 year.. this is bad. The problem was known over five years ago (usb/46176). I offered a first working patch set for private review in September 2004, but never took the time to follow up. With hindsight, that was a mistake. You see, the thing is that the panic-at-usb-drive-removal bug has been with us for so long that most long-term FreeBSD users have gotten used to it. They know that the drive must be unmounted before the USB stick can be pulled out, and they have probably forgotten the horror experienced when they first made the pull-out-first mistake themselves. That is why you get advice like "don't do that", although a bug fix is a very reasonable request. > anybody knows any work-around ? Right now, your best bet is to take Warner's advice and try 8.0-CURRENT, since none of the known patches have been merged to the 7.0 track yet. However, I honestly don't know how he can get anything stable without the final scsi_da.c patch, since I had something like 100% reproducible crashes when I updated my system from late 7.0 to early 8.0. You might want to apply patches from http://www.gulbra.net/freebsd-usb/ yourself, but keep in mind that CURRENT is a moving target, so I can't guarantee that the patches are still working perfectly. Also, please remember to use -o sync when mounting the drive. The other case is less tested... > thank u in advance You're welcome! And if you're uncomfortable with applying weird patches and recompiling bleeding-edge kernels, please don't give up hope! It's hopefully just a matter of months before we have an acceptable solution in one of the official releases. On Thu, 2008-02-28 at 17:08 +0100, Torfinn Ingolfsen wrote: > This problem has been known for a lot longer time. > However, "most people" only complain about it - and they also think it > is easy to fix this problem. > > Well, it is not easy - in fact it is very hard to fix this problem. For > data on this, please search the mailing list archives of FreeBSD. You know, the good thing about thinking something is easy is that you get the nerve to actually start working on the problem. I agree that it is not a trivial fix. I pride myself on being able to fix almost any bug within a day. At least, that's what it says on my business cards, but in this case there were several underlying issues, so say one week of deep analysis and patching to reach the state where I couldn't reproduce any version of the problem. I'd call that "hard", not "very hard" :-) > Yes - the work around is this: don't do that! > Do _not_ remove any mass storage device before unmounting it. > > If you can't learn to live with this workaround, please do not use > removable mass storage devices with FreeBSD. There is a piece of potential wisdom that I've been toying with lately: You get the life you accept. Read that again and give it some thought! What you accept. Not the life you want, not even the life you deserve, but the life you accept, because that is where you will stop striving for something even better. In this case, I have no doubt that the very moment we decide that it is truly unacceptable for a FreeBSD kernel to panic in a common scenario like this, that is when we will start to see some really quick progress in this area. /Henrik