Resolves: #570664
This commit is contained in:
parent
3846e3d4dd
commit
e81a583416
289
iscsi-initiator-utils-fix-dd-stop.patch
Normal file
289
iscsi-initiator-utils-fix-dd-stop.patch
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i.base/usr/discoveryd.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/discoveryd.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i.base/usr/discoveryd.c 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/discoveryd.c 2010-05-19 03:09:54.000000000 -0500
|
||||||
|
@@ -54,6 +54,7 @@
|
||||||
|
#define DISC_DEF_POLL_INVL 30
|
||||||
|
|
||||||
|
static LIST_HEAD(iscsi_targets);
|
||||||
|
+static int stop_discoveryd;
|
||||||
|
|
||||||
|
static LIST_HEAD(isns_initiators);
|
||||||
|
static LIST_HEAD(isns_refresh_list);
|
||||||
|
@@ -66,27 +67,64 @@ static void isns_reg_refresh_by_eid_qry(
|
||||||
|
typedef void (do_disc_and_login_fn)(const char *def_iname, char *addr,
|
||||||
|
int port, int poll_inval);
|
||||||
|
|
||||||
|
-static int logout_stale_session(void *data, struct list_head *list,
|
||||||
|
- struct session_info *info)
|
||||||
|
+static int logout_session(void *data, struct list_head *list,
|
||||||
|
+ struct session_info *info)
|
||||||
|
{
|
||||||
|
- struct list_head *stale_rec_list = data;
|
||||||
|
+ struct list_head *rec_list = data;
|
||||||
|
struct node_rec *rec;
|
||||||
|
|
||||||
|
- list_for_each_entry(rec, stale_rec_list, list) {
|
||||||
|
+ list_for_each_entry(rec, rec_list, list) {
|
||||||
|
if (iscsi_match_session(rec, info))
|
||||||
|
return iscsi_logout_portal(info, list);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void free_curr_targets(void)
|
||||||
|
+static void discoveryd_stop(void)
|
||||||
|
{
|
||||||
|
struct node_rec *rec, *tmp_rec;
|
||||||
|
+ int nr_found = 0;
|
||||||
|
|
||||||
|
+ if (list_empty(&iscsi_targets))
|
||||||
|
+ goto done;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * User requested to just login and exit.
|
||||||
|
+ */
|
||||||
|
+ if (!stop_discoveryd)
|
||||||
|
+ goto done;
|
||||||
|
+
|
||||||
|
+ iscsi_logout_portals(&iscsi_targets, &nr_found, 1, logout_session);
|
||||||
|
list_for_each_entry_safe(rec, tmp_rec, &iscsi_targets, list) {
|
||||||
|
list_del(&rec->list);
|
||||||
|
free(rec);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+done:
|
||||||
|
+ exit(0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void catch_signal(int signo)
|
||||||
|
+{
|
||||||
|
+ log_debug(1, "%d caught signal -%d...", signo, getpid());
|
||||||
|
+ switch (signo) {
|
||||||
|
+ case SIGTERM:
|
||||||
|
+ stop_discoveryd = 1;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void setup_signal_handler(void)
|
||||||
|
+{
|
||||||
|
+ struct sigaction sa_old;
|
||||||
|
+ struct sigaction sa_new;
|
||||||
|
+
|
||||||
|
+ sa_new.sa_handler = catch_signal;
|
||||||
|
+ sigemptyset(&sa_new.sa_mask);
|
||||||
|
+ sa_new.sa_flags = 0;
|
||||||
|
+ sigaction(SIGTERM, &sa_new, &sa_old );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -158,7 +196,7 @@ static void update_sessions(struct list_
|
||||||
|
|
||||||
|
if (!list_empty(&stale_rec_list)) {
|
||||||
|
iscsi_logout_portals(&stale_rec_list, &nr_found, 0,
|
||||||
|
- logout_stale_session);
|
||||||
|
+ logout_session);
|
||||||
|
list_for_each_entry_safe(rec, tmp_rec, &stale_rec_list, list) {
|
||||||
|
list_del(&rec->list);
|
||||||
|
free(rec);
|
||||||
|
@@ -194,6 +232,7 @@ static void do_disc_to_addrs(const char
|
||||||
|
|
||||||
|
pid = fork();
|
||||||
|
if (pid == 0) {
|
||||||
|
+ setup_signal_handler();
|
||||||
|
do_disc_and_login(def_iname, ip_str, portn, poll_inval);
|
||||||
|
exit(0);
|
||||||
|
} else if (pid < 0)
|
||||||
|
@@ -201,6 +240,7 @@ static void do_disc_to_addrs(const char
|
||||||
|
"to perform discovery to %s.\n",
|
||||||
|
errno, strerror(errno), ip_str);
|
||||||
|
else {
|
||||||
|
+ shutdown_callback(pid);
|
||||||
|
log_debug(1, "iSCSI disc and login helper pid=%d", pid);
|
||||||
|
reap_inc();
|
||||||
|
}
|
||||||
|
@@ -872,8 +912,7 @@ static int isns_scn_recv(isns_server_t *
|
||||||
|
|
||||||
|
log_debug(1, "isns_scn_recv");
|
||||||
|
|
||||||
|
- while (1) {
|
||||||
|
-
|
||||||
|
+ while (!stop_discoveryd) {
|
||||||
|
/* reap disc/login procs */
|
||||||
|
reap_proc();
|
||||||
|
/*
|
||||||
|
@@ -999,7 +1038,6 @@ static int isns_eventd(const char *def_i
|
||||||
|
isns_cancel_refresh_timers();
|
||||||
|
fail:
|
||||||
|
isns_clear_refresh_list();
|
||||||
|
- free_curr_targets();
|
||||||
|
|
||||||
|
list_for_each_entry_safe(node, tmp_node, &isns_initiators, list) {
|
||||||
|
list_del(&node->list);
|
||||||
|
@@ -1028,6 +1066,7 @@ static void start_isns(const char *def_i
|
||||||
|
|
||||||
|
rc = isns_eventd(def_iname, disc_addr, port, poll_inval);
|
||||||
|
log_debug(1, "start isns done %d.", rc);
|
||||||
|
+ discoveryd_stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SendTargets */
|
||||||
|
@@ -1087,9 +1126,9 @@ static void do_st_disc_and_login(const c
|
||||||
|
__do_st_disc_and_login(disc_addr, port);
|
||||||
|
if (!poll_inval)
|
||||||
|
break;
|
||||||
|
- } while (!sleep(poll_inval));
|
||||||
|
+ } while (!stop_discoveryd && !sleep(poll_inval));
|
||||||
|
|
||||||
|
- free_curr_targets();
|
||||||
|
+ discoveryd_stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void discoveryd_start(const char *def_iname)
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i.base/usr/event_poll.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/event_poll.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i.base/usr/event_poll.c 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/event_poll.c 2010-05-19 04:26:20.000000000 -0500
|
||||||
|
@@ -62,21 +62,75 @@ void reap_proc(void)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static LIST_HEAD(shutdown_callbacks);
|
||||||
|
+
|
||||||
|
+struct shutdown_callback {
|
||||||
|
+ struct list_head list;
|
||||||
|
+ pid_t pid;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+int shutdown_callback(pid_t pid)
|
||||||
|
+{
|
||||||
|
+ struct shutdown_callback *cb;
|
||||||
|
+
|
||||||
|
+ cb = calloc(1, sizeof(*cb));
|
||||||
|
+ if (!cb)
|
||||||
|
+ return ENOMEM;
|
||||||
|
+
|
||||||
|
+ INIT_LIST_HEAD(&cb->list);
|
||||||
|
+ cb->pid = pid;
|
||||||
|
+ log_debug(1, "adding %d for shutdown cb\n", pid);
|
||||||
|
+ list_add_tail(&cb->list, &shutdown_callbacks);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void shutdown_notify_pids(void)
|
||||||
|
+{
|
||||||
|
+ struct shutdown_callback *cb;
|
||||||
|
+
|
||||||
|
+ list_for_each_entry(cb, &shutdown_callbacks, list) {
|
||||||
|
+ log_debug(1, "Killing %d\n", cb->pid);
|
||||||
|
+ kill(cb->pid, SIGTERM);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int shutdown_wait_pids(void)
|
||||||
|
+{
|
||||||
|
+ struct shutdown_callback *cb, *tmp;
|
||||||
|
+
|
||||||
|
+ list_for_each_entry_safe(cb, tmp, &shutdown_callbacks, list) {
|
||||||
|
+ /*
|
||||||
|
+ * the proc reaper could clean it up, so wait for any
|
||||||
|
+ * sign that it is gone.
|
||||||
|
+ */
|
||||||
|
+ if (waitpid(cb->pid, NULL, WNOHANG)) {
|
||||||
|
+ log_debug(1, "%d done\n", cb->pid);
|
||||||
|
+ list_del(&cb->list);
|
||||||
|
+ free(cb);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return list_empty(&shutdown_callbacks);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
#define POLL_CTRL 0
|
||||||
|
#define POLL_IPC 1
|
||||||
|
#define POLL_MAX 2
|
||||||
|
|
||||||
|
static int event_loop_stop;
|
||||||
|
+static queue_task_t *shutdown_qtask;
|
||||||
|
+
|
||||||
|
|
||||||
|
-void event_loop_exit(void)
|
||||||
|
+void event_loop_exit(queue_task_t *qtask)
|
||||||
|
{
|
||||||
|
+ shutdown_qtask = qtask;
|
||||||
|
event_loop_stop = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd)
|
||||||
|
{
|
||||||
|
struct pollfd poll_array[POLL_MAX];
|
||||||
|
- int res;
|
||||||
|
+ int res, has_shutdown_children = 0;
|
||||||
|
|
||||||
|
poll_array[POLL_CTRL].fd = control_fd;
|
||||||
|
poll_array[POLL_CTRL].events = POLLIN;
|
||||||
|
@@ -84,7 +138,16 @@ void event_loop(struct iscsi_ipc *ipc, i
|
||||||
|
poll_array[POLL_IPC].events = POLLIN;
|
||||||
|
|
||||||
|
event_loop_stop = 0;
|
||||||
|
- while (!event_loop_stop) {
|
||||||
|
+ while (1) {
|
||||||
|
+ if (event_loop_stop) {
|
||||||
|
+ if (!has_shutdown_children) {
|
||||||
|
+ has_shutdown_children = 1;
|
||||||
|
+ shutdown_notify_pids();
|
||||||
|
+ }
|
||||||
|
+ if (shutdown_wait_pids())
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
res = poll(poll_array, POLL_MAX, ACTOR_RESOLUTION);
|
||||||
|
if (res > 0) {
|
||||||
|
log_debug(6, "poll result %d", res);
|
||||||
|
@@ -110,4 +173,6 @@ void event_loop(struct iscsi_ipc *ipc, i
|
||||||
|
*/
|
||||||
|
sysfs_cleanup();
|
||||||
|
}
|
||||||
|
+ if (shutdown_qtask)
|
||||||
|
+ mgmt_ipc_write_rsp(shutdown_qtask, MGMT_IPC_OK);
|
||||||
|
}
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i.base/usr/event_poll.h open-iscsi-2.0-872-rc1-bnx2i.work/usr/event_poll.h
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i.base/usr/event_poll.h 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/event_poll.h 2010-05-19 03:24:24.000000000 -0500
|
||||||
|
@@ -20,10 +20,12 @@
|
||||||
|
#define EVENT_POLL_H
|
||||||
|
|
||||||
|
struct iscsi_ipc;
|
||||||
|
+struct queue_task;
|
||||||
|
|
||||||
|
+int shutdown_callback(pid_t pid);
|
||||||
|
void reap_proc(void);
|
||||||
|
void reap_inc(void);
|
||||||
|
void event_loop(struct iscsi_ipc *ipc, int control_fd, int mgmt_ipc_fd);
|
||||||
|
-void event_loop_exit(void);
|
||||||
|
+void event_loop_exit(struct queue_task *qtask);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i.base/usr/mgmt_ipc.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/mgmt_ipc.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i.base/usr/mgmt_ipc.c 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/mgmt_ipc.c 2010-05-19 03:24:33.000000000 -0500
|
||||||
|
@@ -74,7 +74,7 @@ mgmt_ipc_listen(void)
|
||||||
|
void
|
||||||
|
mgmt_ipc_close(int fd)
|
||||||
|
{
|
||||||
|
- event_loop_exit();
|
||||||
|
+ event_loop_exit(NULL);
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
@@ -190,8 +190,7 @@ mgmt_ipc_conn_add(queue_task_t *qtask)
|
||||||
|
static mgmt_ipc_err_e
|
||||||
|
mgmt_ipc_immediate_stop(queue_task_t *qtask)
|
||||||
|
{
|
||||||
|
- event_loop_exit();
|
||||||
|
- mgmt_ipc_write_rsp(qtask, MGMT_IPC_OK);
|
||||||
|
+ event_loop_exit(qtask);
|
||||||
|
return MGMT_IPC_OK;
|
||||||
|
}
|
||||||
|
|
49
iscsi-initiator-utils-fix-lib-sysfs-init.patch
Normal file
49
iscsi-initiator-utils-fix-lib-sysfs-init.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/libiscsi/libiscsi.c open-iscsi-2.0-872-rc1-bnx2i.work/libiscsi/libiscsi.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/libiscsi/libiscsi.c 2010-05-18 17:57:59.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/libiscsi/libiscsi.c 2010-05-18 17:58:43.000000000 -0500
|
||||||
|
@@ -40,6 +40,9 @@
|
||||||
|
|
||||||
|
#define CHECK(a) { context->error_str[0] = 0; rc = a; if (rc) goto leave; }
|
||||||
|
|
||||||
|
+/* UGLY, not thread safe :( */
|
||||||
|
+static int sysfs_initialized = 0;
|
||||||
|
+
|
||||||
|
struct libiscsi_context {
|
||||||
|
char error_str[256];
|
||||||
|
/* For get_parameter_helper() */
|
||||||
|
@@ -66,7 +69,10 @@ struct libiscsi_context *libiscsi_init(v
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
log_init("libiscsi", 1024, libiscsi_log, context);
|
||||||
|
- sysfs_init();
|
||||||
|
+ if (!sysfs_initialized) {
|
||||||
|
+ sysfs_init();
|
||||||
|
+ sysfs_initialized = 1;
|
||||||
|
+ }
|
||||||
|
increase_max_files();
|
||||||
|
if (idbm_init(NULL)) {
|
||||||
|
sysfs_cleanup();
|
||||||
|
@@ -529,6 +535,11 @@ int libiscsi_get_firmware_network_config
|
||||||
|
{
|
||||||
|
struct boot_context fw_entry;
|
||||||
|
|
||||||
|
+ if (!sysfs_initialized) {
|
||||||
|
+ sysfs_init();
|
||||||
|
+ sysfs_initialized = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
memset(config, 0, sizeof *config);
|
||||||
|
memset(&fw_entry, 0, sizeof fw_entry);
|
||||||
|
if (fw_get_entry(&fw_entry))
|
||||||
|
@@ -551,6 +562,11 @@ int libiscsi_get_firmware_initiator_name
|
||||||
|
{
|
||||||
|
struct boot_context fw_entry;
|
||||||
|
|
||||||
|
+ if (!sysfs_initialized) {
|
||||||
|
+ sysfs_init();
|
||||||
|
+ sysfs_initialized = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
memset(initiatorname, 0, LIBISCSI_VALUE_MAXLEN);
|
||||||
|
memset(&fw_entry, 0, sizeof fw_entry);
|
||||||
|
if (fw_get_entry(&fw_entry))
|
236
iscsi-initiator-utils-fix-uip-init-race.patch
Normal file
236
iscsi-initiator-utils-fix-uip-init-race.patch
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.c 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.c 2010-05-18 21:40:44.000000000 -0500
|
||||||
|
@@ -1096,6 +1096,18 @@ static void iscsi_login_timedout(void *d
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void iscsi_uio_poll_login_timedout(void *data)
|
||||||
|
+{
|
||||||
|
+ struct queue_task *qtask = data;
|
||||||
|
+ struct iscsi_conn *conn = qtask->conn;
|
||||||
|
+ iscsi_session_t *session = conn->session;
|
||||||
|
+
|
||||||
|
+ log_debug(3, "timeout waiting for UIO ...\n");
|
||||||
|
+ mgmt_ipc_write_rsp(qtask, MGMT_IPC_ERR_TRANS_TIMEOUT);
|
||||||
|
+ conn_delete_timers(conn);
|
||||||
|
+ __session_destroy(session);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void iscsi_login_redirect(iscsi_conn_t *conn)
|
||||||
|
{
|
||||||
|
iscsi_session_t *session = conn->session;
|
||||||
|
@@ -2049,6 +2061,52 @@ cleanup:
|
||||||
|
session_conn_shutdown(conn, qtask, err);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void session_conn_uio_poll(void *data)
|
||||||
|
+{
|
||||||
|
+ struct iscsi_conn_context *conn_context = data;
|
||||||
|
+ iscsi_conn_t *conn = conn_context->conn;
|
||||||
|
+ struct iscsi_session *session = conn->session;
|
||||||
|
+ queue_task_t *qtask = conn_context->data;
|
||||||
|
+ int rc;
|
||||||
|
+
|
||||||
|
+ log_debug(4, "retrying uio poll");
|
||||||
|
+ rc = __set_net_config(session->t, session, &conn->session->nrec.iface);
|
||||||
|
+ if (rc != 0) {
|
||||||
|
+ if (rc == -EAGAIN) {
|
||||||
|
+ conn_context->data = qtask;
|
||||||
|
+ iscsi_sched_conn_context(conn_context, conn, 2,
|
||||||
|
+ EV_UIO_POLL);
|
||||||
|
+ return;
|
||||||
|
+ } else {
|
||||||
|
+ log_error("session_conn_uio_poll() "
|
||||||
|
+ "connection failure [0x%x]", rc);
|
||||||
|
+ actor_delete(&conn->login_timer);
|
||||||
|
+ iscsi_login_eh(conn, qtask, MGMT_IPC_ERR_INTERNAL);
|
||||||
|
+ iscsi_conn_context_put(conn_context);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ iscsi_conn_context_put(conn_context);
|
||||||
|
+
|
||||||
|
+ actor_delete(&conn->login_timer);
|
||||||
|
+ log_debug(4, "UIO ready trying connect");
|
||||||
|
+
|
||||||
|
+ /* uIP is ready try to connect */
|
||||||
|
+ if (gettimeofday(&conn->initial_connect_time, NULL))
|
||||||
|
+ log_error("Could not get initial connect time. If "
|
||||||
|
+ "login errors iscsid may give up the initial "
|
||||||
|
+ "login early. You should manually login.");
|
||||||
|
+
|
||||||
|
+ conn->state = STATE_XPT_WAIT;
|
||||||
|
+ if (iscsi_conn_connect(conn, qtask)) {
|
||||||
|
+ int delay = ISCSI_CONN_ERR_REOPEN_DELAY;
|
||||||
|
+ log_debug(4, "Waiting %u seconds before trying to reconnect.\n",
|
||||||
|
+ delay);
|
||||||
|
+ queue_delayed_reopen(qtask, delay);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
void iscsi_sched_conn_context(struct iscsi_conn_context *conn_context,
|
||||||
|
struct iscsi_conn *conn, unsigned long tmo,
|
||||||
|
int event)
|
||||||
|
@@ -2085,6 +2143,11 @@ void iscsi_sched_conn_context(struct isc
|
||||||
|
conn_context);
|
||||||
|
actor_schedule(&conn_context->actor);
|
||||||
|
break;
|
||||||
|
+ case EV_UIO_POLL:
|
||||||
|
+ actor_new(&conn_context->actor, session_conn_uio_poll,
|
||||||
|
+ conn_context);
|
||||||
|
+ actor_schedule(&conn_context->actor);
|
||||||
|
+ break;
|
||||||
|
case EV_CONN_LOGOUT_TIMER:
|
||||||
|
actor_timer(&conn_context->actor, tmo * 1000,
|
||||||
|
iscsi_logout_timedout, conn_context);
|
||||||
|
@@ -2150,8 +2213,10 @@ static int session_is_running(node_rec_t
|
||||||
|
}
|
||||||
|
|
||||||
|
static int iface_set_param(struct iscsi_transport *t, struct iface_rec *iface,
|
||||||
|
- struct iscsi_session *session)
|
||||||
|
+ queue_task_t *qtask)
|
||||||
|
{
|
||||||
|
+ struct iscsi_conn *conn = qtask->conn;
|
||||||
|
+ struct iscsi_session *session = conn->session;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
log_debug(3, "setting iface %s, dev %s, set ip %s, hw %s, "
|
||||||
|
@@ -2170,6 +2235,29 @@ static int iface_set_param(struct iscsi_
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = __set_net_config(t, session, iface);
|
||||||
|
+ if (rc == -EAGAIN && t->template->set_net_config) {
|
||||||
|
+ struct iscsi_conn_context *conn_context;
|
||||||
|
+
|
||||||
|
+ conn_context = iscsi_conn_context_get(conn, 0);
|
||||||
|
+ if (!conn_context) {
|
||||||
|
+ /* while reopening the recv pool should be full */
|
||||||
|
+ log_error("BUG: __session_conn_reopen could "
|
||||||
|
+ "not get conn context for recv.");
|
||||||
|
+ return ENOMEM;
|
||||||
|
+ }
|
||||||
|
+ conn_context->data = qtask;
|
||||||
|
+ conn->state = STATE_XPT_WAIT;
|
||||||
|
+
|
||||||
|
+ iscsi_sched_conn_context(conn_context, conn, 0, EV_UIO_POLL);
|
||||||
|
+
|
||||||
|
+ log_debug(3, "Setting login UIO poll timer "
|
||||||
|
+ "%p timeout %d", &conn->login_timer,
|
||||||
|
+ conn->login_timeout);
|
||||||
|
+ actor_timer(&conn->login_timer, conn->login_timeout * 1000,
|
||||||
|
+ iscsi_uio_poll_login_timedout, qtask);
|
||||||
|
+
|
||||||
|
+ return EAGAIN;
|
||||||
|
+ }
|
||||||
|
if (rc != 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
@@ -2203,6 +2291,7 @@ session_login_task(node_rec_t *rec, queu
|
||||||
|
iscsi_session_t *session;
|
||||||
|
iscsi_conn_t *conn;
|
||||||
|
struct iscsi_transport *t;
|
||||||
|
+ int rc;
|
||||||
|
|
||||||
|
if (session_is_running(rec))
|
||||||
|
return MGMT_IPC_ERR_EXISTS;
|
||||||
|
@@ -2276,7 +2365,16 @@ session_login_task(node_rec_t *rec, queu
|
||||||
|
conn = &session->conn[0];
|
||||||
|
qtask->conn = conn;
|
||||||
|
|
||||||
|
- if (iface_set_param(t, &rec->iface, session)) {
|
||||||
|
+ rc = iface_set_param(t, &rec->iface, qtask);
|
||||||
|
+ if (rc == EAGAIN) {
|
||||||
|
+ /*
|
||||||
|
+ * Cannot block iscsid, so caller is going to internally
|
||||||
|
+ * retry the operation.
|
||||||
|
+ */
|
||||||
|
+ qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
|
||||||
|
+ qtask->rsp.err = MGMT_IPC_OK;
|
||||||
|
+ return MGMT_IPC_OK;
|
||||||
|
+ } else if (rc) {
|
||||||
|
__session_destroy(session);
|
||||||
|
return MGMT_IPC_ERR_LOGIN_FAILURE;
|
||||||
|
}
|
||||||
|
Only in open-iscsi-2.0-872-rc1-bnx2i.work/usr/: initiator.c.orig
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.h open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.h
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/initiator.h 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/initiator.h 2010-05-18 18:13:12.000000000 -0500
|
||||||
|
@@ -88,6 +88,7 @@ typedef enum iscsi_event_e {
|
||||||
|
EV_CONN_ERROR,
|
||||||
|
EV_CONN_LOGOUT_TIMER,
|
||||||
|
EV_CONN_STOP,
|
||||||
|
+ EV_UIO_POLL,
|
||||||
|
} iscsi_event_e;
|
||||||
|
|
||||||
|
struct queue_task;
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/iscsid_req.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/iscsid_req.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/iscsid_req.c 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/iscsid_req.c 2010-05-18 21:16:21.000000000 -0500
|
||||||
|
@@ -217,6 +217,8 @@ int uip_broadcast(void *buf, size_t buf_
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ log_debug(3, "connected to uIP daemon");
|
||||||
|
+
|
||||||
|
/* Send the data to uIP */
|
||||||
|
if ((err = write(fd, buf, buf_len)) != buf_len) {
|
||||||
|
log_error("got write error (%d/%d), daemon died?",
|
||||||
|
@@ -225,6 +227,8 @@ int uip_broadcast(void *buf, size_t buf_
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ log_debug(3, "send iface config to uIP daemon");
|
||||||
|
+
|
||||||
|
/* Set the socket to a non-blocking read, this way if there are
|
||||||
|
* problems waiting for uIP, iscsid can bailout early */
|
||||||
|
flags = fcntl(fd, F_GETFL, 0);
|
||||||
|
@@ -243,8 +247,10 @@ int uip_broadcast(void *buf, size_t buf_
|
||||||
|
/* Wait for the response */
|
||||||
|
err = read(fd, &rsp, sizeof(rsp));
|
||||||
|
if (err == sizeof(rsp)) {
|
||||||
|
- log_debug(3, "Broadcasted to uIP with length: %ld\n",
|
||||||
|
- buf_len);
|
||||||
|
+ log_debug(3, "Broadcasted to uIP with length: %ld "
|
||||||
|
+ "cmd: 0x%x rsp: 0x%x\n", buf_len,
|
||||||
|
+ rsp.command, rsp.err);
|
||||||
|
+ err = 0;
|
||||||
|
break;
|
||||||
|
} else if((err == -1) && (errno == EAGAIN)) {
|
||||||
|
usleep(250000);
|
||||||
|
@@ -256,12 +262,17 @@ int uip_broadcast(void *buf, size_t buf_
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if(count == MAX_UIP_BROADCAST_READ_TRIES)
|
||||||
|
- log_error("Could not broadcast to uIP");
|
||||||
|
+ if (count == MAX_UIP_BROADCAST_READ_TRIES) {
|
||||||
|
+ log_error("Could not broadcast to uIP after %d tries",
|
||||||
|
+ count);
|
||||||
|
+ err = -EAGAIN;
|
||||||
|
+ } else if (rsp.err != ISCISD_UIP_MGMT_IPC_DEVICE_UP) {
|
||||||
|
+ log_debug(3, "Device is not ready\n");
|
||||||
|
+ err = -EAGAIN;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
-
|
||||||
|
- return 0;
|
||||||
|
+ return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
void iscsid_handle_error(mgmt_ipc_err_e err)
|
||||||
|
Only in open-iscsi-2.0-872-rc1-bnx2i.work/usr/: iscsid_req.c.orig
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/uip_mgmt_ipc.h open-iscsi-2.0-872-rc1-bnx2i.work/usr/uip_mgmt_ipc.h
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/uip_mgmt_ipc.h 2010-05-18 17:58:00.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/uip_mgmt_ipc.h 2010-05-18 18:13:12.000000000 -0500
|
||||||
|
@@ -55,6 +55,8 @@ typedef enum iscsid_uip_mgmt_ipc_err {
|
||||||
|
ISCISD_UIP_MGMT_IPC_ERR = 1,
|
||||||
|
ISCISD_UIP_MGMT_IPC_ERR_NOT_FOUND = 2,
|
||||||
|
ISCISD_UIP_MGMT_IPC_ERR_NOMEM = 3,
|
||||||
|
+ ISCISD_UIP_MGMT_IPC_DEVICE_UP = 4,
|
||||||
|
+ ISCISD_UIP_MGMT_IPC_DEVICE_INITIALIZING = 5,
|
||||||
|
} iscsid_uip_mgmt_ipc_err_e;
|
||||||
|
|
||||||
|
/* IPC Response */
|
@ -53,7 +53,7 @@ index 27b59d0..9c74117 100644
|
|||||||
+ struct iscsi_transport *t;
|
+ struct iscsi_transport *t;
|
||||||
+ uint32_t hostno;
|
+ uint32_t hostno;
|
||||||
+
|
+
|
||||||
+ if (sscanf(context->scsi_host_name, "iscsi_host%u", &hostno) != 1) {
|
+ if (sscanf(context->scsi_host_name, "iscsi_boot%u", &hostno) != 1) {
|
||||||
+ log_error("Could not parse %s's host no.",
|
+ log_error("Could not parse %s's host no.",
|
||||||
+ context->scsi_host_name);
|
+ context->scsi_host_name);
|
||||||
+ return 0;
|
+ return 0;
|
||||||
@ -251,7 +251,7 @@ index 0000000..9b73d1a
|
|||||||
+#define IBFT_SUBSYS "ibft"
|
+#define IBFT_SUBSYS "ibft"
|
||||||
+
|
+
|
||||||
+#define ISCSI_LLD_ROOT "/sys/firmware/"
|
+#define ISCSI_LLD_ROOT "/sys/firmware/"
|
||||||
+#define ISCSI_LLD_SUBSYS_PREFIX "iscsi_host"
|
+#define ISCSI_LLD_SUBSYS_PREFIX "iscsi_boot"
|
||||||
+
|
+
|
||||||
+static char *target_list[ISCSI_BOOT_MAX];
|
+static char *target_list[ISCSI_BOOT_MAX];
|
||||||
+static char *nic_list[ISCSI_BOOT_MAX];
|
+static char *nic_list[ISCSI_BOOT_MAX];
|
||||||
|
127
iscsi-initiator-utils-log-info.patch
Normal file
127
iscsi-initiator-utils-log-info.patch
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/log.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/log.c 2010-05-06 15:26:01.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.c 2010-05-06 15:51:47.000000000 -0500
|
||||||
|
@@ -281,10 +281,15 @@ void log_do_log_daemon(int prio, void *p
|
||||||
|
|
||||||
|
void log_do_log_stderr(int prio, void *priv, const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
- fprintf(stderr, "%s: ", log_name);
|
||||||
|
- vfprintf(stderr, fmt, ap);
|
||||||
|
- fprintf(stderr, "\n");
|
||||||
|
- fflush(stderr);
|
||||||
|
+ if (prio == LOG_INFO) {
|
||||||
|
+ vfprintf(stdout, fmt, ap);
|
||||||
|
+ fprintf(stdout, "\n");
|
||||||
|
+ } else {
|
||||||
|
+ fprintf(stderr, "%s: ", log_name);
|
||||||
|
+ vfprintf(stderr, fmt, ap);
|
||||||
|
+ fprintf(stderr, "\n");
|
||||||
|
+ fflush(stderr);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_warning(const char *fmt, ...)
|
||||||
|
@@ -313,6 +318,14 @@ void log_debug(int level, const char *fm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void log_info(const char *fmt, ...)
|
||||||
|
+{
|
||||||
|
+ va_list ap;
|
||||||
|
+ va_start(ap, fmt);
|
||||||
|
+ log_func(LOG_INFO, log_func_priv, fmt, ap);
|
||||||
|
+ va_end(ap);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void __dump_line(int level, unsigned char *buf, int *cp)
|
||||||
|
{
|
||||||
|
char line[16*3+5], *lp = line;
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/log.h open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.h
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/log.h 2010-05-06 15:26:01.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/log.h 2010-05-06 15:39:58.000000000 -0500
|
||||||
|
@@ -71,6 +71,8 @@ extern int log_init(char *program_name,
|
||||||
|
void *priv);
|
||||||
|
extern void log_close (pid_t pid);
|
||||||
|
extern void dump_logmsg (void *);
|
||||||
|
+extern void log_info(const char *fmt, ...)
|
||||||
|
+ __attribute__ ((format (printf, 1, 2)));
|
||||||
|
extern void log_warning(const char *fmt, ...)
|
||||||
|
__attribute__ ((format (printf, 1, 2)));
|
||||||
|
extern void log_error(const char *fmt, ...)
|
||||||
|
diff -aurp open-iscsi-2.0-872-rc1-bnx2i/usr/session_mgmt.c open-iscsi-2.0-872-rc1-bnx2i.work/usr/session_mgmt.c
|
||||||
|
--- open-iscsi-2.0-872-rc1-bnx2i/usr/session_mgmt.c 2010-05-06 15:26:01.000000000 -0500
|
||||||
|
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/session_mgmt.c 2010-05-06 15:43:28.000000000 -0500
|
||||||
|
@@ -42,10 +42,10 @@ static void log_login_msg(struct node_re
|
||||||
|
rec->conn[0].port);
|
||||||
|
iscsid_handle_error(rc);
|
||||||
|
} else
|
||||||
|
- log_warning("Login to [iface: %s, target: %s, portal: "
|
||||||
|
- "%s,%d] successful.", rec->iface.name,
|
||||||
|
- rec->name, rec->conn[0].address,
|
||||||
|
- rec->conn[0].port);
|
||||||
|
+ log_info("Login to [iface: %s, target: %s, portal: "
|
||||||
|
+ "%s,%d] successful.", rec->iface.name,
|
||||||
|
+ rec->name, rec->conn[0].address,
|
||||||
|
+ rec->conn[0].port);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct iscsid_async_req {
|
||||||
|
@@ -100,15 +100,15 @@ int iscsi_login_portal(void *data, struc
|
||||||
|
struct iscsid_async_req *async_req = NULL;
|
||||||
|
int rc = 0, fd;
|
||||||
|
|
||||||
|
- log_warning("Logging in to [iface: %s, target: %s, portal: %s,%d]",
|
||||||
|
- rec->iface.name, rec->name, rec->conn[0].address,
|
||||||
|
- rec->conn[0].port);
|
||||||
|
+ log_info("Logging in to [iface: %s, target: %s, portal: %s,%d]",
|
||||||
|
+ rec->iface.name, rec->name, rec->conn[0].address,
|
||||||
|
+ rec->conn[0].port);
|
||||||
|
|
||||||
|
if (list) {
|
||||||
|
async_req = calloc(1, sizeof(*async_req));
|
||||||
|
if (!async_req)
|
||||||
|
- log_error("Could not allocate memory for async login "
|
||||||
|
- "handling. Using sequential login instead.");
|
||||||
|
+ log_info("Could not allocate memory for async login "
|
||||||
|
+ "handling. Using sequential login instead.");
|
||||||
|
else
|
||||||
|
INIT_LIST_HEAD(&async_req->list);
|
||||||
|
}
|
||||||
|
@@ -215,10 +215,10 @@ static void log_logout_msg(struct sessio
|
||||||
|
info->persistent_address, info->port);
|
||||||
|
iscsid_handle_error(rc);
|
||||||
|
} else
|
||||||
|
- log_warning("Logout of [sid: %d, target: %s, "
|
||||||
|
- "portal: %s,%d] successful.",
|
||||||
|
- info->sid, info->targetname,
|
||||||
|
- info->persistent_address, info->port);
|
||||||
|
+ log_info("Logout of [sid: %d, target: %s, "
|
||||||
|
+ "portal: %s,%d] successful.",
|
||||||
|
+ info->sid, info->targetname,
|
||||||
|
+ info->persistent_address, info->port);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int iscsid_logout_reqs_wait(struct list_head *list)
|
||||||
|
@@ -252,16 +252,16 @@ int iscsi_logout_portal(struct session_i
|
||||||
|
int fd, rc;
|
||||||
|
|
||||||
|
/* TODO: add fn to add session prefix info like dev_printk */
|
||||||
|
- log_warning("Logging out of session [sid: %d, target: %s, portal: "
|
||||||
|
- "%s,%d]",
|
||||||
|
- info->sid, info->targetname, info->persistent_address,
|
||||||
|
- info->port);
|
||||||
|
+ log_info("Logging out of session [sid: %d, target: %s, portal: "
|
||||||
|
+ "%s,%d]",
|
||||||
|
+ info->sid, info->targetname, info->persistent_address,
|
||||||
|
+ info->port);
|
||||||
|
|
||||||
|
if (list) {
|
||||||
|
async_req = calloc(1, sizeof(*async_req));
|
||||||
|
if (!async_req)
|
||||||
|
- log_error("Could not allocate memory for async logout "
|
||||||
|
- "handling. Using sequential logout instead.");
|
||||||
|
+ log_info("Could not allocate memory for async logout "
|
||||||
|
+ "handling. Using sequential logout instead.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!async_req)
|
@ -3,7 +3,7 @@
|
|||||||
Summary: iSCSI daemon and utility programs
|
Summary: iSCSI daemon and utility programs
|
||||||
Name: iscsi-initiator-utils
|
Name: iscsi-initiator-utils
|
||||||
Version: 6.2.0.872
|
Version: 6.2.0.872
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc1-bnx2i.tar.gz
|
Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc1-bnx2i.tar.gz
|
||||||
Source1: iscsid.init
|
Source1: iscsid.init
|
||||||
Source2: iscsidevs.init
|
Source2: iscsidevs.init
|
||||||
@ -26,6 +26,15 @@ Patch6: iscsi-initiator-utils-disable-isns-for-lib.patch
|
|||||||
Patch7: iscsi-initiator-utils-fix-zero-MaxXmitDataSegmentLength.patch
|
Patch7: iscsi-initiator-utils-fix-zero-MaxXmitDataSegmentLength.patch
|
||||||
# fix initial r2t handling for be2iscsi
|
# fix initial r2t handling for be2iscsi
|
||||||
Patch8: iscsi-initiator-utils-be2iscsi-fix-init-r2t.patch
|
Patch8: iscsi-initiator-utils-be2iscsi-fix-init-r2t.patch
|
||||||
|
# do not send informational msgs to stderr
|
||||||
|
Patch9: iscsi-initiator-utils-log-info.patch
|
||||||
|
# fix libiscsi get firmware sysfs init
|
||||||
|
Patch10: iscsi-initiator-utils-fix-lib-sysfs-init.patch
|
||||||
|
# fix race between uip and iscsid startup
|
||||||
|
Patch11: iscsi-initiator-utils-fix-uip-init-race.patch
|
||||||
|
# Fix discovery daemon iscsid shutdown
|
||||||
|
Patch12: iscsi-initiator-utils-fix-dd-stop.patch
|
||||||
|
|
||||||
|
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
@ -61,7 +70,10 @@ developing applications that use %{name}.
|
|||||||
%patch6 -p1 -b .disable-isns-for-lib
|
%patch6 -p1 -b .disable-isns-for-lib
|
||||||
%patch7 -p1 -b .fix-zero-MaxXmitDataSegmentLength
|
%patch7 -p1 -b .fix-zero-MaxXmitDataSegmentLength
|
||||||
%patch8 -p1 -b .be2iscsi-fix-init-r2t
|
%patch8 -p1 -b .be2iscsi-fix-init-r2t
|
||||||
|
%patch9 -p1 -b .log-info
|
||||||
|
%patch10 -p1 -b .fix-lib-sysfs-init
|
||||||
|
%patch11 -p1 -b .fix-uip-init-race
|
||||||
|
%patch12 -p1 -b .fix-dd-stop
|
||||||
|
|
||||||
%build
|
%build
|
||||||
cd utils/open-isns
|
cd utils/open-isns
|
||||||
@ -75,7 +87,7 @@ make OPTFLAGS="%{optflags}" -C utils
|
|||||||
make OPTFLAGS="%{optflags}" -C libiscsi
|
make OPTFLAGS="%{optflags}" -C libiscsi
|
||||||
|
|
||||||
cd brcm_iscsi_uio
|
cd brcm_iscsi_uio
|
||||||
./configure
|
./configure --enable-debug
|
||||||
make OPTFLAGS="%{optflags}"
|
make OPTFLAGS="%{optflags}"
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
@ -180,6 +192,17 @@ fi
|
|||||||
%{_includedir}/libiscsi.h
|
%{_includedir}/libiscsi.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 18 2010 Mike Christie <mchristi@redhat.com> 6.2.0.872.4
|
||||||
|
- 590580 libiscsi get_firmware_foo does not work without first creating a
|
||||||
|
libiscsi context
|
||||||
|
- 588931 Fix uip and iscsid initialization race
|
||||||
|
- 570664 Add basic vlan support for bnx2i's brcm uip daemon
|
||||||
|
- 589761 Fix multiple init script bugs: rh_status does not detect offload,
|
||||||
|
start/stop does not work due to iscsiadm output being directed to stderr,
|
||||||
|
discovery daemon does not get auto started/stopped, iscsid restart does
|
||||||
|
not restart daemon if force-start was used.
|
||||||
|
- 585649 Fix iscsid "-eq: unary operator expected" bug.
|
||||||
|
|
||||||
* Wed May 5 2010 Mike Christie <mchristi@redhat.com> 6.2.0.872.3
|
* Wed May 5 2010 Mike Christie <mchristi@redhat.com> 6.2.0.872.3
|
||||||
- 578455 Fix initial R2T=0 handling for be2iscsi
|
- 578455 Fix initial R2T=0 handling for be2iscsi
|
||||||
|
|
||||||
|
44
iscsid.init
44
iscsid.init
@ -48,13 +48,22 @@ force_start() {
|
|||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use_discoveryd() {
|
||||||
|
if [ -z "grep "discovery.daemon" $config | sed '/^ *#/d'" ] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
[ -x $exec ] || exit 5
|
[ -x $exec ] || exit 5
|
||||||
[ -f $config ] || exit 6
|
[ -f $config ] || exit 6
|
||||||
|
|
||||||
# only start if nodes are setup to startup automatically or root is iscsi
|
# only start if nodes are setup to startup automatically, root is iscsi,
|
||||||
|
# or if iscsid is managing the sessions.
|
||||||
grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes
|
grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes
|
||||||
if [ $? -eq 0 ] || root_is_iscsi; then
|
if [ $? -eq 0 ] || root_is_iscsi || use_discoveryd ; then
|
||||||
force_start
|
force_start
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
@ -63,7 +72,11 @@ start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser") )
|
if use_discoveryd ; then
|
||||||
|
iscsiadm -k 0 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser|bnx2i|cxgb3i|be2iscsi") )
|
||||||
if [[ -n "${iparams[*]}" ]]; then
|
if [[ -n "${iparams[*]}" ]]; then
|
||||||
# We have active sessions, so don't stop iscsid!!
|
# We have active sessions, so don't stop iscsid!!
|
||||||
echo -n $"Not stopping $prog: iscsi sessions still active"
|
echo -n $"Not stopping $prog: iscsi sessions still active"
|
||||||
@ -74,7 +87,7 @@ stop() {
|
|||||||
|
|
||||||
echo -n $"Stopping $prog: "
|
echo -n $"Stopping $prog: "
|
||||||
|
|
||||||
iscsiadm -k 0
|
iscsiadm -k 0 2>/dev/null
|
||||||
echo
|
echo
|
||||||
|
|
||||||
killproc brcm_iscsiuio
|
killproc brcm_iscsiuio
|
||||||
@ -91,13 +104,25 @@ stop() {
|
|||||||
modprobe -r ib_iser 2>/dev/null
|
modprobe -r ib_iser 2>/dev/null
|
||||||
modprobe -r iscsi_tcp 2>/dev/null
|
modprobe -r iscsi_tcp 2>/dev/null
|
||||||
|
|
||||||
[ $retval -eq 0 ] && rm -f $lockfile
|
rm -f $lockfile
|
||||||
return $retval
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
rh_status_q() {
|
||||||
|
rh_status >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
|
rh_status_q
|
||||||
|
use_force_start=$?
|
||||||
|
|
||||||
stop
|
stop
|
||||||
start
|
# if iscsid was running then make sure it starts up
|
||||||
|
if [ "$use_force_start" -eq 0 ] ; then
|
||||||
|
force_start
|
||||||
|
else
|
||||||
|
start
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
@ -112,11 +137,6 @@ rh_status() {
|
|||||||
status $prog
|
status $prog
|
||||||
}
|
}
|
||||||
|
|
||||||
rh_status_q() {
|
|
||||||
rh_status >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
rh_status_q && exit 0
|
rh_status_q && exit 0
|
||||||
|
@ -98,7 +98,7 @@ force_reload() {
|
|||||||
rh_status() {
|
rh_status() {
|
||||||
[ -f $lockfile ] || return 3
|
[ -f $lockfile ] || return 3
|
||||||
|
|
||||||
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser") )
|
declare -a iparams=( $(iscsiadm -m session 2>/dev/null | egrep "tcp|iser|bnx2i|be2iscsi|cxgb3i") )
|
||||||
if [[ -z "${iparams[*]}" ]]; then
|
if [[ -z "${iparams[*]}" ]]; then
|
||||||
# no sessions
|
# no sessions
|
||||||
return 2
|
return 2
|
||||||
|
Loading…
Reference in New Issue
Block a user