From owner-freebsd-scsi Fri Nov 22 10:28:50 2002 Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B25FB37B401 for ; Fri, 22 Nov 2002 10:28:49 -0800 (PST) Received: from comp.chem.msu.su (comp-ext.chem.msu.su [158.250.32.157]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4F3443E6E for ; Fri, 22 Nov 2002 10:28:48 -0800 (PST) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.12.3/8.12.3) with ESMTP id gAMISl9K064469 for ; Fri, 22 Nov 2002 21:28:47 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.12.3/8.12.3/Submit) id gAMISkRl064468 for freebsd-scsi@freebsd.org; Fri, 22 Nov 2002 21:28:46 +0300 (MSK) Date: Fri, 22 Nov 2002 21:28:46 +0300 From: Yar Tikhiy To: freebsd-scsi@freebsd.org Subject: {da,sa,...}open bug? Message-ID: <20021122212846.C60810@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi folks, While debugging the USB mass storage driver, which uses CAM, I ran into the following doubt. The XXopen() methods of the da, sa etc drivers get a reference to the peripheral ("periph") through cam_periph_acquire() and don't release it on error exit. I suspect this leads to CAM wedge if the device is removed when its driver is in XXopen(). That is because the "periph" stays acquired (refcount > 0), but the XXopen() caller wouldn't invoke XXclose() subsequently since it sees XXopen() having failed. Thus CAM won't ever "forget" the device removed. Moreover, after I had patched daopen() to release the peripheral if returning non-zero error code, the CAM wedge has gone. I'm new to CAM so I'd like to ask if my idea is correct. Thanks. -- Yar To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message