svn commit: r331097 - head/sys/cam/scsi

Warner Losh imp at FreeBSD.org
Sat Mar 17 16:04:07 UTC 2018


Author: imp
Date: Sat Mar 17 16:04:06 2018
New Revision: 331097
URL: https://svnweb.freebsd.org/changeset/base/331097

Log:
  Only take out the periph lock when we're modifying the flags of the
  softc for an async unit attention. CAM locks, sometimes, the periph
  lock and other times does not. We were taking the lock always and
  running into lock recursion issues on a non-recursive lock. Now we
  take it selectively. It's not clear why xpt takes the lock selectively
  before calling us, though, and that's still under investigation.
  
  Reported by:	avg
  PR:		226510 (same panic, differnt circumstances)
  Sponsored by:	Netflix

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c	Sat Mar 17 14:50:20 2018	(r331096)
+++ head/sys/cam/scsi/scsi_da.c	Sat Mar 17 16:04:06 2018	(r331097)
@@ -2039,26 +2039,30 @@ daasync(void *callback_arg, u_int32_t code,
 		 * Handle all UNIT ATTENTIONs except our own,
 		 * as they will be handled by daerror().
 		 */
-		cam_periph_lock(periph);
 		if (xpt_path_periph(ccb->ccb_h.path) != periph &&
 		    scsi_extract_sense_ccb(ccb,
 		     &error_code, &sense_key, &asc, &ascq)) {
 			if (asc == 0x2A && ascq == 0x09) {
 				xpt_print(ccb->ccb_h.path,
 				    "Capacity data has changed\n");
+				cam_periph_lock(periph);
 				softc->flags &= ~DA_FLAG_PROBED;
+				cam_periph_unlock(periph);
 				dareprobe(periph);
 			} else if (asc == 0x28 && ascq == 0x00) {
+				cam_periph_lock(periph);
 				softc->flags &= ~DA_FLAG_PROBED;
+				cam_periph_unlock(periph);
 				disk_media_changed(softc->disk, M_NOWAIT);
 			} else if (asc == 0x3F && ascq == 0x03) {
 				xpt_print(ccb->ccb_h.path,
 				    "INQUIRY data has changed\n");
+				cam_periph_lock(periph);
 				softc->flags &= ~DA_FLAG_PROBED;
+				cam_periph_unlock(periph);
 				dareprobe(periph);
 			}
 		}
-		cam_periph_unlock(periph);
 		break;
 	}
 	case AC_SCSI_AEN:


More information about the svn-src-head mailing list