From owner-freebsd-hackers@FreeBSD.ORG Thu May 7 09:48:49 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF568114 for ; Thu, 7 May 2015 09:48:49 +0000 (UTC) Received: from mx0.gid.co.uk (mx0.gid.co.uk [194.32.164.250]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C70F18FE for ; Thu, 7 May 2015 09:48:48 +0000 (UTC) Received: from [194.32.164.24] (80-46-130-69.static.dsl.as9105.com [80.46.130.69]) by mx0.gid.co.uk (8.14.2/8.14.2) with ESMTP id t479iLJ9094224; Thu, 7 May 2015 10:44:21 +0100 (BST) (envelope-from rb@gid.co.uk) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: What's required to make removal of a mounted USB stick safe? From: Bob Bishop In-Reply-To: <201505062159.t46Lx0iZ028607@fire.js.berklix.net> Date: Thu, 7 May 2015 10:44:15 +0100 Cc: NGie Cooper , "freebsd-hackers@freebsd.org" , Ryan Stone Content-Transfer-Encoding: quoted-printable Message-Id: <1231C6A0-BFCB-4384-ADF4-FAB7739DF91D@gid.co.uk> References: <201505062159.t46Lx0iZ028607@fire.js.berklix.net> To: "Julian H. Stacey" X-Mailer: Apple Mail (2.2098) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 May 2015 09:48:49 -0000 > On 6 May 2015, at 22:59, Julian H. Stacey wrote: >=20 > Hi, Reference: >> From: NGie Cooper >> Date: Wed, 6 May 2015 14:28:12 -0700 >=20 > NGie Cooper wrote: >> On Wed, May 6, 2015 at 1:49 PM, Ryan Stone wrote: >>> Currently FreeBSD stands a fair chance at panicking if a mounted USB = drive >>> is removed while I/O is in flight. Does anybody know what work is = involved >>> to have the kernel safely recover from this case? Losing data from = the >>> drive is expected of course but there's no reason that the entire = kernel >>> has to crash. >>>=20 >>> A co-worker has been looking at this but I don't feel that we = understand >>> the problem well enough to produce a real fix. All that we've been = doing >>> so far is papering over the explicit panics without having a full >>> understanding of what we're doing. >>=20 >> What version are you working on and how is the USB stick mounted (/, = /mnt, etc)? >=20 > Not a new problem, it' been so over 30 years with Unix.=20 > Remove media without umount & game over. =20 > Some Solutions: > - Deep kernel work (dont hold your breath, see 30 above, & don't look = at me :-) > - Cobble up some C to run from user space, not as root, > so that your UFS is not mounted, but accessed by user level > programs (much like mwrite & mread for accessing DOS media of old) > - man 8 amd : set a short timeout to auto unmount, > it wont total solve your problem, but should lessen the frequency of = panics. > - Mount the USB media on a spare laptop running as an NFS+ AMD server, > then access the FS via NFS from your real client big PC. When > you pull the stick by accident forgetting its mounted, just the > laptop crashes afte a bit, the AMD access on the other PC just > hangs but doesnt crash. > - Encourage A SOC (google summer of code) student to look at it, > probably wont come to a solution though, see 30 above. > - Toss money at the problem :-) If your company can afford some cash, = either: > - help fund FreeBSD Foundation & ask them to solve it,=20 > - Or pay some consultant somewhere to look at it, Here's a globaly > geographicaly indexed list http://berklix.com/consultants/ > maybe there's one near your company ? Hack up gnop(8) to report success upstream for every operation = regardless. (Maybe -r 0 -w 0 will do that already but I=E2=80=99d be surprised.) > Cheers, > Julian > -- > Julian Stacey, BSD Linux Unix C Sys Eng Consultant Munich = http://berklix.com > Indent previous with "> ". Reply Below as a play script. > Send plain text, Not quoted-printable, HTML, or base64. > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to = "freebsd-hackers-unsubscribe@freebsd.org" >=20 -- Bob Bishop rb@gid.co.uk