Re: kernel panic when unmount removed usbdrive

2008-03-01 Thread Torfinn Ingolfsen
On Fri, 29 Feb 2008 00:06:57 +0100
Henrik Gulbrandsen <[EMAIL PROTECTED]> wrote:

> 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" :-)

My use of the phrase "very hard" here didn't reflect only on the
technical issues of the problem, but all the issues:
1. there are a limited (very limited?) number of developers with enough
insight to even try to fix this prtoblem
2. the problem has been around for so long that any "new" or "fresh"
developers will also hear that this problem is hard to fix, and thus
probably avoid it
3. seasoned FreeBSD users and developers know how to workaround; and
thus the problem remains "out of sight"
4. the few people who could fix this problem doesn't have enough free
time to meet and discuss how to best solve it

It is very good that you have done something with the problem in spite
of all this. Keep up the good work!

> 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.

I agree - you get the life you accept.
In my case, FreeBSD is just a very small part of my life (hey - it's
just an operating system for computers, and life is so much more than
computers to me), which means that the time I am willing to spend on
problems in FreeBSD has to be weighed against other activites.

That said - FreeBSD _is_ my favorite operating system.
-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: kernel panic when unmount removed usbdrive

2008-03-01 Thread Torfinn Ingolfsen
On Thu, 28 Feb 2008 11:02:03 -0600
Octavian Covalschi <[EMAIL PROTECTED]> wrote:

> no, i don't think it is easy, if it was i think it already been fixed

I did not imply that you were in the group "most people". :)

> it is not a hobby to remove storage before unmounting it, it's just
> happened, i even did not think it could
> bring kernel panic.
> in this case is a usbdrive.. but what happens if i have a usb hdd
> drive? it will be the same? having a laptop and a portable
> hdd may bring in situation that i just remove it form usb...

Yes, it will be the same. anay removable media (at least the ones that
end up being mounted) will behave this way, AFAIK. I'm sure someone
will correct me if I'm wrong.

> actually as far i know usb is intented to have hotswap devices.
> anyway, i'm just a user, and hearing and advice: "don't do that" it
> is VERY unprofessional

I agree.
However, this is the status quo right now, and has been for at least 4
years. There is no orher workaround - we (FreeBSD users) will have to
live with this until developers who can fix this can free up enough
time to do so. Note: am not blaming any developers for the sad state
we're in - after all, this is a volunteer project.

> i can understand that it can be difficult, i'm a programmer too, but
> anyway just to sat don';t do that is not at least nice :)
> >
> > If you can't learn to live with this workaround, please do not use
> > removable mass storage devices with FreeBSD.
> >
> 
> don't be so mean :)

No mean-nesss was intended, just trying to tell you in very clear terms
what the state of this problem is.
Yes, it is harsh, but we will have to live with it for now.
-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: kernel panic when unmount removed usbdrive

2008-02-28 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]>
Henrik Gulbrandsen <[EMAIL PROTECTED]> writes:
: 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...

Henrik,

I've not forgotten your patches, but I haven't had the time to
integrate them into the system.  I hope to have them ready by 8.0, and
if I'm lucky, in time to MFC for 7.1.  Many of them are MFCable,
although some of the underlying issues they expose can only be fixed
properly in head since they may require ABI changes.  The changes
should really be done at the fs level, since the current patches will
leak resources and potentially have other bad effects.

I'd also like to have something between full sync and async when
mounting removable file systems.  You want synchronous metadata, but
async data blocks for performance often times.  I'm still exploring
what this means...

Finally, I'd like to thank you again publicly for taking the time and
initiative to see through the difficulties of this problem and to
persist in presenting your solution to the developers.  It made me
lose my fear of the buffer cache code, which ultimately will be a good
thing.

Warner
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: kernel panic when unmount removed usbdrive

2008-02-28 Thread Henrik Gulbrandsen
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


___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: kernel panic when unmount removed usbdrive

2008-02-28 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]>
Torfinn Ingolfsen <[EMAIL PROTECTED]> writes:
: > anybody knows any work-around ?
: 
: Yes - the work around is this: don't do that!
: Do _not_ remove any mass storage device before unmounting it.

run current and you have better results.

The problem is that error propagation inside of the buffer cache code
and file system code doesn't handle ENXIO very well.  It takes time to
work through it.

One could, in theory, use QEMU to make it easier to test.  Alas, I've
not had time to work through the setup.

Warner


___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: kernel panic when unmount removed usbdrive

2008-02-28 Thread Torfinn Ingolfsen
On Thu, 28 Feb 2008 09:27:51 -0600
Octavian Covalschi <[EMAIL PROTECTED]> wrote:

> hi, i've got 2 kernel panics.. when tried to unmount already removed
> an usbdrive
> actually i have reported this  problem, but  after some google  found
> that this is not new :(
> 
> this problem is known at least for 1 year.. this is bad.

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.

> anybody knows any work-around ?

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.

HTH
-- 
Regards,
Torfinn Ingolfsen

___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"