Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Apr 2005 19:00:38 +0200
From:      Matthias Buelow <mkb@incubus.de>
To:        freebsd-stable@freebsd.org
Subject:   suboptimal handling of accidentally pulled usb devices (5.4)
Message-ID:  <200504091700.j39H0csE000776@drjekyll.mkbuelow.net>

next in thread | raw e-mail | index | archive | help
Hi folks,

every so often, I forget to unmount my ipod (usb2) before pulling it
from my PC.  While this and the mess that ensues is clearly a user
error, it would be nice if this exceptional situation would get handled
a bit more gracefully by the OS.  What happens now is that I cannot use
the device anymore ("Resource unavailable") until I reboot.  Trying to
unmount the still mounted filesystem (no matter if the device is plugged
back in or not) simply gives:

Apr  9 18:43:44 drjekyll kernel: fsync: giving up on dirty: 0xc305ca50: tag msdo
sfs, type VREG, usecount 1, writecount 0, refcount 1, flags (VV_OBJBUF), lock ty
pe msdosfs: EXCL (count 1) by thread 0xc2d3ce10 (pid 3332)
Apr  9 18:43:44 drjekyll kernel: startcluster 7400, dircluster 38092, diroffset 
320, on dev (4, 30)

I see two problems here:

1) If the OS notices that the (removable) device has disappeared, can't
   it just throw away the remaining buffers?  I guess trying to write
   the remaining buffers if the device is reinserted is a no-option,
   since the state of the intermittently removed device is unknown.  But
   clearly, just insisting on keeping the buffers without any chance of
   ever writing them back is not correct behaviour (and I guess will
   cause problems at shutdown, haven't checked that now).

2) Umount -f completely froze the machine and I had to powercycle.  This
   probably should be fixed.

This is on 5.4-PRERELEASE/i386, using ehci for the usb2 device.
More info available on request.

mkb.



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