dadump: missing cam_periph_unlock for the EIO branch?

Andriy Gapon avg at FreeBSD.org
Wed Jan 11 19:58:11 UTC 2012


on 11/01/2012 13:59 Andriy Gapon said the following:
> 
> It looks like if the dadump() returns EIO, then it fails to unlock the cam
> periph lock (the sim lock, really).  The leaked lock could lead to unnecessary
> secondary panics.  What do you think?
> 
> Example:
> http://sunner.semmy.ru/~az/avg/12.JPG
> http://sunner.semmy.ru/~az/avg/13.JPG

So how about something this?
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 29a93ae..985a501 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -1094,6 +1094,7 @@ dadump(void *arg, void *virtual, vm_offset_t physical,
off_t offset, size_t leng
 				/*sense_len*/SSD_FULL_SIZE,
 				DA_DEFAULT_TIMEOUT * 1000);		
 		xpt_polled_action((union ccb *)&csio);
+		cam_periph_unlock(periph);

 		if ((csio.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
 			printf("Aborting dump due to I/O error.\n");
@@ -1105,7 +1106,6 @@ dadump(void *arg, void *virtual, vm_offset_t physical,
off_t offset, size_t leng
 				       csio.ccb_h.status, csio.scsi_status);
 			return(EIO);
 		}
-		cam_periph_unlock(periph);
 		return(0);
 	}
 		


-- 
Andriy Gapon


More information about the freebsd-scsi mailing list