From nobody@FreeBSD.org Thu May 22 17:31:29 2008 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA13D1065675 for ; Thu, 22 May 2008 17:31:29 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id C417B8FC0A for ; Thu, 22 May 2008 17:31:29 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m4MHU30Q055553 for ; Thu, 22 May 2008 17:30:03 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m4MHU3TQ055552; Thu, 22 May 2008 17:30:03 GMT (envelope-from nobody) Message-Id: <200805221730.m4MHU3TQ055552@www.freebsd.org> Date: Thu, 22 May 2008 17:30:03 GMT From: Nejc Skoberne To: freebsd-gnats-submit@FreeBSD.org Subject: panic: vinvalbuf: dirty bufs X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 123908 >Category: kern >Synopsis: panic: vinvalbuf: dirty bufs >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 22 17:40:01 UTC 2008 >Closed-Date: Thu May 22 20:36:00 UTC 2008 >Last-Modified: Fri May 23 19:40:02 UTC 2008 >Originator: Nejc Skoberne >Release: RELENG_7 >Organization: >Environment: FreeBSD Kizej.domain.com 7.0-STABLE FreeBSD 7.0-STABLE #0: Wed May 21 09:56:39 CEST 2008 root@iFreeBSD.domain.local:/usr/src/sys/i386/compile/MYKERNEL i386 >Description: I was trying to make devd automount my USB stick and I stumbled upon a page fault, when I tried to also automatically unmount the usb drive. panic: vinvalbuf: dirty bufs cpuid = 1 Uptime: 5m7s Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0x0 fault code = supervisor write, page not present instruction pointer = 0x20:0xc046e8db stack pointer = 0x28:0xe79df3c0 frame pointer = 0x28:0xe79df3dc code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 1102 (ps) trap number = 12 >How-To-Repeat: Add this to /etc/devd.conf: attach 20 { device-name "umass0"; action "sleep 2; \ sh /etc/rc.d/devfs restart; \ /sbin/kldload msdosfs; \ /sbin/mount /dev/da0s1; \ /usr/local/sbin/usbsync"; }; detach 20 { device-name "umass0"; action "/sbin/umount /dev/da0s1; \ /sbin/kldunload msdosfs"; }; restart devd and then plug in the USB stick device. It is nicely mounted into /mnt. Then unplug it - it is normal that this gives an error since it tries to unmount not-any-more-existing device. If you now plug it back in, the kernel page fault happens. >Fix: >Release-Note: >Audit-Trail: State-Changed-From-To: open->closed State-Changed-By: vwe State-Changed-When: Thu May 22 20:29:59 UTC 2008 State-Changed-Why: Nejc, I'm really sorry to do what I have to do now... I really understand the situation isn't nice and you may have already wasted some hours to find a solution to your problem, but you've hit 1) a well known problem and 2) could have been able to find already _a lot_ problem reports being filed about panics caused by pulling an active device. Please do not pull a storage device while it holds active mounts. I'm pretty sure you would never pull your CPU while it's doing some calculations for you, would you? ;) Please understand while a device is holding active mounts, there are buffers allocated pointing to your device. Also there's filesystem information still in RAM which may not already have been written to the storage device. Be sure you may loose data if pulling an active device out of your system. For the next real, not already known problem, please keep in mind, we need a stack backtrace from the moment when the panic has been fired. Thank you for your understanding. http://www.freebsd.org/cgi/query-pr.cgi?pr=123908 From: =?ISO-8859-2?Q?Nejc_=A9koberne?= To: bug-followup@FreeBSD.org Cc: vwe@freebsd.org Subject: Re: kern/123908: panic: vinvalbuf: dirty bufs Date: Thu, 22 May 2008 23:43:17 +0200 Hi, I really don't want to bother and waste your time. I will just briefly express my humble opinion. To me, if kernel panics when I do something a regular user could do by accident (i.e. unplug the USB stick while still mounted), this is worth fixing. Is there really no other way for kernel to let the user know he did something stupid than panicking? I understand this should be the behaviour when unplugging some more "fixed" device like non-hotplug hard drive, RAM memory, or CPU :). But for USB sticks? Were not they created for the purpose to be easily removable and portable? I also understand that FreeBSD uses the same subsystem (if I understand correctly) for USB devices as for SCSI devices (i.e. also SCSI hard drives), that's why we see USB devices as /dev/da*. On the other hand, the panic in this case doesn't happen when the user unplugs the USB device while mounted, but when it is plugged back in after it was unplugged (while mounted). Maybe you are saying that after doing something "prohibited" like unplugging the USB stick when still mounted leaves the system (without the user being explicitly notified?) in a completely unstable and undefined state (plugging the device back is, I assume an always legal operation)? If so (since the system does not _yet_ panick when the device is unplugged), then I guess the user should be somehow notified about this condition so he can manually reboot the system and bring it back to a consistent and defined state. So what I don't know is: is this behaviour recognized as a bug at all? Or is it just normal behaviour all users should live with? Thanks for your time, Nejc From: Volker Werth To: =?ISO-8859-1?Q?Nejc_=A9koberne?= Cc: bug-followup@FreeBSD.org Subject: Re: kern/123908: panic: vinvalbuf: dirty bufs Date: Fri, 23 May 2008 21:12:41 +0200 On 05/22/08 23:43, Nejc Škoberne wrote: > Hi, > > I really don't want to bother and waste your time. I will just briefly > express my > humble opinion. To me, if kernel panics when I do something a regular > user could > do by accident (i.e. unplug the USB stick while still mounted), this is > worth fixing. > Is there really no other way for kernel to let the user know he did > something stupid > than panicking? I understand this should be the behaviour when > unplugging some more > "fixed" device like non-hotplug hard drive, RAM memory, or CPU :). But > for USB sticks? > Were not they created for the purpose to be easily removable and > portable? I also > understand that FreeBSD uses the same subsystem (if I understand > correctly) for > USB devices as for SCSI devices (i.e. also SCSI hard drives), that's why > we see USB > devices as /dev/da*. > > On the other hand, the panic in this case doesn't happen when the user > unplugs the USB > device while mounted, but when it is plugged back in after it was > unplugged (while > mounted). Maybe you are saying that after doing something "prohibited" > like unplugging > the USB stick when still mounted leaves the system (without the user > being explicitly > notified?) in a completely unstable and undefined state (plugging the > device back is, I > assume an always legal operation)? If so (since the system does not > _yet_ panick when > the device is unplugged), then I guess the user should be somehow > notified about this > condition so he can manually reboot the system and bring it back to a > consistent and > defined state. > > So what I don't know is: is this behaviour recognized as a bug at all? > Or is it just > normal behaviour all users should live with? > > Thanks for your time, > Nejc > Nejc, I thought I might have been as clear as possible in my PR closing note. The behavior you've seen (a kernel panic while a device with active mounts is being removed from the system) is a bug - this is not questionable. The reason for closing your PR is really simple (and I already told you about that): The problem is well known, which means, it's been reported many, many times. As we (the bugbusting team) need to keep the house clean (which is by itself a hard job), we can not accept and we do not want to have 20 open PRs, or how often an issue ever caused a panic on an user machine, for the real same issue. If you find a problem, first please check Jeremy's "commonly reported issues" page at: http://wiki.freebsd.org/JeremyChadwick/Commonly_reported_issues Note to Jeremy (do you read?): Your wiki page is not linked on the main wiki page. Can you please put a link under the bugbusting section? You'll find your issue also listed on that commonly reported issues page. If an issue you're experiencing is not listed there, please check our GNATS database (try it with different search parameters to make sure, it's not already reported). If an issue already has been reported and you think you can contribute valuable information for the bugbusting team to analyze or the maintainers to fix an issue, please file a followup to an already filed PR. Often it might help to ask on a mailing list first and have a discussion about an issue before filing a PR which might not get attention for some time and die old later. Sorry to have you confused so much, but please understand we're currently facing 5300 open problem tickets and we can not deal with duplicates. Thank you for your understanding! Volker >Unformatted: