]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Fix false CTL_UA_RES_RELEASE on secondary HA node.
authormav <mav@FreeBSD.org>
Sat, 12 Sep 2015 18:29:05 +0000 (18:29 +0000)
committermav <mav@FreeBSD.org>
Sat, 12 Sep 2015 18:29:05 +0000 (18:29 +0000)
sys/cam/ctl/ctl.c

index dcb1dc803a989a641f3cb339f1071112b0244d6d..8e3a4014c6bde91182b2f4fb8f431bb8e4ac9068 100644 (file)
@@ -8404,7 +8404,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
        struct ctl_lun *lun;
        struct ctl_softc *softc;
        int i;
-       uint32_t targ_lun;
+       uint32_t residx, targ_lun;
 
        softc = control_softc;
        targ_lun = msg->hdr.nexus.targ_mapped_lun;
@@ -8420,6 +8420,7 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
                mtx_unlock(&lun->lun_lock);
                return;
        }
+       residx = ctl_get_initindex(&msg->hdr.nexus);
        switch(msg->pr.pr_info.action) {
        case CTL_PR_REG_KEY:
                ctl_alloc_prkey(lun, msg->pr.pr_info.residx);
@@ -8484,8 +8485,9 @@ ctl_hndl_per_res_out_on_other_sc(union ctl_ha_msg *msg)
                if (lun->res_type != SPR_TYPE_EX_AC
                 && lun->res_type != SPR_TYPE_WR_EX) {
                        for (i = softc->init_min; i < softc->init_max; i++)
-                               if (ctl_get_prkey(lun, i) != 0)
-                                       ctl_est_ua(lun, i, CTL_UA_RES_RELEASE);
+                               if (i == residx || ctl_get_prkey(lun, i) == 0)
+                                       continue;
+                               ctl_est_ua(lun, i, CTL_UA_RES_RELEASE);
                }
 
                lun->flags &= ~CTL_LUN_PR_RESERVED;