Sync to open-iscsi-2.0-872-rc4

This commit is contained in:
Mike Christie 2010-07-12 19:10:19 +00:00
parent 8d34f593cd
commit 1c8eda8fed
10 changed files with 499 additions and 425 deletions

View File

@ -13,3 +13,4 @@ open-iscsi-2.0-868-test1.tar.gz
open-iscsi-2.0-870-rc1.tar.gz
open-iscsi-2.0-870.1.tar.gz
open-iscsi-2.0-872-rc1-bnx2i.tar.gz
open-iscsi-2.0-872-rc4-bnx2i.tar.gz

View File

@ -3735,261 +3735,3 @@ index 74ef948..713914f 100644
+struct iscsi_ipc *ipc;
+
#endif /* ISCSI_IPC_H */
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index df55105..1561341 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -1495,8 +1495,7 @@ main(int argc, char **argv)
umask(0177);
/* enable stdout logging */
- log_daemon = 0;
- log_init(program_name, 1024);
+ log_init(program_name, 1024, log_do_log_stderr, NULL);
sysfs_init();
optopt = 0;
diff --git a/usr/iscsid.c b/usr/iscsid.c
index fcb5eb3..8238e2b 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -57,6 +57,7 @@ static char program_name[] = "iscsid";
int control_fd, mgmt_ipc_fd;
static pid_t log_pid;
static gid_t gid;
+static int daemonize = 1;
static struct option const long_options[] = {
{"config", required_argument, NULL, 'c'},
@@ -293,7 +294,7 @@ static void iscsid_shutdown(void)
log_debug(7, "cleaned up pid %d", pid);
log_warning("iscsid shutting down.");
- if (log_daemon && log_pid >= 0) {
+ if (daemonize && log_pid >= 0) {
log_debug(1, "daemon stopping");
log_close(log_pid);
}
@@ -356,7 +357,7 @@ int main(int argc, char *argv[])
initiatorname_file = optarg;
break;
case 'f':
- log_daemon = 0;
+ daemonize = 0;
break;
case 'd':
log_level = atoi(optarg);
@@ -384,7 +385,8 @@ int main(int argc, char *argv[])
}
/* initialize logger */
- log_pid = log_init(program_name, DEFAULT_AREA_SIZE);
+ log_pid = log_init(program_name, DEFAULT_AREA_SIZE,
+ daemonize ? log_do_log_daemon : log_do_log_stderr, NULL);
if (log_pid < 0)
exit(1);
@@ -411,7 +413,7 @@ int main(int argc, char *argv[])
exit(1);
}
- if (log_daemon) {
+ if (daemonize) {
char buf[64];
int fd;
diff --git a/usr/iscsistart.c b/usr/iscsistart.c
index 94a9601..6e4c3dc 100644
--- a/usr/iscsistart.c
+++ b/usr/iscsistart.c
@@ -256,8 +256,7 @@ int main(int argc, char *argv[])
sigaction(SIGINT, &sa_new, &sa_old );
/* initialize logger */
- log_daemon = 0;
- log_init(program_name, DEFAULT_AREA_SIZE);
+ log_init(program_name, DEFAULT_AREA_SIZE, log_do_log_stderr, NULL);
sysfs_init();
if (iscsi_sysfs_check_class_version())
diff --git a/usr/log.c b/usr/log.c
index 7dd6de8..6f276c4 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -32,10 +32,11 @@
#endif
char *log_name;
-int log_daemon = 1;
int log_level = 0;
static int log_stop_daemon = 0;
+static void (*log_func)(int prio, void *priv, const char *fmt, va_list ap);
+static void *log_func_priv;
static void free_logarea (void)
{
@@ -258,40 +259,39 @@ static void log_syslog (void * buff)
syslog(msg->prio, "%s", (char *)&msg->str);
}
-static void dolog(int prio, const char *fmt, va_list ap)
+void log_do_log_daemon(int prio, void *priv, const char *fmt, va_list ap)
{
- if (log_daemon) {
- struct sembuf ops[1];
+ struct sembuf ops[1];
- ops[0].sem_num = la->ops[0].sem_num;
- ops[0].sem_flg = la->ops[0].sem_flg;
+ ops[0].sem_num = la->ops[0].sem_num;
+ ops[0].sem_flg = la->ops[0].sem_flg;
- ops[0].sem_op = -1;
- if (semop(la->semid, ops, 1) < 0) {
- syslog(LOG_ERR, "semop down failed %d", errno);
- return;
- }
+ ops[0].sem_op = -1;
+ if (semop(la->semid, ops, 1) < 0) {
+ syslog(LOG_ERR, "semop down failed %d", errno);
+ return;
+ }
- log_enqueue(prio, fmt, ap);
+ log_enqueue(prio, fmt, ap);
- ops[0].sem_op = 1;
- if (semop(la->semid, ops, 1) < 0) {
- syslog(LOG_ERR, "semop up failed");
- return;
- }
- } else {
- fprintf(stderr, "%s: ", log_name);
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
- fflush(stderr);
- }
+ ops[0].sem_op = 1;
+ if (semop(la->semid, ops, 1) < 0)
+ syslog(LOG_ERR, "semop up failed");
+}
+
+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);
}
void log_warning(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- dolog(LOG_WARNING, fmt, ap);
+ log_func(LOG_WARNING, log_func_priv, fmt, ap);
va_end(ap);
}
@@ -299,7 +299,7 @@ void log_error(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- dolog(LOG_ERR, fmt, ap);
+ log_func(LOG_ERR, log_func_priv, fmt, ap);
va_end(ap);
}
@@ -308,7 +308,7 @@ void log_debug(int level, const char *fmt, ...)
if (log_level > level) {
va_list ap;
va_start(ap, fmt);
- dolog(LOG_DEBUG, fmt, ap);
+ log_func(LOG_DEBUG, log_func_priv, fmt, ap);
va_end(ap);
}
}
@@ -389,19 +389,23 @@ static void catch_signal(int signo)
static void __log_close(void)
{
- if (log_daemon) {
+ if (log_func == log_do_log_daemon) {
log_flush();
closelog();
free_logarea();
}
}
-int log_init(char *program_name, int size)
+int log_init(char *program_name, int size,
+ void (*func)(int prio, void *priv, const char *fmt, va_list ap),
+ void *priv)
{
logdbg(stderr,"enter log_init\n");
log_name = program_name;
+ log_func = func;
+ log_func_priv = priv;
- if (log_daemon) {
+ if (log_func == log_do_log_daemon) {
struct sigaction sa_old;
struct sigaction sa_new;
pid_t pid;
@@ -447,11 +451,12 @@ int log_init(char *program_name, int size)
return 0;
}
+
void log_close(pid_t pid)
{
int status;
- if (!log_daemon || pid < 0) {
+ if (log_func != log_do_log_daemon || pid < 0) {
__log_close();
return;
}
diff --git a/usr/log.h b/usr/log.h
index 8af7986..c3b3955 100644
--- a/usr/log.h
+++ b/usr/log.h
@@ -26,6 +26,7 @@
#ifndef LOG_H
#define LOG_H
+#include <stdarg.h>
#include <sys/types.h>
#include "iscsid.h"
@@ -40,7 +41,6 @@ union semun {
#define DEFAULT_AREA_SIZE 16384
#define MAX_MSG_SIZE 256
-extern int log_daemon;
extern int log_level;
struct logmsg {
@@ -66,7 +66,9 @@ struct logarea {
struct logarea *la;
-extern int log_init (char * progname, int size);
+extern int log_init(char *program_name, int size,
+ void (*func)(int prio, void *priv, const char *fmt, va_list ap),
+ void *priv);
extern void log_close (pid_t pid);
extern void dump_logmsg (void *);
extern void log_warning(const char *fmt, ...)
@@ -76,4 +78,7 @@ extern void log_error(const char *fmt, ...)
extern void log_debug(int level, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
+extern void log_do_log_daemon(int prio, void *priv, const char *fmt, va_list ap);
+extern void log_do_log_stderr(int prio, void *priv, const char *fmt, va_list ap);
+
#endif /* LOG_H */
--
1.6.6.1

View File

@ -0,0 +1,12 @@
diff -aup open-iscsi-2.0-872-rc1-bnx2i/usr/Makefile open-iscsi-2.0-872-rc1-bnx2i.work/usr/Makefile
--- open-iscsi-2.0-872-rc1-bnx2i/usr/Makefile 2010-06-18 18:04:51.000000000 -0500
+++ open-iscsi-2.0-872-rc1-bnx2i.work/usr/Makefile 2010-06-18 18:13:33.000000000 -0500
@@ -60,7 +60,7 @@ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_
iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
iscsistart.o statics.o
- $(CC) $(CFLAGS) -static $^ -o $@
+ $(CC) $(CFLAGS) $^ -o $@
clean:
rm -f *.o $(PROGRAMS) .depend $(LIBSYS)

View 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))

View 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 */

View File

@ -1,53 +1,6 @@
From 4f85b76a1c1bd54dd4d0779c4bf7da485a80b50e Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Tue, 23 Mar 2010 19:24:09 -0500
Subject: [PATCH 3/7] Add Red Hat specific info to docs.
iscsi-initiator-utils-update-initscripts-and-docs.patch
---
README | 9 +++------
etc/iscsid.conf | 23 ++++++++++-------------
usr/idbm.c | 4 ++++
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/README b/README
index eadb385..121bd45 100644
--- a/README
+++ b/README
@@ -74,11 +74,6 @@ the cache sync command will fail.
- iscsiadm's -P 3 option will not print out scsi devices.
- iscsid will not automatically online devices.
-You need to enable "Cryptographic API" under "Cryptographic options" in the
-kernel config. And you must enable "CRC32c CRC algorithm" even if
-you do not use header or data digests. They are the kernel options,
-CONFIG_CRYPTO and CONFIG_CRYPTO_CRC32C, respectively.
-
By default the kernel source found at
/lib/modules/`uname -a`/build
will be used to compile the open-iscsi modules. To specify a different
@@ -813,7 +808,7 @@ Red Hat or Fedora:
-----------------
To start open-iscsi in Red Hat/Fedora you can do:
- service open-iscsi start
+ service iscsi start
To get open-iscsi to automatically start at run time you may have to
run:
@@ -1012,6 +1007,8 @@ To login to all the automated nodes, simply restart the iscsi service:
e.g /etc/init.d/open-iscsi restart. On your next startup the nodes will
be logged into autmotically.
+To set the startup value, so that nodes are not logged into automatically
+use the value "manual".
8. Advanced Configuration
=========================
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index 78c225c..e96833e 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/etc/iscsid.conf open-iscsi-2.0-872-rc3-bnx2i.diff/etc/iscsid.conf
--- open-iscsi-2.0-872-rc3-bnx2i/etc/iscsid.conf 2010-07-11 03:45:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/etc/iscsid.conf 2010-07-11 03:57:57.000000000 -0500
@@ -17,10 +17,10 @@
# maintainers.
#
@ -60,8 +13,8 @@ index 78c225c..e96833e 100644
+# iscsid.startup = /sbin/iscsid
@@ -110,8 +110,8 @@ iscsid.startup = /sbin/iscsid
#############################
@@ -36,8 +36,8 @@ iscsid.startup = /sbin/iscsid
# To request that the iscsi initd scripts startup a session set to "automatic".
# node.startup = automatic
#
@ -72,7 +25,7 @@ index 78c225c..e96833e 100644
# *************
@@ -329,29 +329,26 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
@@ -255,29 +255,26 @@ node.conn[0].iscsi.MaxXmitDataSegmentLen
discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
# To allow the targets to control the setting of the digest checking,
@ -108,11 +61,44 @@ index 78c225c..e96833e 100644
#************
# Workarounds
diff --git a/usr/idbm.c b/usr/idbm.c
index 1428365..8ad8024 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -324,9 +324,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff/README
--- open-iscsi-2.0-872-rc3-bnx2i/README 2010-07-11 03:45:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/README 2010-07-11 03:57:57.000000000 -0500
@@ -74,11 +74,6 @@ the cache sync command will fail.
- iscsiadm's -P 3 option will not print out scsi devices.
- iscsid will not automatically online devices.
-You need to enable "Cryptographic API" under "Cryptographic options" in the
-kernel config. And you must enable "CRC32c CRC algorithm" even if
-you do not use header or data digests. They are the kernel options,
-CONFIG_CRYPTO and CONFIG_CRYPTO_CRC32C, respectively.
-
By default the kernel source found at
/lib/modules/`uname -a`/build
will be used to compile the open-iscsi modules. To specify a different
@@ -907,7 +902,7 @@ Red Hat or Fedora:
-----------------
To start open-iscsi in Red Hat/Fedora you can do:
- service open-iscsi start
+ service iscsi start
To get open-iscsi to automatically start at run time you may have to
run:
@@ -1115,6 +1110,8 @@ iscsid will only perform rediscovery whe
# linux-isns (SLES's iSNS server) where it sometimes does not send SCN
# events in the proper format, so they may not get handled.
+To set the startup value, so that nodes are not logged into automatically
+use the value "manual".
Example:
--------
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/: README.orig
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c
--- open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c 2010-07-11 03:45:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c 2010-07-11 03:57:57.000000000 -0500
@@ -346,9 +346,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo
IDBM_SHOW, "None", "CRC32C", "CRC32C,None",
"None,CRC32C", num, 1);
sprintf(key, CONN_DATA_DIGEST, i);
@ -126,6 +112,3 @@ index 1428365..8ad8024 100644
sprintf(key, CONN_IFMARKER, i);
__recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW,
"No", "Yes", num, 1);
--
1.6.6.1

View File

@ -1,7 +1,41 @@
diff --git a/README b/README
index 121bd45..c863044 100644
--- a/README
+++ b/README
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/doc/iscsiadm.8 open-iscsi-2.0-872-rc3-bnx2i.diff/doc/iscsiadm.8
--- open-iscsi-2.0-872-rc3-bnx2i/doc/iscsiadm.8 2010-07-11 03:45:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/doc/iscsiadm.8 2010-07-11 04:00:35.000000000 -0500
@@ -51,7 +51,7 @@ display help text and exit
.TP
\fB\-I\fR, \fB\-\-interface\fI[iface]\fR
The interface argument specifies the iSCSI interface to use for the operation.
-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware
+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware
iSCSI (qla4xxx) the iface config must have the hardware address
(iface.hwaddress = port's MAC address)
and the driver/transport_name (iface.transport_name). The iface's name is
@@ -128,7 +128,7 @@ If no other options are specified: for \
of their respective records are displayed; for \fIsession\fR, all active
sessions and connections are displayed; for \fIfw\fR, all boot firmware
values are displayed; for \fIhost\fR, all iSCSI hosts are displayed; and
-for \fIiface\fR, all ifaces setup in /etc/iscsi/ifaces are displayed.
+for \fIiface\fR, all ifaces setup in /var/lib/iscsi/ifaces are displayed.
.TP
\fB\-n\fR, \fB\-\-name=\fIname\fR
@@ -336,10 +336,10 @@ The configuration file read by \fBiscsid
The file containing the iSCSI InitiatorName and InitiatorAlias read by
\fBiscsid\fR and \fBiscsiadm\fR on startup.
.TP
-/etc/iscsi/nodes/
+/var/lib/iscsi/nodes/
This directory contains the nodes with their targets.
.TP
-/etc/iscsi/send_targets
+/var/lib/iscsi/send_targets
This directory contains the portals.
.SH "SEE ALSO"
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/doc: iscsiadm.8.orig
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/README open-iscsi-2.0-872-rc3-bnx2i.diff/README
--- open-iscsi-2.0-872-rc3-bnx2i/README 2010-07-11 03:58:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/README 2010-07-11 03:59:00.000000000 -0500
@@ -144,10 +144,10 @@ available on all Linux installations.
The database contains two tables:
@ -16,7 +50,7 @@ index 121bd45..c863044 100644
The iscsiadm utility is a command-line tool to manage (update, delete,
insert, query) the persistent database.
@@ -352,7 +352,7 @@ a scsi_host per HBA port).
@@ -420,7 +420,7 @@ a scsi_host per HBA port).
To manage both types of initiator stacks, iscsiadm uses the interface (iface)
structure. For each HBA port or for software iscsi for each network
device (ethX) or NIC, that you wish to bind sessions to you must create
@ -25,7 +59,7 @@ index 121bd45..c863044 100644
Running:
@@ -360,29 +360,29 @@ Running:
@@ -428,29 +428,29 @@ Running:
iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax
iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax
@ -60,7 +94,7 @@ index 121bd45..c863044 100644
iface.transport_name = tcp
iface.hwaddress = 00:C0:DD:08:63:E7
@@ -431,7 +431,7 @@ iser iser,<empty>,<empty>,<empty>,<empty>
@@ -499,7 +499,7 @@ iser iser,<empty>,<empty>,<empty>,<empty
cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty>
@ -69,7 +103,7 @@ index 121bd45..c863044 100644
The format is:
iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname
@@ -447,7 +447,7 @@ default one in /etc/iscsi/initiatorname.iscsi.
@@ -515,7 +515,7 @@ default one in /etc/iscsi/initiatorname.
@ -78,7 +112,7 @@ index 121bd45..c863044 100644
iscsiadm -m iface -I cxgb3i.00:07:43:05:97:07
# BEGIN RECORD 2.0-871
@@ -485,7 +485,7 @@ need a seperate network connection to the target for discovery purposes.
@@ -553,7 +553,7 @@ need a seperate network connection to th
*This will be fixed in the next version of open-iscsi*
For compatibility reasons, when you run iscsiadm to do discovery, it
@ -87,25 +121,32 @@ index 121bd45..c863044 100644
tcp for the iface.transport and it will bind the portals that are discovered
so that they will be logged in through those ifaces. This behavior can also
be overriden by passing in the interfaces you want to use. For the case
@@ -503,7 +503,7 @@ we do not bind a session to a iface, then you can use the special iface
@@ -571,7 +571,7 @@ we do not bind a session to a iface, the
iscsiadm -m discovery -t st -p ip:port -I default -P 1
iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1
-And if you did not define any interfaces in /etc/iscsi/ifaces and do
+And if you did not define any interfaces in /var/lib/iscsi/ifaces and do
not pass anything into iscsiadm, running iscsiadm will do the default
behavior, where we allow the network subsystem to decide which
device to use.
@@ -543,7 +543,7 @@ To now log into targets it is the same as with sofware iscsi. See section
@@ -613,13 +613,13 @@ To now log into targets it is the same a
./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260
./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover
- This will first search /etc/iscsi/ifaces for interfaces
+ This will first search /var/lib/iscsi/ifaces for interfaces
using software iscsi. If any are found then nodes found during
discovery will be setup so that they can logged in through
those interfaces.
@@ -598,7 +598,7 @@ To now log into targets it is the same as with sofware iscsi. See section
- This will search /etc/iscsi/send_targets for a record with the
+ This will search /var/lib/iscsi/send_targets for a record with the
ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it
will perform discovery using the settings stored in the record.
If a record does not exist, it will be created using the iscsid.conf
discovery settings.
- For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for
+ For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for
interfaces using software iscsi. If any are found then nodes found
during discovery will be setup so that they can logged in through
those interfaces. To specify a specific iface, pass the
@@ -675,7 +675,7 @@ To now log into targets it is the same a
This command will perform discovery, but not manipulate the node DB.
- SendTargets iSCSI Discovery with a specific interface. If you
@ -113,8 +154,8 @@ index 121bd45..c863044 100644
+ wish to only use a subset of the interfaces in /var/lib/iscsi/ifaces
then you can pass them in during discovery:
./iscsiadm -m discovery -t sendtargets -p 192.168.1.1:3260 \
@@ -911,8 +911,8 @@ where targetname is the name of the target and ip_address:port is the address
./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \
@@ -982,8 +982,8 @@ where targetname is the name of the targ
and port of the portal. tpgt, is the portal group tag of
the portal, and is not used in iscsiadm commands except for static
record creation. And iface name is the name of the iscsi interface
@ -125,37 +166,20 @@ index 121bd45..c863044 100644
Default here is iscsi_tcp/tcp to be used over which ever NIC the
network layer decides is best.
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index b2bad47..6f1bac9 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -49,7 +49,7 @@ display help text and exit
.TP
\fB\-I\fR, \fB\-\-interface\fI[iface]\fR
The interface argument specifies the iSCSI interface to use for the operation.
-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware
+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware
iSCSI (qla4xxx) the iface config must have the hardware address
(iface.hwaddress = port's MAC address)
and the driver/transport_name (iface.transport_name). The iface's name is
@@ -318,10 +318,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup.
The file containing the iSCSI InitiatorName and InitiatorAlias read by
\fBiscsid\fR and \fBiscsiadm\fR on startup.
.TP
-/etc/iscsi/nodes/
+/var/lib/iscsi/nodes/
This directory contains the nodes with their targets.
.TP
-/etc/iscsi/send_targets
+/var/lib/iscsi/send_targets
This directory contains the portals.
@@ -1098,7 +1098,7 @@ If set, iscsid will perform discovery to
discovery.isns.discoveryd_poll_inval or
discovery.sendtargets.discoveryd_poll_inval seconds,
and it will log into any portals found from the discovery source using
-the ifaces in /etc/iscsi/ifaces.
+the ifaces in /var/lib/iscsi/ifaces.
.SH "SEE ALSO"
diff --git a/usr/idbm.c b/usr/idbm.c
index 8ad8024..f5694f3 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2078,9 +2078,9 @@ free_info:
Note that for iSNS the poll_interval does not have to be set. If not set,
iscsid will only perform rediscovery when it gets a SCN from the server.
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/: README.orig
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c
--- open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.c 2010-07-11 03:58:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.c 2010-07-11 03:59:00.000000000 -0500
@@ -2235,9 +2235,9 @@ free_info:
int idbm_init(idbm_get_config_file_fn *fn)
{
/* make sure root db dir is there */
@ -168,10 +192,10 @@ index 8ad8024..f5694f3 100644
errno);
return errno;
}
diff --git a/usr/idbm.h b/usr/idbm.h
index 57b9295..44cb976 100644
--- a/usr/idbm.h
+++ b/usr/idbm.h
Only in open-iscsi-2.0-872-rc3-bnx2i.diff/usr: idbm.c.orig
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.h open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.h
--- open-iscsi-2.0-872-rc3-bnx2i/usr/idbm.h 2010-07-11 03:45:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/idbm.h 2010-07-11 03:59:00.000000000 -0500
@@ -27,12 +27,15 @@
#include "initiator.h"
#include "config.h"
@ -192,12 +216,11 @@ index 57b9295..44cb976 100644
+#define FW_CONFIG_DIR ISCSIVAR"fw"
+
#define ST_CONFIG_NAME "st_config"
#define ISNS_CONFIG_NAME "isns_config"
#define TYPE_INT 0
diff --git a/usr/iface.h b/usr/iface.h
index 9f6d47e..f7624ea 100644
--- a/usr/iface.h
+++ b/usr/iface.h
diff -aurp open-iscsi-2.0-872-rc3-bnx2i/usr/iface.h open-iscsi-2.0-872-rc3-bnx2i.diff/usr/iface.h
--- open-iscsi-2.0-872-rc3-bnx2i/usr/iface.h 2010-07-11 03:45:50.000000000 -0500
+++ open-iscsi-2.0-872-rc3-bnx2i.diff/usr/iface.h 2010-07-11 03:59:00.000000000 -0500
@@ -20,7 +20,9 @@
#ifndef ISCSI_IFACE_H
#define ISCSI_IFACE_H
@ -209,6 +232,3 @@ index 9f6d47e..f7624ea 100644
struct iface_rec;
struct list_head;
--
1.6.6.1

View File

@ -3,33 +3,30 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.2.0.872
Release: 6%{?dist}
Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc1-bnx2i.tar.gz
Release: 7%{?dist}
Source0: http://people.redhat.com/mchristi/iscsi/rhel6.0/source/open-iscsi-2.0-872-rc4-bnx2i.tar.gz
Source1: iscsid.init
Source2: iscsidevs.init
Source3: 04-iscsi
# fw boot support
Patch0: iscsi-initiator-utils-fw-boot.patch
# Add Red Hat specific info to docs.
Patch1: iscsi-initiator-utils-update-initscripts-and-docs.patch
Patch0: iscsi-initiator-utils-update-initscripts-and-docs.patch
# Upstream uses /etc/iscsi for iscsi db info, but use /var/lib/iscsi.
Patch2: iscsi-initiator-utils-use-var-for-config.patch
Patch1: iscsi-initiator-utils-use-var-for-config.patch
# Add redhat.com string to default initiator name.
Patch3: iscsi-initiator-utils-use-red-hat-for-name.patch
Patch2: iscsi-initiator-utils-use-red-hat-for-name.patch
# Add a lib for use by anaconda.
Patch4: iscsi-initiator-utils-add-libiscsi.patch
Patch3: iscsi-initiator-utils-add-libiscsi.patch
# Add bnx2i support.
Patch5: iscsi-initiator-utils-uip-mgmt.patch
Patch4: iscsi-initiator-utils-uip-mgmt.patch
# disable isns for libiscsi (libiscsi does not support isns)
Patch6: iscsi-initiator-utils-disable-isns-for-lib.patch
# fix MaxXmitDataSegmentLength=0 handling
Patch7: iscsi-initiator-utils-fix-zero-MaxXmitDataSegmentLength.patch
# fix initial r2t handling for be2iscsi
Patch8: iscsi-initiator-utils-be2iscsi-fix-init-r2t.patch
# do not send informational msgs to stderr
Patch9: iscsi-initiator-utils-log-info.patch
# Fix iscsiadm non default port handling
Patch10: iscsi-initiator-utils-fix-non-def-port.patch
Patch5: iscsi-initiator-utils-disable-isns-for-lib.patch
# fix libiscsi get firmware sysfs init
Patch6: iscsi-initiator-utils-fix-lib-sysfs-init.patch
# fix race between uip and iscsid startup
Patch7: iscsi-initiator-utils-fix-uip-init-race.patch
# Don't compile iscsistart as static
Patch8: iscsi-initiator-utils-dont-use-static.patch
Group: System Environment/Daemons
License: GPLv2+
@ -57,18 +54,16 @@ The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q -n open-iscsi-2.0-872-rc1-bnx2i
%patch0 -p1 -b .fw-boot
%patch1 -p1 -b .update-initscripts-and-docs
%patch2 -p1 -b .use-var-for-config
%patch3 -p1 -b .use-red-hat-for-name
%patch4 -p1 -b .add-libiscsi
%patch5 -p1 -b .uip-mgmt
%patch6 -p1 -b .disable-isns-for-lib
%patch7 -p1 -b .fix-zero-MaxXmitDataSegmentLength
%patch8 -p1 -b .be2iscsi-fix-init-r2t
%patch9 -p1 -b .log-info
%patch10 -p1 -b .fix-non-def-port
%setup -q -n open-iscsi-2.0-872-rc4-bnx2i
%patch0 -p1 -b .update-initscripts-and-docs
%patch1 -p1 -b .use-var-for-config
%patch2 -p1 -b .use-red-hat-for-name
%patch3 -p1 -b .add-libiscsi
%patch4 -p1 -b .uip-mgmt
%patch5 -p1 -b .disable-isns-for-lib
%patch6 -p1 -b .fix-lib-sysfs-init
%patch7 -p1 -b .fix-uip-init-race
%patch8 -p1 -b .dont-use-static
%build
cd utils/open-isns
@ -181,6 +176,12 @@ fi
%{_includedir}/libiscsi.h
%changelog
* Fri Jul 12 2010 Mike Christie <mchristi@redhat.com> 6.2.0.872.7
- Sync to upstream open-iscsi-2.0-872-rc4 which fixes:
iscsiadm discovery port handling, add discoveryd init script
support, move from iscsid.conf to discovery db discoveryd settings,
and add discoverydb mode support.
* Thu Jun 10 2010 Mike Christie <mchristi@redhat.com> 6.2.0.872.6
- Fix last patch.

View File

@ -38,6 +38,7 @@ force_start() {
modprobe -q iscsi_tcp
modprobe -q ib_iser
modprobe -q cxgb3i
modprobe -q bnx2i
modprobe -q be2iscsi
daemon $prog
retval=$?
@ -46,13 +47,28 @@ force_start() {
return $retval
}
use_discoveryd() {
grep -qrs "discovery.sendtargets.use_discoveryd = Yes" /var/lib/iscsi/send_targets
if [ $? -eq 0 ] ; then
return 0
fi
grep -qrs "discovery.isns.use_discoveryd = Yes" /var/lib/iscsi/isns
if [ $? -eq 0 ] ; then
return 0
fi
return 1
}
start() {
[ -x $exec ] || exit 5
[ -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
if [ $? -eq 0 ] || root_is_iscsi; then
if [ $? -eq 0 ] || root_is_iscsi || use_discoveryd ; then
force_start
return $?
fi
@ -61,6 +77,10 @@ start() {
}
stop() {
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
# We have active sessions, so don't stop iscsid!!
@ -71,11 +91,14 @@ stop() {
fi
echo -n $"Stopping $prog: "
killproc $prog
retval=$?
iscsiadm -k 0 2>/dev/null
echo
# only remove the iscsi drivers when offload is used
rmmod bnx2i 2>/dev/null
rmmod cnic 2>/dev/null
rmmod cxgb3i 2>/dev/null
modprobe -r be2iscsi 2>/dev/null
@ -83,13 +106,25 @@ stop() {
modprobe -r ib_iser 2>/dev/null
modprobe -r iscsi_tcp 2>/dev/null
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
rm -f $lockfile
return 0
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
restart() {
rh_status_q
use_force_start=$?
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() {
@ -104,11 +139,6 @@ rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0

View File

@ -1 +1 @@
05e667ff053169d7e8a620a517448cb7 open-iscsi-2.0-872-rc1-bnx2i.tar.gz
fdc3d1fd718a6f5e4281db84c993a5e2 open-iscsi-2.0-872-rc4-bnx2i.tar.gz