Date: Fri, 6 Dec 2002 11:23:56 -0800 (PST)
From: Nate Lawson <nate@root.org>
To: Yar Tikhiy <yar@freebsd.org>
Cc: freebsd-scsi@freebsd.org
Subject: Re: {da,sa,...}open bug?
Message-ID: <Pine.BSF.4.21.0212061121290.15885-100000@root.org>
In-Reply-To: <20021206145942.I80257@comp.chem.msu.su>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 6 Dec 2002, Yar Tikhiy wrote:
> Yet another daopen() issue came to my attention. The DA_OPEN_FLAG bit
> won't be reset back to 0 if daopen() has failed, thus leaving the device
> marked as open. Isn't the below patch necessary?
>
> The rest of scsi_* modules seem to not have this bug.
>
> --
> Yar
>
> Index: scsi_da.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v
> retrieving revision 1.116
> diff -u -r1.116 scsi_da.c
> --- scsi_da.c 29 Nov 2002 15:40:10 -0000 1.116
> +++ scsi_da.c 6 Dec 2002 11:49:57 -0000
> @@ -612,6 +612,7 @@
> if ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0)
> daprevent(periph, PR_PREVENT);
> } else {
> + softc->flags &= ~DA_FLAG_OPEN;
> cam_periph_release(periph);
> }
> cam_periph_unlock(periph);
You are correct. Ok to commit this w/ re@ approval The other periphs
don't use this flag.
There is another important fix that should be made that exists in several
other drivers as well:
--- scsi_da.c.orig Fri Dec 6 11:07:33 2002
+++ scsi_da.c Fri Dec 6 11:10:44 2002
@@ -545,8 +545,10 @@
if ((error = cam_periph_lock(periph, PRIBIO|PCATCH)) != 0)
return (error); /* error code from tsleep */
- if (cam_periph_acquire(periph) != CAM_REQ_CMP)
+ if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
+ cam_periph_unlock(periph);
return(ENXIO);
+ }
softc->flags |= DA_FLAG_OPEN;
if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) {
i.e. unlock if locked on return. Can you put together a patch for all of
these?
Thanks,
-Nate
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0212061121290.15885-100000>
