Date: Fri, 21 Nov 2014 11:20:25 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274789 - head/sys/cam/ctl Message-ID: <201411211120.sALBKPpC023860@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Fri Nov 21 11:20:24 2014 New Revision: 274789 URL: https://svnweb.freebsd.org/changeset/base/274789 Log: Reduce race between LUN destruction and request arrival. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Fri Nov 21 10:47:29 2014 (r274788) +++ head/sys/cam/ctl/ctl.c Fri Nov 21 11:20:24 2014 (r274789) @@ -11746,15 +11746,18 @@ ctl_scsiio_precheck(struct ctl_softc *ct targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; if ((targ_lun < CTL_MAX_LUNS) - && (ctl_softc->ctl_luns[targ_lun] != NULL)) { - lun = ctl_softc->ctl_luns[targ_lun]; + && ((lun = ctl_softc->ctl_luns[targ_lun]) != NULL)) { /* * If the LUN is invalid, pretend that it doesn't exist. * It will go away as soon as all pending I/O has been * completed. */ + mtx_lock(&lun->lun_lock); if (lun->flags & CTL_LUN_DISABLED) { + mtx_unlock(&lun->lun_lock); lun = NULL; + ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = NULL; + ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = NULL; } else { ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = @@ -11767,7 +11770,6 @@ ctl_scsiio_precheck(struct ctl_softc *ct * Every I/O goes into the OOA queue for a * particular LUN, and stays there until completion. */ - mtx_lock(&lun->lun_lock); TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411211120.sALBKPpC023860>