Le 2003-08-25, Matt écrivait :

> db> trace
> free_hcb(c40f1040,c03c7e40,101,c41d5800,c1528130) at free_hcb+0x2e
> atapi_action(c40f1440,c41d5800,c0132b33,c41db000,c41d5800) at
> atapi_action+ox56c

OK, so that presumably means we're going through action_oom, and so you
should have had one of the following messages on the console:

            printf("cannot allocate ATAPI/CAM hcb\n");
            printf("cannot allocate ATAPI/CAM request\n");
                printf("cannot allocate ATAPI/CAM buffer\n");

It would be interesting to know which, if any, of these messages you
saw. Also, please try whether the following patch improves the
situation:

Index: atapi-cam.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/atapi-cam.c,v
retrieving revision 1.20
diff -u -r1.20 atapi-cam.c
--- atapi-cam.c 24 Aug 2003 17:48:05 -0000      1.20
+++ atapi-cam.c 25 Aug 2003 17:24:44 -0000
@@ -59,7 +59,7 @@
     int                        lun;
     union ccb          *ccb;
     int                        flags;
-#define DOING_AUTOSENSE 1
+#define QUEUED         0x0001;
 
     char               *dxfer_alloc;
     TAILQ_ENTRY(atapi_hcb) chain;
@@ -394,7 +394,7 @@
            /* scatter-gather not supported */
            xpt_print_path(ccb_h->path);
            printf("ATAPI/CAM does not support scatter-gather yet!\n");
-           break;
+           goto action_invalid;
        }
 
        if ((hcb = allocate_hcb(softc, unit, bus, ccb)) == NULL) {
@@ -464,8 +464,8 @@
 
        if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_IN && (len & 1)) {
            /* ATA always transfers an even number of bytes */
-           if (!(buf = hcb->dxfer_alloc = malloc(++len, M_ATACAM,
-                                                 M_NOWAIT | M_ZERO)))
+           if ((buf = hcb->dxfer_alloc = malloc(++len, M_ATACAM,
+                                                 M_NOWAIT | M_ZERO)) == NULL)
                printf("cannot allocate ATAPI/CAM buffer\n");
                goto action_oom;
        }
@@ -494,6 +494,7 @@
         }
 
        TAILQ_INSERT_TAIL(&softc->pending_hcbs, hcb, chain);
+       hcb->flags |= QUEUED;
 
        ata_queue_request(request);
        return;
@@ -519,9 +520,13 @@
     return;
 
 action_invalid:
-   ccb_h->status = CAM_REQ_INVALID;
-   xpt_done(ccb);
-   return;
+    if (request != NULL)
+       ata_free_request(request);
+    if (hcb != NULL)
+       free_hcb(hcb);
+    ccb_h->status = CAM_REQ_INVALID;
+    xpt_done(ccb);
+    return;
 }
 
 static void
@@ -686,7 +691,8 @@
 static void
 free_hcb(struct atapi_hcb *hcb)
 {
-    TAILQ_REMOVE(&hcb->softc->pending_hcbs, hcb, chain);
+    if ((hcb->flags & QUEUED) != 0)
+        TAILQ_REMOVE(&hcb->softc->pending_hcbs, hcb, chain);
     if (hcb->dxfer_alloc != NULL)
        free(hcb->dxfer_alloc, M_ATACAM);
     free(hcb, M_ATACAM);

-- 
    [EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to