Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jan 2000 21:10:03 -0800 (PST)
From:      "Kenneth D. Merry" <ken@kdm.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/16049: Conner Drive Doesn't like syncronize cache (surprise)
Message-ID:  <200001210510.VAA12539@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/16049; it has been noted by GNATS.

From: "Kenneth D. Merry" <ken@kdm.org>
To: robert@tabby.kudra.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, gibbs@FreeBSD.ORG
Subject: Re: kern/16049: Conner Drive Doesn't like syncronize cache (surprise)
Date: Thu, 20 Jan 2000 21:51:08 -0700

 --dDRMvlgZJXvWKvBx
 Content-Type: text/plain; charset=us-ascii
 
 On Tue, Jan 11, 2000 at 00:13:53 -0500, robert@tabby.kudra.com wrote:
 > >Release:        FreeBSD 3.4-RELEASE i386
 > >Organization:
 > Kudra.Com Web services
 > >Environment:
 > 3.4 Release
 > 
 > >Description:
 > 
 > When rebooting a 3.4-RELEASE machine with a Conner drive and Adaptec
 > Controller, I get the following error message:
 > 
 > (da0:ahc0:0:0:0): SYNCHRONIZE CACHE. CDB: 35 0 0 0 0 0 0 0 0 0 
 > (da0:ahc0:0:0:0): ILLEGAL REQUEST asc:20,0
 > (da0:ahc0:0:0:0): Invalid command operation code
 > 
 > Here are the boot messages pertaining to the disk adapter and drive:
 > ahc0: <Adaptec 2940 SCSI adapter> rev 0x03 int a irq 11 on pci0.18.0
 > ahc0: aic7870 Single Channel A, SCSI Id=7, 16/255 SCBs
 > 
 > da0: <CONNER CFP1080S 4443> Fixed Direct Access SCSI-2 device 
 > da0: 10.000MB/s transfers (10.000MHz, offset 15), Tagged Queueing Enabled
 > da0: 1030MB (2110812 512 byte sectors: 255H 63S/T 131C)
 > 
 > >How-To-Repeat:
 > 
 > halt/reboot the machine.
 
 Instead of quirking it, can you try the attached patch?  Justin and I have
 a theory on why these messages might be popping up, but we're not quite
 sure.
 
 I've tested this under -current, but the patch is against -stable, which
 should apply okay to your 3.4-RELEASE sources.  (Obviously, you'll need to
 remove or comment out your quirk to test this.)
 
 Anyway, let us know how it works.  Make sure to CC your mail to
 FreeBSD-gnats-submit@FreeBSD.ORG, so it gets in the log for this PR as
 well.
 
 Thanks,
 
 Ken
 -- 
 Kenneth Merry
 ken@kdm.org
 
 --dDRMvlgZJXvWKvBx
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="scsi_da.c.cache_sync.stable.20000120"
 
 ==== //depot/FreeBSD-ken-stable/src/sys/cam/scsi/scsi_da.c#1 - /a/ken/perforce/FreeBSD-ken-stable/src/sys/cam/scsi/scsi_da.c ====
 *** /tmp/tmp.4027.0	Thu Jan 20 21:47:33 2000
 --- /a/ken/perforce/FreeBSD-ken-stable/src/sys/cam/scsi/scsi_da.c	Thu Jan 20 21:46:25 2000
 ***************
 *** 263,268 ****
 --- 263,269 ----
   
   static SLIST_HEAD(,da_softc) softc_list;
   static struct extend_array *daperiphs;
 + static union ccb *da_shutdown_ccb;
   
   static int
   daopen(dev_t dev, int flags, int fmt, struct proc *p)
 ***************
 *** 808,814 ****
   		printf("da: Failed to alloc extend array!\n");
   		return;
   	}
 ! 	
   	/*
   	 * Install a global async callback.  This callback will
   	 * receive async callbacks like "new device found".
 --- 809,826 ----
   		printf("da: Failed to alloc extend array!\n");
   		return;
   	}
 ! 
 ! 	da_shutdown_ccb = malloc(sizeof(union ccb), M_DEVBUF, M_NOWAIT);
 ! 	if (da_shutdown_ccb == NULL) {
 ! 		/*
 ! 		 * XXX KDM should we worry about a memory leak from
 ! 		 * daperiphs here?
 ! 		 */
 ! 		printf("da: Failed to alloc shutdown CCB!\n");
 ! 		return;
 ! 	} else
 ! 		bzero(da_shutdown_ccb, sizeof(union ccb));
 ! 
   	/*
   	 * Install a global async callback.  This callback will
   	 * receive async callbacks like "new device found".
 ***************
 *** 1578,1586 ****
   
   	for (periph = TAILQ_FIRST(&dadriver.units); periph != NULL;
   	     periph = TAILQ_NEXT(periph, unit_links)) {
 ! 		union ccb ccb;
   		softc = (struct da_softc *)periph->softc;
   
   		/*
   		 * We only sync the cache if the drive is still open, and
   		 * if the drive is capable of it..
 --- 1590,1600 ----
   
   	for (periph = TAILQ_FIRST(&dadriver.units); periph != NULL;
   	     periph = TAILQ_NEXT(periph, unit_links)) {
 ! 		union ccb *ccb;
   		softc = (struct da_softc *)periph->softc;
   
 + 		ccb = da_shutdown_ccb;
 + 
   		/*
   		 * We only sync the cache if the drive is still open, and
   		 * if the drive is capable of it..
 ***************
 *** 1589,1598 ****
   		 || (softc->quirks & DA_Q_NO_SYNC_CACHE))
   			continue;
   
 ! 		xpt_setup_ccb(&ccb.ccb_h, periph->path, /*priority*/1);
   
 ! 		ccb.ccb_h.ccb_state = DA_CCB_DUMP;
 ! 		scsi_synchronize_cache(&ccb.csio,
   				       /*retries*/1,
   				       /*cbfcnp*/dadone,
   				       MSG_SIMPLE_Q_TAG,
 --- 1603,1612 ----
   		 || (softc->quirks & DA_Q_NO_SYNC_CACHE))
   			continue;
   
 ! 		xpt_setup_ccb(&ccb->ccb_h, periph->path, /*priority*/1);
   
 ! 		ccb->ccb_h.ccb_state = DA_CCB_DUMP;
 ! 		scsi_synchronize_cache(&ccb->csio,
   				       /*retries*/1,
   				       /*cbfcnp*/dadone,
   				       MSG_SIMPLE_Q_TAG,
 ***************
 *** 1601,1630 ****
   				       SSD_FULL_SIZE,
   				       5 * 60 * 1000);
   
 ! 		xpt_polled_action(&ccb);
   
 ! 		if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
 ! 			if (((ccb.ccb_h.status & CAM_STATUS_MASK) ==
   			     CAM_SCSI_STATUS_ERROR)
 ! 			 && (ccb.csio.scsi_status == SCSI_STATUS_CHECK_COND)){
   				int error_code, sense_key, asc, ascq;
   
 ! 				scsi_extract_sense(&ccb.csio.sense_data,
   						   &error_code, &sense_key,
   						   &asc, &ascq);
   
   				if (sense_key != SSD_KEY_ILLEGAL_REQUEST)
 ! 					scsi_sense_print(&ccb.csio);
   			} else {
   				xpt_print_path(periph->path);
   				printf("Synchronize cache failed, status "
   				       "== 0x%x, scsi status == 0x%x\n",
 ! 				       ccb.ccb_h.status, ccb.csio.scsi_status);
   			}
   		}
   
 ! 		if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0)
 ! 			cam_release_devq(ccb.ccb_h.path,
   					 /*relsim_flags*/0,
   					 /*reduction*/0,
   					 /*timeout*/0,
 --- 1615,1645 ----
   				       SSD_FULL_SIZE,
   				       5 * 60 * 1000);
   
 ! 		xpt_polled_action(ccb);
   
 ! 		if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
 ! 			if (((ccb->ccb_h.status & CAM_STATUS_MASK) ==
   			     CAM_SCSI_STATUS_ERROR)
 ! 			 && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND)){
   				int error_code, sense_key, asc, ascq;
   
 ! 				scsi_extract_sense(&ccb->csio.sense_data,
   						   &error_code, &sense_key,
   						   &asc, &ascq);
   
   				if (sense_key != SSD_KEY_ILLEGAL_REQUEST)
 ! 					scsi_sense_print(&ccb->csio);
   			} else {
   				xpt_print_path(periph->path);
   				printf("Synchronize cache failed, status "
   				       "== 0x%x, scsi status == 0x%x\n",
 ! 				       ccb->ccb_h.status,
 ! 				       ccb->csio.scsi_status);
   			}
   		}
   
 ! 		if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
 ! 			cam_release_devq(ccb->ccb_h.path,
   					 /*relsim_flags*/0,
   					 /*reduction*/0,
   					 /*timeout*/0,
 
 --dDRMvlgZJXvWKvBx--
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001210510.VAA12539>