# Umount ejected USB Flash drive (kernel panic)



## soko1 (Nov 18, 2008)

See: http://lists.freebsd.org/pipermail/freebsd-bugs/2007-January/021991.html

In the 8-CURRENT using the new code driver usb (where this problem does not exist), but as to overcome the problem in the 7.X-STABLE?


----------



## soko1 (Nov 18, 2008)

Plans have new drivers usb port for FreeBSD 7?


----------



## bsddaemon (Nov 18, 2008)

IIRC, this defect has been existing for years. But I heard there is a new USB stack in the latest snapshot?

This reminds me of my server uptime record. I was plugging the USB DVD burner, then unplugged when it finished burning, but forgot to run *umount* command, then the entire system was frozen. Had no choice but hard reset. God damn, really take time to reach 4 month uptime


----------



## soko1 (Nov 18, 2008)

Some way must be, I think so. But what?


----------



## soko1 (Nov 18, 2008)

Earlier this helped patch. But now (FreeBSD 7) it does not work = (

% cat /truebsd/diffs/usr/src/sys/geom/geom_vfs.c.diff

```
--- geom_vfs.c.orig     2007-12-29 11:48:20.000000000 +0000
+++ geom_vfs.c  2007-12-29 11:48:39.000000000 +0000
@@ -71,16 +71,9 @@
        struct buf *bp;
        int vfslocked;

-       if (bip->bio_error) {
-               printf("g_vfs_done():");
-               g_print_bio(bip);
-               printf("error = %d\n", bip->bio_error);
-       }
        bp = bip->bio_caller2;
        bp->b_error = bip->bio_error;
        bp->b_ioflags = bip->bio_flags;
-       if (bip->bio_error)
-               bp->b_ioflags |= BIO_ERROR;
        bp->b_resid = bp->b_bcount - bip->bio_completed;
        g_destroy_bio(bip);
        vfslocked = VFS_LOCK_GIANT(((struct mount *)NULL));
```


----------



## danger@ (Nov 18, 2008)

Unfortunately as far as I know, this will not hit any of the 7.x releases. It probably won't even be enabled by default in 8.x.


----------



## danger@ (Nov 18, 2008)

btw http://www.freebsdfoundation.org/project announcements.shtml


----------



## brucec@ (Nov 19, 2008)

danger@ said:
			
		

> btw http://www.freebsdfoundation.org/project announcements.shtml



There seem to be several problems, and while one or two have been fixed recently, there are still others lurking to bring the system down.  One fix was made earlier this year, and with the new USB stack (aka 'usb2') another class of problems should be fixed.  However I think there are still issues in the buffer cache or cam layers - hopefully they'll be fixed early next year.


----------



## trasz@ (Dec 12, 2008)

You can track progress of that project here:

http://perforce.freebsd.org/changeList.cgi?FSPC=//depot/user/trasz/dont_panic/...


----------



## trasz@ (Feb 3, 2009)

Just FYI - I plan to commit remaining patches into CURRENT today or tomorrow.  After that, the panics should be gone, at least with msdosfs and ufs filesystems, _without softupdates enabled_.


----------



## trasz@ (Feb 25, 2009)

Things has been committed to CURRENT, expect MFC soon.


----------



## Djn (Feb 25, 2009)

Ooh, excellent.


----------



## bsdzilla (Mar 23, 2009)

trasz@ said:
			
		

> Things has been committed to CURRENT, expect MFC soon.



Any news on the MFC?


----------



## trasz@ (Mar 23, 2009)

Changes were MFCd already.  Things should work; if you're still seeing panics, please send details (most important part is a backtrace and a description of how to provoke the panic) to trasz@FreeBSD.org.  I'd like to fix any problems - if there are any - before 7.2.

Note that I'll be afk until friday.


----------

