summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJack Meng <Jack.Meng@Sun.COM>2009-11-10 11:20:11 +0800
committerJack Meng <Jack.Meng@Sun.COM>2009-11-10 11:20:11 +0800
commitf53e1f190fa4dbfc4440b8598a0d6925192bdc54 (patch)
treeb8d15c01a2f4bdfe4fdaa30a8cfcdf968475234c /usr/src
parent0662fbf4a5c0ae38617fd0fe521817c65a4dca3f (diff)
downloadillumos-gate-f53e1f190fa4dbfc4440b8598a0d6925192bdc54.tar.gz
6898410 explicitly invoke relogin to the boot target
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c113
1 files changed, 87 insertions, 26 deletions
diff --git a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c
index 26d8d83343..fe65417245 100644
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c
+++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsid.c
@@ -69,6 +69,7 @@ static boolean_t iscsid_boot_init_config(iscsi_hba_t *ihp);
static iscsi_sess_t *iscsi_add_boot_sess(iscsi_hba_t *ihp, int isid);
static boolean_t iscsid_make_entry(ib_boot_prop_t *boot_prop_entry,
entry_t *entry);
+static boolean_t iscsid_check_active_boot_conn(iscsi_hba_t *ihp);
extern int modrootloaded;
int iscsi_configroot_retry = 20;
@@ -76,6 +77,8 @@ static boolean_t iscsi_configroot_printed = FALSE;
static int iscsi_net_up = 0;
extern ib_boot_prop_t *iscsiboot_prop;
+#define ISCSI_CONFIGROOT_DELAY 1
+
/*
* iSCSI target discovery thread table
*/
@@ -777,22 +780,36 @@ iscsid_config_one(iscsi_hba_t *ihp, char *name, boolean_t protect)
*/
iscsi_boot_session_create(ihp,
iscsiboot_prop);
- } else {
+ retry++;
+ continue;
+ }
+ rc = iscsid_check_active_boot_conn(ihp);
+ if (rc == B_FALSE) {
/*
- * The boot session has been created, if
- * the target lun has not been online,
- * we should wait here for a while
+ * no active connection for the boot
+ * session, retry the login until
+ * one is found or the retry count
+ * is exceeded
*/
- do {
- lun_online =
- iscsiboot_prop->boot_tgt.lun_online;
- if (lun_online == 0) {
- delay(SEC_TO_TICK(1));
- cur_sec++;
- }
- } while ((lun_online == 0) &&
- (cur_sec < iscsi_boot_max_delay));
+ delay(SEC_TO_TICK(ISCSI_CONFIGROOT_DELAY));
+ retry++;
+ continue;
}
+ /*
+ * The boot session has been created with active
+ * connection. If the target lun has not been online,
+ * we should wait here for a while
+ */
+ do {
+ lun_online =
+ iscsiboot_prop->boot_tgt.lun_online;
+ if (lun_online == 0) {
+ delay(SEC_TO_TICK(
+ ISCSI_CONFIGROOT_DELAY));
+ cur_sec++;
+ }
+ } while ((lun_online == 0) &&
+ (cur_sec < iscsi_boot_max_delay));
retry++;
}
if (!rc) {
@@ -865,22 +882,36 @@ iscsid_config_all(iscsi_hba_t *ihp, boolean_t protect)
*/
iscsi_boot_session_create(ihp,
iscsiboot_prop);
- } else {
+ retry++;
+ continue;
+ }
+ rc = iscsid_check_active_boot_conn(ihp);
+ if (rc == B_FALSE) {
/*
- * The boot session has been created, if
- * the target lun has not been online,
- * we should wait here for a while
+ * no active connection for the boot
+ * session, retry the login until
+ * one is found or the retry count
+ * is exceeded
*/
- do {
- lun_online =
- iscsiboot_prop->boot_tgt.lun_online;
- if (lun_online == 0) {
- delay(SEC_TO_TICK(1));
- cur_sec++;
- }
- } while ((lun_online == 0) &&
- (cur_sec < iscsi_boot_max_delay));
+ delay(SEC_TO_TICK(ISCSI_CONFIGROOT_DELAY));
+ retry++;
+ continue;
}
+ /*
+ * The boot session has been created with active
+ * connection. If the target lun has not been online,
+ * we should wait here for a while
+ */
+ do {
+ lun_online =
+ iscsiboot_prop->boot_tgt.lun_online;
+ if (lun_online == 0) {
+ delay(SEC_TO_TICK(
+ ISCSI_CONFIGROOT_DELAY));
+ cur_sec++;
+ }
+ } while ((lun_online == 0) &&
+ (cur_sec < iscsi_boot_max_delay));
retry++;
}
if (!rc) {
@@ -2446,3 +2477,33 @@ iscsi_chk_bootlun_mpxio(iscsi_hba_t *ihp)
return (ihp->hba_mpxio_enabled);
}
}
+
+static boolean_t
+iscsid_check_active_boot_conn(iscsi_hba_t *ihp)
+{
+ iscsi_sess_t *isp = NULL;
+ iscsi_conn_t *icp = NULL;
+
+ rw_enter(&ihp->hba_sess_list_rwlock, RW_READER);
+ isp = ihp->hba_sess_list;
+ while (isp != NULL) {
+ if (isp->sess_boot == B_TRUE) {
+ rw_enter(&isp->sess_conn_list_rwlock, RW_READER);
+ icp = isp->sess_conn_list;
+ while (icp != NULL) {
+ if (icp->conn_state ==
+ ISCSI_CONN_STATE_LOGGED_IN) {
+ rw_exit(&isp->sess_conn_list_rwlock);
+ rw_exit(&ihp->hba_sess_list_rwlock);
+ return (B_TRUE);
+ }
+ icp = icp->conn_next;
+ }
+ rw_exit(&isp->sess_conn_list_rwlock);
+ }
+ isp = isp->sess_next;
+ }
+ rw_exit(&ihp->hba_sess_list_rwlock);
+
+ return (B_FALSE);
+}