Subject: Re: kern/29603: esiop has problems with scsi request ioctl
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: john heasley <heas@shrubbery.net>
List: netbsd-bugs
Date: 03/20/2005 05:08:30
The problem here is that the lun_tagtbl is NULL when a second LUN is attach
for an existing target. ie: LUN 0 is a RAID set and LUN 6 is the controller
itself.
sd2 at scsibus1 target 0 lun 0: <CNSi, K5412, K410> disk fixed
sd2: 51305 MB, 6413 cyl, 128 head, 128 sec, 512 bytes/sect x 105073152 sectors
sd2: sync (25.00ns offset 31), 16-bit (80.000MB/s) transfers, tagged queueing
uk0 at scsibus1 target 0 lun 6: <CNSi, K5412, K410> processor fixed
uk0: sync (25.00ns offset 31), 16-bit (80.000MB/s) transfers, tagged queueing
So, a tagtbl will not be allocated for LUN 6, since TARF_TAG will have already
been set when LUN 0 was attached. But, the periph would not have existed for
LUN 6 when LUN 0 was attached (so the lun_tagtbl was not allocated at that
time).
Does this look ok? It works fine for me and this seems to be the only user
of esiop_add_dev().
Index: esiop.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/esiop.c,v
retrieving revision 1.32
diff -u -d -u -r1.32 esiop.c
--- esiop.c 4 Feb 2005 02:10:36 -0000 1.32
+++ esiop.c 20 Mar 2005 04:54:47 -0000
@@ -1641,8 +1641,7 @@
if (sc->sc_c.targets[xm->xm_target] == NULL)
return;
s = splbio();
- if ((xm->xm_mode & PERIPH_CAP_TQING) &&
- (sc->sc_c.targets[xm->xm_target]->flags & TARF_TAG) == 0) {
+ if (xm->xm_mode & PERIPH_CAP_TQING) {
sc->sc_c.targets[xm->xm_target]->flags |= TARF_TAG;
/* allocate tag tables for this device */
for (lun = 0;
@@ -2092,6 +2091,9 @@
(struct esiop_target *)sc->sc_c.targets[target];
struct esiop_lun *esiop_lun = esiop_target->esiop_lun[lun];
+ if (esiop_lun->lun_tagtbl != NULL)
+ return;
+
/* we need a tag DSA table */
esiop_lun->lun_tagtbl= TAILQ_FIRST(&sc->free_tagtbl);
if (esiop_lun->lun_tagtbl == NULL) {