openbsd solution to mounted umass removal

Alex Dupre ale at FreeBSD.org
Mon May 12 16:32:03 UTC 2008


Andriy Gapon wrote:
> Filesystems on USB devices are automatically dismounted if the device is
> disconnected.
> 
> Does anybody have more [technical] details on this?

Modified files:
	sys/dev/usb    : umass.c
	sys/scsi       : sdvar.h sd.c
	sys/kern       : vfs_default.c vfs_subr.c

Log message:
Allow to pull out an usb stick with ffs filesystem while mounted
and a file is written onto the stick.  Without these fixes the
machine panics or hangs.
The usb fix calls the callback when the stick is pulled out to free
the associated buffers.  Otherwise we have busy buffers for ever
and the automatic unmount will panic.
The change in the scsi layer prevents passing down further dirty
buffers to usb after the stick has been deactivated.
In vfs the automatic unmount has moved from the function vgonel()
to vop_generic_revoke().  Both are called when the sd device's vnode
is removed.  In vgonel() the VXLOCK is already held which can cause
a deadlock.  So call dounmount() earlier.

--
Alex Dupre


More information about the freebsd-hackers mailing list