From owner-freebsd-current@FreeBSD.ORG Mon Mar 28 14:38:46 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D28DC16A4CE for ; Mon, 28 Mar 2005 14:38:46 +0000 (GMT) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 30D1743D39 for ; Mon, 28 Mar 2005 14:38:46 +0000 (GMT) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [10.1.1.7]) (authenticated bits=0)j2SEcesf096936 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Mon, 28 Mar 2005 16:38:42 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [IPv6:3ffe:400:8d0:301::12]) by cicely5.cicely.de (8.12.10/8.12.10) with ESMTP id j2SEc3VK088112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Mar 2005 16:38:04 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.11/8.12.11) with ESMTP id j2SEc3DU027767; Mon, 28 Mar 2005 16:38:03 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.11/8.12.11/Submit) id j2SEc2Mb027766; Mon, 28 Mar 2005 16:38:02 +0200 (CEST) (envelope-from ticso) Date: Mon, 28 Mar 2005 16:38:02 +0200 From: Bernd Walter To: Poul-Henning Kamp Message-ID: <20050328143801.GH14532@cicely12.cicely.de> References: <20050328134856.GF14532@cicely12.cicely.de> <32733.1112019870@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32733.1112019870@critter.freebsd.dk> X-Operating-System: FreeBSD cicely12.cicely.de 5.2-CURRENT alpha User-Agent: Mutt/1.5.6i X-Spam-Status: No, hits=-4.9 required=3.0 tests=BAYES_00 autolearn=no version=2.64 X-Spam-Report: * -4.9 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on cicely12.cicely.de cc: "current@freebsd.org" cc: vova@fbsd.ru cc: "Matthew N. Dodd" cc: freebsd-mobile@freebsd.org cc: Julian Elischer cc: ticso@cicely.de Subject: Re: Reattach/redetect allways connected umass device - is it possible ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: ticso@cicely.de List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Mar 2005 14:38:46 -0000 On Mon, Mar 28, 2005 at 04:24:30PM +0200, Poul-Henning Kamp wrote: > In message <20050328134856.GF14532@cicely12.cicely.de>, Bernd Walter writes: > > >> Driver support for this is not really meaterialized and therefore > >> the model now is that when the media is ejected the geom device > >> is removed and a new one created right away, even if a new media > >> is not inserted right away. > > > >Do you get eject notifications from any device type? > > Right now I belive floppy disks DTRT. Interesting. > >One of my problems is that it is possible with SCSI MO drives to > >eject the media, reinsert a new one and errously continue to work > >with the old GEOM layout. > >I already trashed the data on one media by forgetting to trigger > >a reprobe - since then I use a mount script. > > Well, I have no idea how to pull the information out of the CAM/SCSI > code, but I'm sure there is _some_ way it can be done. There is the test unit ready command. Either it returns OK, or you may get usefull sense data. Here is an example: No media in the drive: [60]cicely13# camcontrol tur -n da -u 0 -v Unit is not ready (pass0:ahc0:0:1:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 (pass0:ahc0:0:1:0): CAM Status: SCSI Status Error (pass0:ahc0:0:1:0): SCSI Status: Check Condition (pass0:ahc0:0:1:0): NOT READY asc:3a,0 (pass0:ahc0:0:1:0): Medium not present Exit 1 Media just inserted and give the drive some time to spin up: [61]cicely13# camcontrol tur -n da -u 0 -v Unit is not ready (pass0:ahc0:0:1:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 (pass0:ahc0:0:1:0): CAM Status: SCSI Status Error (pass0:ahc0:0:1:0): SCSI Status: Check Condition (pass0:ahc0:0:1:0): UNIT ATTENTION asc:28,0 (pass0:ahc0:0:1:0): Not ready to ready change, medium may have changed Exit 1 Just retry TUR command: [62]cicely13# camcontrol tur -n da -u 0 -v Unit is ready Media ejected: [63]cicely13# camcontrol tur -n da -u 0 -v Unit is not ready (pass0:ahc0:0:1:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 (pass0:ahc0:0:1:0): CAM Status: SCSI Status Error (pass0:ahc0:0:1:0): SCSI Status: Check Condition (pass0:ahc0:0:1:0): NOT READY asc:3a,0 (pass0:ahc0:0:1:0): Medium not present Exit 1 Media reinserted without waiting the drive to spin up: [64]cicely13# camcontrol tur -n da -u 0 -v Unit is not ready (pass0:ahc0:0:1:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 (pass0:ahc0:0:1:0): CAM Status: SCSI Status Error (pass0:ahc0:0:1:0): SCSI Status: Check Condition (pass0:ahc0:0:1:0): NOT READY asc:98,0 (pass0:ahc0:0:1:0): Vendor Specific ASC Exit 1 After the drive spun up: [65]cicely13# camcontrol tur -n da -u 0 -v Unit is not ready (pass0:ahc0:0:1:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 (pass0:ahc0:0:1:0): CAM Status: SCSI Status Error (pass0:ahc0:0:1:0): SCSI Status: Check Condition (pass0:ahc0:0:1:0): UNIT ATTENTION asc:28,0 (pass0:ahc0:0:1:0): Not ready to ready change, medium may have changed Exit 1 Retry TUR: [66]cicely13# camcontrol tur -n da -u 0 -v Unit is ready -- B.Walter BWCT http://www.bwct.de bernd@bwct.de info@bwct.de