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
This commit is contained in:
imp 2018-03-17 16:04:06 +00:00
parent 22a89bf952
commit bf523f13ef

View File

@ -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: