Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Feb 2008 00:06:57 +0100
From:      Henrik Gulbrandsen <henrik@gulbra.net>
To:        Octavian Covalschi <octavian.covalschi@gmail.com>, Torfinn Ingolfsen <torfinn.ingolfsen@broadpark.no>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: kernel panic when unmount removed usbdrive
Message-ID:  <1204240017.82302.119.camel@Particle>
In-Reply-To: <20080228170826.1fa1cadd.torfinn.ingolfsen@broadpark.no>
References:  <c0f49ea0802280727o5b27038cx426cf77ddfbfa9ec@mail.gmail.com> <20080228170826.1fa1cadd.torfinn.ingolfsen@broadpark.no>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1204240017.82302.119.camel>