From owner-freebsd-fs@FreeBSD.ORG Mon Mar 28 14:48:13 2011 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1985106567A for ; Mon, 28 Mar 2011 14:48:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 5538A8FC1E for ; Mon, 28 Mar 2011 14:48:12 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p2SElwd4031983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 29 Mar 2011 01:48:00 +1100 Date: Tue, 29 Mar 2011 01:47:58 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kostik Belousov In-Reply-To: <20110326135211.GB78089@deviant.kiev.zoral.com.ua> Message-ID: <20110329012951.N779@besplex.bde.org> References: <20110326003818.GT78089@deviant.kiev.zoral.com.ua> <20110327000956.U1316@besplex.bde.org> <20110326135211.GB78089@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-fs@FreeBSD.org Subject: Re: tying down adaX to physical interfaces X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2011 14:48:13 -0000 On Sat, 26 Mar 2011, Kostik Belousov wrote: > On Sun, Mar 27, 2011 at 12:24:03AM +1100, Bruce Evans wrote: >> To hijack this thread a little, I'll ask how people handle removable media >> changing the addresses of non-removable media. I use the following to >> prevent USB drives stealing da0 from my 1 real SCSI disk on 1 machine: >> >> hint.scbus.0.at="sym0" >> hint.da.0.at="scbus0" >> >> This works OK and is easy to manage with only 1 SCSI disk. But 1 of my >> USB drives also steals cd0 from a not-so-real ATAPI drive under atapicam, >> depending on whether the USB drive is present at boot time: >> >> USB drive not present at boot time: >> ad* (no SCSI disks on this machine) >> cd0 = acd0 (but no further ATAPI drives on this machine) >> insert USB drive: >> da1 (da0 was reserved by above) >> cd1 (phantom ATAPI drive on the USB drive. Accessing this hangs >> parts of the ata system but it doesn't get used since various >> places only point cd0) >> >> USB drive present at boot time: >> ad* >> da1 on USB >> cd0 phantom on USB >> cd1 = acd[0 or 1] (normal cd0). Accessing cd0 now hangs parts of the >> ata system and this happens too easily since various places point >> to cd0. >> >> How do people defend agains random USB drives present or not at boot time? > > Wouldn't it be cd0 on scbusX on ahciY, and cd1 on scbusZ on umass-simT ? > I believe similar hints would wire the cd0/cd1 in your case. That works of course. I was hoping for something more automatic and general. Maybe reserve lots of bus numbers for fixed devices. What seems to happen is that buses are allocated sequentially in probe order, and at least in my configuration, USB drives are probed before atapi drives, so the removable drives always renumber the fixed drives. However, the order of the probe messages is the opposite -- atapi drives before USB drives (with higher unit numbers for atapi drives!). E.g., acd0, cd1 (same physical drive as acd0), cd0 (USB drive). This is with an older kernel and usb. Bruce