Date: Sat, 17 Mar 2018 16:04:06 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331097 - head/sys/cam/scsi Message-ID: <201803171604.w2HG46RM024372@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803171604.w2HG46RM024372>