From owner-freebsd-stable@FreeBSD.ORG Sun Feb 17 06:19:06 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E5CD16A418 for ; Sun, 17 Feb 2008 06:19:06 +0000 (UTC) (envelope-from jdc@parodius.com) Received: from mx01.sc1.parodius.com (mx01.sc1.parodius.com [72.20.106.3]) by mx1.freebsd.org (Postfix) with ESMTP id 08BB413C45D for ; Sun, 17 Feb 2008 06:19:05 +0000 (UTC) (envelope-from jdc@parodius.com) Received: by mx01.sc1.parodius.com (Postfix, from userid 1000) id DDFC11CC033; Sat, 16 Feb 2008 22:19:05 -0800 (PST) Date: Sat, 16 Feb 2008 22:19:05 -0800 From: Jeremy Chadwick To: "Carlos A. M. dos Santos" Message-ID: <20080217061905.GA35005@eos.sc1.parodius.com> References: <20080216210736.GA17517@eos.sc1.parodius.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-stable@freebsd.org Subject: Re: ATA -- erratic behaviour when removing disk X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2008 06:19:06 -0000 On Sat, Feb 16, 2008 at 09:08:38PM -0200, Carlos A. M. dos Santos wrote: > On Feb 16, 2008 7:07 PM, Jeremy Chadwick wrote: > > Is anyone aware of the situation where FreeBSD behaves erratically when > > a disk is physically removed without "atacontrol detach ataX" being run > > prior to removal (at least on RELENG_7)? > > Yes, I have seen this since 4.5, IIRC. Wonderful. > > Also FWIW: I also tested all this for comparison on Ubuntu Linux earlier > > this morning. I was able to yank the disk in the middle of an I/O > > operation, resulting in an immediate I/O error from dd. I took no > > precautions prior to yanking the disk. Upon reinsertion, the system > > found the disk and I could continue I/O operations on it as if it had > > never been removed. Only reason I'm pointing this out is that it > > confirms the issue isn't hardware or with vendor implementation, but > > rather specific to the OS. > > Congratulations to the Linux folks. Or not, since this looks like a > very risky behavior. Who warrants you that the *same* disk was plugged > back? Blindly continuing to write could easily corrupt the contents of > the second drive. I'm not sure I understand. There were no filesystems on the drive, and nothing mounted prior to removal: just like what I did with FreeBSD. The procedure: * Boot Ubuntu CD, get a shell * dd if=/dev/sdb of=/dev/null bs=8k * In the middle of I/O, yank the disk * dd exits with "I/O error" * System continued to be responsive; no ATA subsystem oddities * Reinserted disk; kernel saw the disk without any issue * dd if=/dev/sdb of=/dev/null bs=8k * I/O still operating as before; no system "oddities" If you'd like, I can try inserting a completely different disk (both in size and vendor), but I really don't think anything odd will happen. If there were filesystems mounted or other whatnots, yes, I could see how there might be concern. I can try that as well if you're interested. I am a bit curious to see what Linux does if I pull a disk that has mounted filesystems which are being accessed at the time. This test was done solely to see how FreeBSD behaved when a disk was removed. The fact that the entire ATA channel goes into some bizarre non-recoverable state when a disk is removed without detaching first warrants the need for investigation, especially if this behaviour has existed since the mid-4.x days. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |