Print this page
4779 vhci shouldn't abuse ddi_get_time(9f)
Reviewed by: Robert Mustacchi <rm@joyent.com>
*** 19,28 ****
--- 19,31 ----
* CDDL HEADER END
*/
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+ /*
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
+ */
/*
* Multiplexed I/O SCSI vHCI implementation
*/
*** 2224,2234 ****
int rval = -1;
int pgr_sema_held = 0;
int held;
int mps_flag = MDI_SELECT_ONLINE_PATH;
struct scsi_vhci_lun *vlun;
- time_t tnow;
int path_instance = 0;
vlun = ADDR2VLUN(ap);
ASSERT(vlun != 0);
--- 2227,2236 ----
*** 2362,2372 ****
rval = mdi_select_path(cdip, vpkt->vpkt_tgt_init_bp,
mps_flag, NULL, &pip);
if ((rval != MDI_SUCCESS) || (pip == NULL)) {
if (vlun->svl_waiting_for_activepath == 0) {
vlun->svl_waiting_for_activepath = 1;
! vlun->svl_wfa_time = ddi_get_time();
}
mps_flag |= MDI_SELECT_STANDBY_PATH;
rval = mdi_select_path(cdip,
vpkt->vpkt_tgt_init_bp,
mps_flag, NULL, &pip);
--- 2364,2374 ----
rval = mdi_select_path(cdip, vpkt->vpkt_tgt_init_bp,
mps_flag, NULL, &pip);
if ((rval != MDI_SUCCESS) || (pip == NULL)) {
if (vlun->svl_waiting_for_activepath == 0) {
vlun->svl_waiting_for_activepath = 1;
! vlun->svl_wfa_time = gethrtime();
}
mps_flag |= MDI_SELECT_STANDBY_PATH;
rval = mdi_select_path(cdip,
vpkt->vpkt_tgt_init_bp,
mps_flag, NULL, &pip);
*** 2394,2405 ****
* passive path; lets wait for a little
* bit, hopefully an active path will
* show up obviating the need for a
* failover
*/
! tnow = ddi_get_time();
! if (tnow - vlun->svl_wfa_time >= 60) {
vlun->svl_waiting_for_activepath = 0;
} else {
drv_usecwait(1000);
if (vlun->svl_waiting_for_activepath
== 0) {
--- 2396,2407 ----
* passive path; lets wait for a little
* bit, hopefully an active path will
* show up obviating the need for a
* failover
*/
! if ((gethrtime() - vlun->svl_wfa_time) >=
! (60 * NANOSEC)) {
vlun->svl_waiting_for_activepath = 0;
} else {
drv_usecwait(1000);
if (vlun->svl_waiting_for_activepath
== 0) {
*** 3622,3632 ****
vlun->svl_lun_wwn));
VHCI_RELEASE_LUN(vlun);
return (PKT_RETURN);
}
swarg->svs_svp = svp;
! swarg->svs_tos = ddi_get_time();
swarg->svs_pi = vpkt->vpkt_path;
swarg->svs_release_lun = 0;
swarg->svs_done = 0;
/*
* place a hold on the path...we don't want it to
--- 3624,3634 ----
vlun->svl_lun_wwn));
VHCI_RELEASE_LUN(vlun);
return (PKT_RETURN);
}
swarg->svs_svp = svp;
! swarg->svs_tos = gethrtime();
swarg->svs_pi = vpkt->vpkt_path;
swarg->svs_release_lun = 0;
swarg->svs_done = 0;
/*
* place a hold on the path...we don't want it to
*** 3683,3693 ****
ddi_get_instance(vdip));
updt_paths = 0;
if (pkt->pkt_reason != CMD_CMPLT) {
! if ((ddi_get_time() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
}
--- 3685,3695 ----
ddi_get_instance(vdip));
updt_paths = 0;
if (pkt->pkt_reason != CMD_CMPLT) {
! if ((gethrtime() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
}
*** 3705,3715 ****
case SCSI_SENSE_INACTIVE:
case SCSI_SENSE_NOFAILOVER:
updt_paths = 1;
break;
default:
! if ((ddi_get_time() - swarg->svs_tos)
>= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
--- 3707,3717 ----
case SCSI_SENSE_INACTIVE:
case SCSI_SENSE_NOFAILOVER:
updt_paths = 1;
break;
default:
! if ((gethrtime() - swarg->svs_tos)
>= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
*** 3737,3747 ****
(void) taskq_dispatch(vhci->vhci_update_pathstates_taskq,
vhci_update_pathstates, (void *)vlun,
KM_SLEEP);
return (0);
}
! if ((ddi_get_time() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
done:
--- 3739,3749 ----
(void) taskq_dispatch(vhci->vhci_update_pathstates_taskq,
vhci_update_pathstates, (void *)vlun,
KM_SLEEP);
return (0);
}
! if ((gethrtime() - swarg->svs_tos) >= VHCI_EXTFO_TIMEOUT) {
swarg->svs_release_lun = 1;
goto done;
}
return (0);
done: