From owner-freebsd-stable@FreeBSD.ORG Sat Apr 9 16:59:54 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6922716A4CE for ; Sat, 9 Apr 2005 16:59:54 +0000 (GMT) Received: from luzifer.incubus.de (incubus.de [80.237.207.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9ECD843D48 for ; Sat, 9 Apr 2005 16:59:53 +0000 (GMT) (envelope-from mkb@mkbuelow.net) Received: from drjekyll.mkbuelow.net (pD9E6964B.dip.t-dialin.net [217.230.150.75]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by luzifer.incubus.de (Postfix) with ESMTP id C37B2333F8 for ; Sat, 9 Apr 2005 18:59:51 +0200 (CEST) Received: from drjekyll.mkbuelow.net (mkb@localhost.mkbuelow.net [127.0.0.1]) by drjekyll.mkbuelow.net (8.13.3/8.13.3) with ESMTP id j39H0csE000776 for ; Sat, 9 Apr 2005 19:00:39 +0200 (CEST) (envelope-from mkb@drjekyll.mkbuelow.net) Message-Id: <200504091700.j39H0csE000776@drjekyll.mkbuelow.net> From: Matthias Buelow To: freebsd-stable@freebsd.org X-Mailer: MH-E 7.82; nmh 1.0.4; GNU Emacs 21.3.1 Date: Sat, 09 Apr 2005 19:00:38 +0200 Sender: mkb@mkbuelow.net Subject: suboptimal handling of accidentally pulled usb devices (5.4) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Apr 2005 16:59:54 -0000 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.