Accepting request 183504 from network

- moved the open-iscsi branch to the SLES 11 SP3 codebase
  (bnc#821695). See open-iscsi.changes for details.
  - went to 2.0.873 package code base, with SUSE patches (forwarded request 183487 from lee_duncan)

OBS-URL: https://build.opensuse.org/request/show/183504
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/open-iscsi?expand=0&rev=31
This commit is contained in:
Stephan Kulow 2013-07-18 14:07:20 +00:00 committed by Git OBS Bridge
commit 79fbcc12ec
44 changed files with 399 additions and 5059 deletions

1
Week Normal file
View File

@ -0,0 +1 @@
Date: Wed Jul 3 10:03:03 PDT 2013 = Number: 26

View File

@ -1,73 +0,0 @@
#!/bin/bash
#
# /sbin/iscsi-gen-initiatorname
#
# Generate a default iSCSI Initiatorname for SUSE installations.
#
# Copyright (c) 2007 Hannes Reinecke, SUSE Linux Products GmbH.
# All rights reserved.
#
if [ "$1" ] ; then
if [ "$1" = "-f" ] ; then
FORCE=1
else
echo "Invalid option $1"
echo "Usage: $0 [-f]"
exit 1
fi
fi
if [ -d /sys/firmware/ibft/initiator ] ; then
read iSCSI_INITIATOR_NAME < /sys/firmware/ibft/initiator/initiator-name
fi
if [ -f /etc/iscsi/initiatorname.iscsi -a -z "$FORCE" ] ; then
if [ "$iSCSI_INITIATOR_NAME" ] ; then
eval $(cat /etc/iscsi/initiatorname.iscsi | sed -e '/^#/d')
if [ "$iSCSI_INITIATOR_NAME" != "$InitiatorName" ] ; then
echo "iSCSI Initiatorname from iBFT is different from the current setting."
echo "Please call '/sbin/iscsi-gen-initiatorname -f' to update the iSCSI Initiatorname."
exit 1
fi
fi
fi
if [ "$iSCSI_INITIATOR_NAME" ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
##
## /etc/iscsi/iscsi.initiatorname
##
## iSCSI Initiatorname taken from iBFT BIOS tables.
##
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## Any change here will not be reflected to the iBFT BIOS tables.
## If a different initiatorname is required please change the
## initiatorname in the BIOS setup and call
## /sbin/iscsi-gen-initiatorname -f
## to recreate an updated version of this file.
##
InitiatorName=$iSCSI_INITIATOR_NAME
EOF
fi
if [ ! -f /etc/iscsi/initiatorname.iscsi ] ; then
cat << EOF >> /etc/iscsi/initiatorname.iscsi
##
## /etc/iscsi/iscsi.initiatorname
##
## Default iSCSI Initiatorname.
##
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator. The InitiatorName must be unique
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
EOF
ISSUEDATE="1996-04"
INAME=$(/sbin/iscsi-iname -p iqn.$ISSUEDATE.de.suse:01)
printf "InitiatorName=$INAME\n" >>/etc/iscsi/initiatorname.iscsi
chmod 0600 /etc/iscsi/initiatorname.iscsi
fi

View File

@ -1,13 +0,0 @@
Index: usr/Makefile
===================================================================
--- usr/Makefile.orig 2009-06-21 14:30:01.000000000 +0200
+++ usr/Makefile 2009-06-21 14:31:23.000000000 +0200
@@ -54,7 +54,7 @@ iscsiadm: $(COMMON_SRCS) $(FW_BOOT_SRCS)
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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:881b0ea5209f1617cad0a1126c93e33c837075ebed01fa0219d36dd368c475c0
size 237601

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc08b65149c201044f39cb473fd2f0dadf7bbe8dbb03b80b19521b2e0f3689ea
size 684474

View File

@ -1,86 +0,0 @@
commit 71257059d29236aab14135774dde88c769b0b7ce
Author: Doron Shoham <dorons@voltaire.com>
Date: Tue Sep 9 14:09:47 2008 +0300
log.c: add error messages when allocation shared memory
add error messages when trying to allocate shared memory
for the log area.
Signed-off-by: Doron Shoham <dorons@voltaire.com>
diff --git a/usr/log.c b/usr/log.c
index 013caed..4351456 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -71,11 +71,14 @@ static int logarea_init (int size)
logdbg(stderr,"enter logarea_init\n");
if ((shmid = shmget(IPC_PRIVATE, sizeof(struct logarea),
- 0644 | IPC_CREAT | IPC_EXCL)) == -1)
+ 0644 | IPC_CREAT | IPC_EXCL)) == -1) {
+ syslog(LOG_ERR, "shmget logarea failed %d", errno);
return 1;
+ }
la = shmat(shmid, NULL, 0);
if (!la) {
+ syslog(LOG_ERR, "shmat logarea failed %d", errno);
shmctl(shmid, IPC_RMID, NULL);
return 1;
}
@@ -89,6 +92,7 @@ static int logarea_init (int size)
if ((shmid = shmget(IPC_PRIVATE, size,
0644 | IPC_CREAT | IPC_EXCL)) == -1) {
+ syslog(LOG_ERR, "shmget msg failed %d", errno);
free_logarea();
return 1;
}
@@ -96,6 +100,7 @@ static int logarea_init (int size)
la->start = shmat(la->shmid_msg, NULL, 0);
if (!la->start) {
+ syslog(LOG_ERR, "shmat msg failed %d", errno);
free_logarea();
return 1;
}
@@ -108,22 +113,26 @@ static int logarea_init (int size)
if ((shmid = shmget(IPC_PRIVATE, MAX_MSG_SIZE + sizeof(struct logmsg),
0644 | IPC_CREAT | IPC_EXCL)) == -1) {
+ syslog(LOG_ERR, "shmget logmsg failed %d", errno);
free_logarea();
return 1;
}
la->buff = shmat(shmid, NULL, 0);
if (!la->buff) {
+ syslog(LOG_ERR, "shmat logmsgfailed %d", errno);
free_logarea();
return 1;
}
if ((la->semid = semget(SEMKEY, 1, 0600 | IPC_CREAT)) < 0) {
+ syslog(LOG_ERR, "semget failed %d", errno);
free_logarea();
return 1;
}
la->semarg.val=1;
if (semctl(la->semid, 0, SETVAL, la->semarg) < 0) {
+ syslog(LOG_ERR, "semctl failed %d", errno);
free_logarea();
return 1;
}
@@ -390,8 +399,10 @@ int log_init(char *program_name, int size)
openlog(log_name, 0, LOG_DAEMON);
setlogmask (LOG_UPTO (LOG_DEBUG));
- if (logarea_init(size))
+ if (logarea_init(size)) {
+ syslog(LOG_ERR, "logarea init failed");
return -1;
+ }
pid = fork();
if (pid < 0) {

View File

@ -1,201 +0,0 @@
---
etc/mkinitrd/mkinitrd-boot.sh | 95 +++++++++++++++++++++++++++++++++++++++++
etc/mkinitrd/mkinitrd-setup.sh | 70 ++++++++++++++++++++++++++++++
etc/mkinitrd/mkinitrd-stop.sh | 21 +++++++++
3 files changed, 186 insertions(+)
--- /dev/null
+++ b/etc/mkinitrd/mkinitrd-boot.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+#%stage: device
+#%depends: network
+#%programs: /sbin/iscsid /sbin/iscsiadm
+#%modules: iscsi_tcp crc32c scsi_transport_iscsi
+#%if: "$root_iscsi" -o "$TargetAddress"
+#
+##### iSCSI initialization
+##
+## This script initializes iSCSI (SCSI over IP).
+## To be able to use this script, the network has to be setup.
+## When everything worked as expected, the iSCSI devices will show
+## up as real SCSI devices.
+##
+## Command line parameters
+## -----------------------
+##
+## TargetAddress the address of the iscsi server
+## TargetPort the port of the iscsi server (defaults to 3260)
+## TargetName the iscsi target name (connect to all if empty)
+## iSCSI_ignoreNodes if set all stored nodes will be ignored (only
+## iBFT and commandline nodes get parsed)
+##
+
+### iSCSI_warning_InitiatorName <new InitiatorName> <Origin>
+# shows a warning about iSCSI InitiatorName differences
+# Origin should be something like "commandline" or "iBFT"
+iSCSI_warning_InitiatorName() {
+ echo "iSCSI: WARNING"
+ echo "iSCSI: ======================="
+ echo "iSCSI: "
+ echo "iSCSI: InitiatorName given on $2 and internally stored Initiator are different."
+ echo "iSCSI: New: $tmp_InitiatorName"
+ echo "iSCSI: Stored: $InitiatorName"
+ echo "iSCSI: "
+ echo "iSCSI: using the $2 version"
+}
+
+if [ "$iSCSI_ignoreNodes" ]; then
+ # make us forget we have to initialize stored nodes
+ echo "iSCSI: removing node information..."
+ iscsi_sessions=
+ rm -rf /etc/iscsi/nodes
+ mkdir /etc/iscsi/nodes
+fi
+
+# get the command line InitiatorName
+tmp_InitiatorName="$(get_param InitiatorName)"
+# reads the InitiatorName variable
+. /etc/iscsi/initiatorname.iscsi
+
+# Check of iBFT settings
+if [ -d /sys/firmware/ibft/initiator ] ; then
+ # only use the iBFT InitiatorName if the commandline argument is not "default"
+ read iSCSI_INITIATOR_NAME < /sys/firmware/ibft/initiator
+ if [ "$iSCSI_INITIATOR_NAME" -a "$tmp_InitiatorName" != "default" ] ; then
+ iSCSI_warning_InitiatorName "$iSCSI_INITIATOR_NAME" "iBFT"
+ InitiatorName=$iSCSI_INITIATOR_NAME
+ fi
+fi
+
+if [ "$tmp_InitiatorName" != "$InitiatorName" -a "$tmp_InitiatorName" != "default" -a "$tmp_InitiatorName" ]; then
+ iSCSI_warning_InitiatorName "$tmp_InitiatorName" "cmdline"
+ InitiatorName=$tmp_InitiatorName
+fi
+
+# store the detected InitiatorName permanently
+echo "InitiatorName=$InitiatorName" > /etc/iscsi/initiatorname.iscsi
+
+unset iSCSI_warning_InitiatorName
+
+load_modules
+
+echo "Starting iSCSI daemon"
+/sbin/iscsid -n
+
+# log into iBFT nodes
+/sbin/iscsiadm -m fw -l
+
+# Check for command line sessions
+if [ -n "$TargetAddress" -a -n "$TargetName" ] ; then
+
+ # try to detect and connect to the iscsi server
+ echo -n "Starting discovery on ${TargetAddress},${TargetName}: "
+ if /sbin/iscsiadm -m discovery -t st -p ${TargetAddress}:${TargetPort} 2> /dev/null ; then
+ echo "ok."
+ else
+ echo "failed."
+ fi
+ # Mark this node as 'onboot'
+ /sbin/iscsiadm -m node -p $TargetAddress:$TargetPort -T $TargetName -o update -n node.conn[0].startup -v onboot
+fi
+
+# Activate all 'onboot' sessions
+/sbin/iscsiadm -m node -L onboot
--- /dev/null
+++ b/etc/mkinitrd/mkinitrd-setup.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+#%stage: device
+#
+check_iscsi_root() {
+ local devname=$1
+ local sysfs_path
+
+ sysfs_path=$(/sbin/udevadm info -q path -n $devname 2> /dev/null)
+ if [ -z "$sysfs_path" ] || [ ! -d /sys$sysfs_path ] ; then
+ return;
+ fi
+
+ pushd /sys$sysfs_path > /dev/null
+ if [ ! -d device ] ; then
+ cd ..
+ fi
+
+ if [ ! -d device ] ; then
+ # no device link; return
+ popd > /dev/null
+ return;
+ fi
+
+ cd -P device
+ cd ../..
+
+ if [ -d connection* ]; then
+ cd -P connection*
+ cid=${PWD#*connection}
+ sid=${cid%%:*}
+ if [ -d /sys/class/iscsi_session/session$sid ]; then
+ cd -P /sys/class/iscsi_session/session$sid
+ echo $(basename $PWD)
+ fi
+ fi
+ popd > /dev/null
+}
+
+for bd in $blockdev; do
+ update_blockdev $bd
+ sid=$(check_iscsi_root $bd)
+ if [ "$sid" ]; then
+ root_iscsi=1
+ iscsi_sessions="$iscsi_sessions ${sid#session}"
+ fi
+done
+
+save_var root_iscsi
+save_var iscsi_sessions
+
+if [ "${root_iscsi}" ]; then
+ for session in $iscsi_sessions; do
+ eval TargetName${session}=$(cat /sys/class/iscsi_session/session${session}/targetname)
+ eval TargetAddress${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/address)
+ eval TargetPort${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/port)
+
+ save_var TargetName${session}
+ save_var TargetAddress${session}
+ save_var TargetPort${session}
+ done
+ # copy the iscsi configuration
+ cp -rp /etc/iscsi etc/
+ if [ -z "$interface" ] ; then
+ interface="default"
+ fi
+fi
+
+save_var TargetPort 3260 # in case the port was not defined via command line we assign a default port
+
--- /dev/null
+++ b/etc/mkinitrd/mkinitrd-stop.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+#%stage: setup
+#%provides: killprogs
+#
+#%if: "$root_iscsi"
+#%dontshow
+#
+##### kill iscsi
+##
+## Because we will run and use the iSCSI daemon from the new root
+## the old one has to be killed. During that time no iSCSI
+## exceptions should occur!
+##
+## Command line parameters
+## -----------------------
+##
+
+# kill iscsid, will be restarted from the real root
+iscsi_pid=$(pidof iscsid)
+[ "$iscsi_pid" ] && kill -TERM $iscsi_pid

View File

@ -1,110 +0,0 @@
From 5140d7e924ffc6495cff383685e7ae016da0de22 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Fri, 15 Aug 2008 21:14:04 -0500
Subject: [PATCH] Add compat patch for RHEL 5.2
from Erez Zilber
The 2.6.14-19_compat.patch checks the kernel version. However,
the RHEL 5.2 kernel includes code that does not exist in the
vanilla kernel. This causes symbol redefinition.
Signed-off-by: Erez Zilber <erezzi.list@gmail.com>
---
kernel/2.6.14-19_compat.patch | 41 +++++++++++++++++++++++++++++++++++++----
1 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/kernel/2.6.14-19_compat.patch b/kernel/2.6.14-19_compat.patch
index 8a00ad4..2835b35 100644
--- a/kernel/2.6.14-19_compat.patch
+++ b/kernel/2.6.14-19_compat.patch
@@ -311,10 +311,10 @@ index cfc5fa6..ede08ef 100644
struct scsi_device;
diff --git a/open_iscsi_compat.h b/open_iscsi_compat.h
new file mode 100644
-index 0000000..7ea4643
+index 0000000..ecd48df
--- /dev/null
+++ b/open_iscsi_compat.h
-@@ -0,0 +1,270 @@
+@@ -0,0 +1,303 @@
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <scsi/scsi.h>
@@ -468,12 +468,21 @@ index 0000000..7ea4643
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
-+
++#ifdef RHEL_RELEASE_VERSION
++#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2)
++static inline int is_power_of_2(unsigned long n)
++{
++ return (n != 0 && ((n & (n - 1)) == 0));
++}
++#endif
++#else
++/* not a redhat kernel */
+static inline int is_power_of_2(unsigned long n)
+{
+ return (n != 0 && ((n & (n - 1)) == 0));
+}
+#endif
++#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,21)
+
@@ -485,11 +494,20 @@ index 0000000..7ea4643
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)
-+
++#ifdef RHEL_RELEASE_VERSION
++#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2)
++static inline void *shost_priv(struct Scsi_Host *shost)
++{
++ return (void *)shost->hostdata;
++}
++#endif
++#else
++/* not a redhat kernel */
+static inline void *shost_priv(struct Scsi_Host *shost)
+{
+ return (void *)shost->hostdata;
+}
++#endif
+
+/*
+ * Note: We do not support bidi for the compat modules if the kernel
@@ -499,6 +517,20 @@ index 0000000..7ea4643
+#define scsi_sglist(cmd) ((struct scatterlist *)(cmd)->request_buffer)
+#define scsi_bufflen(cmd) ((cmd)->request_bufflen)
+
++#ifdef RHEL_RELEASE_VERSION
++#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,2)
++static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
++{
++ cmd->resid = resid;
++}
++
++static inline int scsi_get_resid(struct scsi_cmnd *cmd)
++{
++ return cmd->resid;
++}
++#endif
++#else
++/* not a redhat kernel */
+static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
+{
+ cmd->resid = resid;
@@ -508,6 +540,7 @@ index 0000000..7ea4643
+{
+ return cmd->resid;
+}
++#endif
+
+#endif
+
--
1.5.2.4

View File

@ -1,969 +0,0 @@
From ac7c5a688f81c01065e7545313c909dc20d2837b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 31 Jul 2008 11:31:15 +0200
Subject: [PATCH] Add SLES10 SP2 compat
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Hi Mike,
due to popular demand I've cranked together a SLES10 SP2 compat
patch. You'll have to build it with
make KSRC=/usr/src/linux KBUILD_OUTPUT=/usr/src/linux-obj/<arch>/<flavour>
Can you add it to the git tree?
Thanks,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to open-iscsi+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---
commit 97dc544d90e98ef399640010a9a019bcaaa6bf4f
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Jul 31 11:19:58 2008 +0200
Compat patch for SLES10 SP2
In SLES10 SP2 we've updated the SCSI stack to match 2.6.21 more closely.
Hence we need our own compat patch to deal with this.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
kernel/2.6.16-suse.patch | 864 ++++++++++++++++++++++++++++++++++++++++++++++
kernel/Makefile | 19 +
2 files changed, 883 insertions(+), 0 deletions(-)
create mode 100644 kernel/2.6.16-suse.patch
Index: open-iscsi-2.0-870-rc1/kernel/2.6.16-suse.patch
===================================================================
--- /dev/null
+++ open-iscsi-2.0-870-rc1/kernel/2.6.16-suse.patch
@@ -0,0 +1,864 @@
+diff --git a/iscsi_tcp.c b/iscsi_tcp.c
+index 908b541..dfd8e31 100644
+--- a/iscsi_tcp.c
++++ b/iscsi_tcp.c
+@@ -426,6 +426,17 @@ iscsi_segment_seek_sg(struct iscsi_segment *segment,
+
+ debug_scsi("iscsi_segment_seek_sg offset %u size %llu\n",
+ offset, size);
++
++ /*
++ * older kernels could send use_sg=0 for commands like sgio
++ * or scsi-ml commands.
++ */
++ if (!sg_count) {
++ iscsi_segment_init_linear(segment, (void *)sg_list + offset,
++ size, done, hash);
++ return 0;
++ }
++
+ __iscsi_segment_init(segment, size, done, hash);
+ for_each_sg(sg_list, sg, sg_count, i) {
+ debug_scsi("sg %d, len %u offset %u\n", i, sg->length,
+@@ -536,7 +547,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
+ struct iscsi_session *session = conn->session;
+ struct scsi_cmnd *sc = task->sc;
+ int datasn = be32_to_cpu(rhdr->datasn);
+- unsigned total_in_length = scsi_in(sc)->length;
++ unsigned total_in_length = scsi_bufflen(sc);
+
+ iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr);
+ if (tcp_conn->in.datalen == 0)
+@@ -568,7 +579,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
+ if (res_count > 0 &&
+ (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW ||
+ res_count <= total_in_length))
+- scsi_in(sc)->resid = res_count;
++ scsi_set_resid(sc, res_count);
+ else
+ sc->result = (DID_BAD_TARGET << 16) |
+ rhdr->cmd_status;
+@@ -679,11 +690,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task)
+ r2t->data_length, session->max_burst);
+
+ r2t->data_offset = be32_to_cpu(rhdr->data_offset);
+- if (r2t->data_offset + r2t->data_length > scsi_out(task->sc)->length) {
++ if (r2t->data_offset + r2t->data_length > scsi_bufflen(task->sc)) {
+ iscsi_conn_printk(KERN_ERR, conn,
+ "invalid R2T with data len %u at offset %u "
+ "and total length %d\n", r2t->data_length,
+- r2t->data_offset, scsi_out(task->sc)->length);
++ r2t->data_offset, scsi_bufflen(task->sc));
+ __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t,
+ sizeof(void*));
+ return ISCSI_ERR_DATALEN;
+@@ -783,7 +794,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
+ if (tcp_conn->in.datalen) {
+ struct iscsi_tcp_task *tcp_task = task->dd_data;
+ struct hash_desc *rx_hash = NULL;
+- struct scsi_data_buffer *sdb = scsi_in(task->sc);
+
+ /*
+ * Setup copy of Data-In into the Scsi_Cmnd
+@@ -801,8 +811,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
+ tcp_task->data_offset,
+ tcp_conn->in.datalen);
+ rc = iscsi_segment_seek_sg(&tcp_conn->in.segment,
+- sdb->table.sgl,
+- sdb->table.nents,
++ scsi_sglist(task->sc),
++ scsi_sg_count(task->sc),
+ tcp_task->data_offset,
+ tcp_conn->in.datalen,
+ iscsi_tcp_process_data_in,
+@@ -1369,8 +1379,8 @@ iscsi_tcp_task_init(struct iscsi_task *task)
+ return 0;
+
+ /* If we have immediate data, attach a payload */
+- err = iscsi_tcp_send_data_prep(conn, scsi_out(sc)->table.sgl,
+- scsi_out(sc)->table.nents,
++ err = iscsi_tcp_send_data_prep(conn, scsi_sglist(sc),
++ scsi_sg_count(sc),
+ 0, task->imm_count);
+ if (err)
+ return err;
+@@ -1393,7 +1403,6 @@ iscsi_tcp_task_xmit(struct iscsi_task *task)
+ struct iscsi_conn *conn = task->conn;
+ struct iscsi_tcp_task *tcp_task = task->dd_data;
+ struct scsi_cmnd *sc = task->sc;
+- struct scsi_data_buffer *sdb;
+ int rc = 0;
+
+ flush:
+@@ -1413,7 +1422,6 @@ flush:
+ if (sc->sc_data_direction != DMA_TO_DEVICE)
+ return 0;
+
+- sdb = scsi_out(sc);
+ if (task->unsol_count != 0) {
+ struct iscsi_data *hdr = &tcp_task->unsol_dtask.hdr;
+
+@@ -1428,8 +1436,8 @@ flush:
+ task->itt, tcp_task->sent, task->data_count);
+
+ iscsi_tcp_send_hdr_prep(conn, hdr, sizeof(*hdr));
+- rc = iscsi_tcp_send_data_prep(conn, sdb->table.sgl,
+- sdb->table.nents, tcp_task->sent,
++ rc = iscsi_tcp_send_data_prep(conn, scsi_sglist(sc),
++ scsi_sg_count(sc), tcp_task->sent,
+ task->data_count);
+ if (rc)
+ goto fail;
+@@ -1475,8 +1483,8 @@ flush:
+ iscsi_tcp_send_hdr_prep(conn, &r2t->dtask.hdr,
+ sizeof(struct iscsi_hdr));
+
+- rc = iscsi_tcp_send_data_prep(conn, sdb->table.sgl,
+- sdb->table.nents,
++ rc = iscsi_tcp_send_data_prep(conn, scsi_sglist(sc),
++ scsi_sg_count(sc),
+ r2t->data_offset + r2t->sent,
+ r2t->data_count);
+ if (rc)
+@@ -1864,7 +1872,11 @@ iscsi_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max,
+ shost->max_lun = iscsi_max_lun;
+ shost->max_id = 0;
+ shost->max_channel = 0;
++#ifndef SCSI_MAX_VARLEN_CDB_SIZE
++ shost->max_cmd_len = 16;
++#else
+ shost->max_cmd_len = SCSI_MAX_VARLEN_CDB_SIZE;
++#endif
+
+ if (iscsi_host_add(shost, NULL))
+ goto free_host;
+@@ -1917,6 +1929,9 @@ static int iscsi_tcp_slave_configure(struct scsi_device *sdev)
+ }
+
+ static struct scsi_host_template iscsi_sht = {
++#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,24)
++ .use_sg_chaining = ENABLE_SG_CHAINING,
++#endif
+ .module = THIS_MODULE,
+ .name = "iSCSI Initiator over TCP/IP",
+ .queuecommand = iscsi_queuecommand,
+diff --git a/iscsi_tcp.h b/iscsi_tcp.h
+index 68423e8..1796c96 100644
+--- a/iscsi_tcp.h
++++ b/iscsi_tcp.h
+@@ -24,6 +24,8 @@
+
+ #include "libiscsi.h"
+
++#include "open_iscsi_compat.h"
++
+ struct crypto_hash;
+ struct socket;
+ struct iscsi_tcp_conn;
+diff --git a/libiscsi.c b/libiscsi.c
+index dfeaed3..0fb0705 100644
+--- a/libiscsi.c
++++ b/libiscsi.c
+@@ -24,7 +24,10 @@
+ #include <linux/types.h>
+ #include <linux/kfifo.h>
+ #include <linux/delay.h>
++#include <linux/version.h>
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
+ #include <linux/log2.h>
++#endif
+ #include <asm/unaligned.h>
+ #include <net/tcp.h>
+ #include <scsi/scsi_cmnd.h>
+@@ -187,7 +190,7 @@ static int iscsi_prep_bidi_ahs(struct iscsi_task *task)
+ sizeof(rlen_ahdr->reserved));
+ rlen_ahdr->ahstype = ISCSI_AHSTYPE_RLENGTH;
+ rlen_ahdr->reserved = 0;
+- rlen_ahdr->read_length = cpu_to_be32(scsi_in(sc)->length);
++ rlen_ahdr->read_length = cpu_to_be32(scsi_bufflen(sc));
+
+ debug_scsi("bidi-in rlen_ahdr->read_length(%d) "
+ "rlen_ahdr->ahslength(%d)\n",
+@@ -242,7 +245,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
+ return rc;
+ }
+ if (sc->sc_data_direction == DMA_TO_DEVICE) {
+- unsigned out_len = scsi_out(sc)->length;
++ unsigned out_len = scsi_bufflen(sc);
+ hdr->data_length = cpu_to_be32(out_len);
+ hdr->flags |= ISCSI_FLAG_CMD_WRITE;
+ /*
+@@ -286,7 +289,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
+ } else {
+ hdr->flags |= ISCSI_FLAG_CMD_FINAL;
+ zero_data(hdr->dlength);
+- hdr->data_length = cpu_to_be32(scsi_in(sc)->length);
++ hdr->data_length = cpu_to_be32(scsi_bufflen(sc));
+
+ if (sc->sc_data_direction == DMA_FROM_DEVICE)
+ hdr->flags |= ISCSI_FLAG_CMD_READ;
+@@ -314,7 +317,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
+ "bidirectional" : sc->sc_data_direction == DMA_TO_DEVICE ?
+ "write" : "read", conn->id, sc, sc->cmnd[0], task->itt,
+ scsi_bufflen(sc),
+- scsi_bidi_cmnd(sc) ? scsi_in(sc)->length : 0,
++ scsi_bidi_cmnd(sc) ? scsi_bufflen(sc) : 0,
+ session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1);
+ return 0;
+ }
+@@ -412,12 +415,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task,
+ return;
+
+ sc->result = err;
+- if (!scsi_bidi_cmnd(sc))
+- scsi_set_resid(sc, scsi_bufflen(sc));
+- else {
+- scsi_out(sc)->resid = scsi_out(sc)->length;
+- scsi_in(sc)->resid = scsi_in(sc)->length;
+- }
++ scsi_set_resid(sc, scsi_bufflen(sc));
+
+ if (conn->task == task)
+ conn->task = NULL;
+@@ -592,7 +590,7 @@ invalid_datalen:
+ goto out;
+ }
+
+- senselen = get_unaligned_be16(data);
++ senselen = be16_to_cpu(get_unaligned((__be16 *) data));
+ if (datalen < senselen)
+ goto invalid_datalen;
+
+@@ -608,8 +606,8 @@ invalid_datalen:
+
+ if (scsi_bidi_cmnd(sc) && res_count > 0 &&
+ (rhdr->flags & ISCSI_FLAG_CMD_BIDI_OVERFLOW ||
+- res_count <= scsi_in(sc)->length))
+- scsi_in(sc)->resid = res_count;
++ res_count <= scsi_bufflen(sc)))
++ scsi_set_resid(sc, res_count);
+ else
+ sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status;
+ }
+@@ -1127,10 +1125,9 @@ again:
+ return rc;
+ }
+
+-static void iscsi_xmitworker(struct work_struct *work)
++static void iscsi_xmitworker(void *data)
+ {
+- struct iscsi_conn *conn =
+- container_of(work, struct iscsi_conn, xmitwork);
++ struct iscsi_conn *conn = data;
+ int rc;
+ /*
+ * serialize Xmit worker on a per-connection basis.
+@@ -1273,12 +1270,7 @@ reject:
+ fault:
+ spin_unlock(&session->lock);
+ debug_scsi("iscsi: cmd 0x%x is not queued (%d)\n", sc->cmnd[0], reason);
+- if (!scsi_bidi_cmnd(sc))
+- scsi_set_resid(sc, scsi_bufflen(sc));
+- else {
+- scsi_out(sc)->resid = scsi_out(sc)->length;
+- scsi_in(sc)->resid = scsi_in(sc)->length;
+- }
++ scsi_set_resid(sc, scsi_bufflen(sc));
+ done(sc);
+ spin_lock(host->host_lock);
+ return 0;
+@@ -2099,7 +2091,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size,
+ INIT_LIST_HEAD(&conn->mgmtqueue);
+ INIT_LIST_HEAD(&conn->xmitqueue);
+ INIT_LIST_HEAD(&conn->requeue);
+- INIT_WORK(&conn->xmitwork, iscsi_xmitworker);
++ INIT_WORK(&conn->xmitwork, iscsi_xmitworker, conn);
+
+ /* allocate login_task used for the login/text sequences */
+ spin_lock_bh(&session->lock);
+diff --git a/libiscsi.h b/libiscsi.h
+index cfc5fa6..64508d8 100644
+--- a/libiscsi.h
++++ b/libiscsi.h
+@@ -32,6 +32,8 @@
+ #include "iscsi_proto.h"
+ #include "iscsi_if.h"
+
++#include "open_iscsi_compat.h"
++
+ struct scsi_transport_template;
+ struct scsi_host_template;
+ struct scsi_device;
+diff --git a/scsi_transport_iscsi.c b/scsi_transport_iscsi.c
+index 535e461..1ae65fb 100644
+--- a/scsi_transport_iscsi.c
++++ b/scsi_transport_iscsi.c
+@@ -41,13 +41,13 @@ struct iscsi_internal {
+ struct scsi_transport_template t;
+ struct iscsi_transport *iscsi_transport;
+ struct list_head list;
+- struct device dev;
++ struct class_device cdev;
+
+- struct device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1];
++ struct class_device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1];
+ struct transport_container conn_cont;
+- struct device_attribute *conn_attrs[ISCSI_CONN_ATTRS + 1];
++ struct class_device_attribute *conn_attrs[ISCSI_CONN_ATTRS + 1];
+ struct transport_container session_cont;
+- struct device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1];
++ struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1];
+ };
+
+ static atomic_t iscsi_session_nr; /* sysfs session id for next new session */
+@@ -64,12 +64,12 @@ static DEFINE_SPINLOCK(iscsi_transport_lock);
+ #define to_iscsi_internal(tmpl) \
+ container_of(tmpl, struct iscsi_internal, t)
+
+-#define dev_to_iscsi_internal(_dev) \
+- container_of(_dev, struct iscsi_internal, dev)
++#define cdev_to_iscsi_internal(_cdev) \
++ container_of(_cdev, struct iscsi_internal, cdev)
+
+-static void iscsi_transport_release(struct device *dev)
++static void iscsi_transport_release(struct class_device *cdev)
+ {
+- struct iscsi_internal *priv = dev_to_iscsi_internal(dev);
++ struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev);
+ kfree(priv);
+ }
+
+@@ -79,33 +79,31 @@ static void iscsi_transport_release(struct device *dev)
+ */
+ static struct class iscsi_transport_class = {
+ .name = "iscsi_transport",
+- .dev_release = iscsi_transport_release,
++ .release = iscsi_transport_release,
+ };
+
+ static ssize_t
+-show_transport_handle(struct device *dev, struct device_attribute *attr,
+- char *buf)
++show_transport_handle(struct class_device *cdev, char *buf)
+ {
+- struct iscsi_internal *priv = dev_to_iscsi_internal(dev);
++ struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev);
+ return sprintf(buf, "%llu\n", (unsigned long long)iscsi_handle(priv->iscsi_transport));
+ }
+-static DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL);
++static CLASS_DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL);
+
+ #define show_transport_attr(name, format) \
+ static ssize_t \
+-show_transport_##name(struct device *dev, \
+- struct device_attribute *attr,char *buf) \
++show_transport_##name(struct class_device *cdev, char *buf) \
+ { \
+- struct iscsi_internal *priv = dev_to_iscsi_internal(dev); \
++ struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev); \
+ return sprintf(buf, format"\n", priv->iscsi_transport->name); \
+ } \
+-static DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL);
++static CLASS_DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL);
+
+ show_transport_attr(caps, "0x%x");
+
+ static struct attribute *iscsi_transport_attrs[] = {
+- &dev_attr_handle.attr,
+- &dev_attr_caps.attr,
++ &class_device_attr_handle.attr,
++ &class_device_attr_caps.attr,
+ NULL,
+ };
+
+@@ -113,6 +111,7 @@ static struct attribute_group iscsi_transport_group = {
+ .attrs = iscsi_transport_attrs,
+ };
+
++#if 0
+ /*
+ * iSCSI endpoint attrs
+ */
+@@ -229,9 +228,10 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle)
+ return iscsi_dev_to_endpoint(dev);
+ }
+ EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint);
++#endif
+
+ static int iscsi_setup_host(struct transport_container *tc, struct device *dev,
+- struct device *cdev)
++ struct class_device *cdev)
+ {
+ struct Scsi_Host *shost = dev_to_shost(dev);
+ struct iscsi_cls_host *ihost = shost->shost_data;
+@@ -250,7 +250,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev,
+ }
+
+ static int iscsi_remove_host(struct transport_container *tc, struct device *dev,
+- struct device *cdev)
++ struct class_device *cdev)
+ {
+ struct Scsi_Host *shost = dev_to_shost(dev);
+ struct iscsi_cls_host *ihost = shost->shost_data;
+@@ -490,10 +490,9 @@ static int iscsi_user_scan(struct Scsi_Host *shost, uint channel,
+ iscsi_user_scan_session);
+ }
+
+-static void iscsi_scan_session(struct work_struct *work)
++static void iscsi_scan_session(void *data)
+ {
+- struct iscsi_cls_session *session =
+- container_of(work, struct iscsi_cls_session, scan_work);
++ struct iscsi_cls_session *session = data;
+ struct Scsi_Host *shost = iscsi_session_to_shost(session);
+ struct iscsi_cls_host *ihost = shost->shost_data;
+ struct iscsi_scan_data scan_data;
+@@ -506,11 +505,9 @@ static void iscsi_scan_session(struct work_struct *work)
+ atomic_dec(&ihost->nr_scans);
+ }
+
+-static void session_recovery_timedout(struct work_struct *work)
++static void session_recovery_timedout(void *data)
+ {
+- struct iscsi_cls_session *session =
+- container_of(work, struct iscsi_cls_session,
+- recovery_work.work);
++ struct iscsi_cls_session *session = data;
+ unsigned long flags;
+
+ iscsi_cls_session_printk(KERN_INFO, session,
+@@ -536,13 +533,13 @@ static void session_recovery_timedout(struct work_struct *work)
+ scsi_target_unblock(&session->dev);
+ }
+
+-static void __iscsi_unblock_session(struct work_struct *work)
++static void __iscsi_unblock_session(void *data)
+ {
+- struct iscsi_cls_session *session =
+- container_of(work, struct iscsi_cls_session,
+- unblock_work);
++ struct iscsi_cls_session *session = data;
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
+ struct Scsi_Host *shost = iscsi_session_to_shost(session);
+ struct iscsi_cls_host *ihost = shost->shost_data;
++#endif
+ unsigned long flags;
+
+ /*
+@@ -560,10 +557,12 @@ static void __iscsi_unblock_session(struct work_struct *work)
+ * the async scanning code (drivers like iscsi_tcp do login and
+ * scanning from userspace).
+ */
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
+ if (shost->hostt->scan_finished) {
+ if (queue_work(ihost->scan_workq, &session->scan_work))
+ atomic_inc(&ihost->nr_scans);
+ }
++#endif
+ }
+
+ /**
+@@ -583,11 +582,9 @@ void iscsi_unblock_session(struct iscsi_cls_session *session)
+ }
+ EXPORT_SYMBOL_GPL(iscsi_unblock_session);
+
+-static void __iscsi_block_session(struct work_struct *work)
++static void __iscsi_block_session(void *data)
+ {
+- struct iscsi_cls_session *session =
+- container_of(work, struct iscsi_cls_session,
+- block_work);
++ struct iscsi_cls_session *session = data;
+ unsigned long flags;
+
+ spin_lock_irqsave(&session->lock, flags);
+@@ -604,11 +601,9 @@ void iscsi_block_session(struct iscsi_cls_session *session)
+ }
+ EXPORT_SYMBOL_GPL(iscsi_block_session);
+
+-static void __iscsi_unbind_session(struct work_struct *work)
++static void __iscsi_unbind_session(void *data)
+ {
+- struct iscsi_cls_session *session =
+- container_of(work, struct iscsi_cls_session,
+- unbind_work);
++ struct iscsi_cls_session *session = data;
+ struct Scsi_Host *shost = iscsi_session_to_shost(session);
+ struct iscsi_cls_host *ihost = shost->shost_data;
+ unsigned long flags;
+@@ -651,12 +646,12 @@ iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport,
+ session->transport = transport;
+ session->recovery_tmo = 120;
+ session->state = ISCSI_SESSION_FREE;
+- INIT_DELAYED_WORK(&session->recovery_work, session_recovery_timedout);
++ INIT_WORK(&session->recovery_work, session_recovery_timedout, session);
+ INIT_LIST_HEAD(&session->sess_list);
+- INIT_WORK(&session->unblock_work, __iscsi_unblock_session);
+- INIT_WORK(&session->block_work, __iscsi_block_session);
+- INIT_WORK(&session->unbind_work, __iscsi_unbind_session);
+- INIT_WORK(&session->scan_work, iscsi_scan_session);
++ INIT_WORK(&session->unblock_work, __iscsi_unblock_session, session);
++ INIT_WORK(&session->block_work, __iscsi_block_session, session);
++ INIT_WORK(&session->unbind_work, __iscsi_unbind_session, session);
++ INIT_WORK(&session->scan_work, iscsi_scan_session, session);
+ spin_lock_init(&session->lock);
+
+ /* this is released in the dev's release function */
+@@ -1300,6 +1295,8 @@ static int
+ iscsi_if_transport_ep(struct iscsi_transport *transport,
+ struct iscsi_uevent *ev, int msg_type)
+ {
++ return -ENOSYS;
++#if 0
+ struct iscsi_endpoint *ep;
+ struct sockaddr *dst_addr;
+ int rc = 0;
+@@ -1340,6 +1337,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport,
+ break;
+ }
+ return rc;
++
++#endif
+ }
+
+ static int
+@@ -1421,6 +1420,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
+ ev->u.c_session.queue_depth);
+ break;
+ case ISCSI_UEVENT_CREATE_BOUND_SESSION:
++ err = -ENOSYS;
++ break;
++#if 0
+ ep = iscsi_lookup_endpoint(ev->u.c_bound_session.ep_handle);
+ if (!ep) {
+ err = -EINVAL;
+@@ -1432,6 +1434,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
+ ev->u.c_bound_session.cmds_max,
+ ev->u.c_bound_session.queue_depth);
+ break;
++#endif
+ case ISCSI_UEVENT_DESTROY_SESSION:
+ session = iscsi_session_lookup(ev->u.d_session.sid);
+ if (session)
+@@ -1514,55 +1517,70 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
+ }
+
+ /*
+- * Get message from skb. Each message is processed by iscsi_if_recv_msg.
+- * Malformed skbs with wrong lengths or invalid creds are not processed.
++ * Get message from skb (based on rtnetlink_rcv_skb). Each message is
++ * processed by iscsi_if_recv_msg. Malformed skbs with wrong lengths or
++ * invalid creds are discarded silently.
+ */
+ static void
+-iscsi_if_rx(struct sk_buff *skb)
++iscsi_if_rx(struct sock *sk, int len)
+ {
++ struct sk_buff *skb;
++
+ mutex_lock(&rx_queue_mutex);
+- while (skb->len >= NLMSG_SPACE(0)) {
+- int err;
+- uint32_t rlen;
+- struct nlmsghdr *nlh;
+- struct iscsi_uevent *ev;
+-
+- nlh = nlmsg_hdr(skb);
+- if (nlh->nlmsg_len < sizeof(*nlh) ||
+- skb->len < nlh->nlmsg_len) {
+- break;
++ while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
++ if (NETLINK_CREDS(skb)->uid) {
++ skb_pull(skb, skb->len);
++ goto free_skb;
+ }
+
+- ev = NLMSG_DATA(nlh);
+- rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+- if (rlen > skb->len)
+- rlen = skb->len;
++ while (skb->len >= NLMSG_SPACE(0)) {
++ int err;
++ uint32_t rlen;
++ struct nlmsghdr *nlh;
++ struct iscsi_uevent *ev;
+
+- err = iscsi_if_recv_msg(skb, nlh);
+- if (err) {
+- ev->type = ISCSI_KEVENT_IF_ERROR;
+- ev->iferror = err;
+- }
+- do {
+- /*
+- * special case for GET_STATS:
+- * on success - sending reply and stats from
+- * inside of if_recv_msg(),
+- * on error - fall through.
+- */
+- if (ev->type == ISCSI_UEVENT_GET_STATS && !err)
++ nlh = nlmsg_hdr(skb);
++ if (nlh->nlmsg_len < sizeof(*nlh) ||
++ skb->len < nlh->nlmsg_len) {
+ break;
+- err = iscsi_if_send_reply(
+- NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq,
+- nlh->nlmsg_type, 0, 0, ev, sizeof(*ev));
+- } while (err < 0 && err != -ECONNREFUSED);
+- skb_pull(skb, rlen);
++ }
++
++ ev = NLMSG_DATA(nlh);
++ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
++ if (rlen > skb->len)
++ rlen = skb->len;
++
++ err = iscsi_if_recv_msg(skb, nlh);
++ if (err) {
++ ev->type = ISCSI_KEVENT_IF_ERROR;
++ ev->iferror = err;
++ }
++ do {
++ /*
++ * special case for GET_STATS:
++ * on success - sending reply and stats from
++ * inside of if_recv_msg(),
++ * on error - fall through.
++ */
++ if (ev->type == ISCSI_UEVENT_GET_STATS && !err)
++ break;
++ err = iscsi_if_send_reply(
++ NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq,
++ nlh->nlmsg_type, 0, 0, ev, sizeof(*ev));
++ } while (err < 0 && err != -ECONNREFUSED);
++ skb_pull(skb, rlen);
++ }
++free_skb:
++ kfree_skb(skb);
+ }
+ mutex_unlock(&rx_queue_mutex);
+ }
+
++#define iscsi_cdev_to_conn(_cdev) \
++ iscsi_dev_to_conn(_cdev->dev)
++
+ #define ISCSI_CLASS_ATTR(_prefix,_name,_mode,_show,_store) \
+-struct device_attribute dev_attr_##_prefix##_##_name = \
++struct class_device_attribute class_device_attr_##_prefix##_##_name = \
+ __ATTR(_name,_mode,_show,_store)
+
+ /*
+@@ -1570,10 +1588,9 @@ struct device_attribute dev_attr_##_prefix##_##_name = \
+ */
+ #define iscsi_conn_attr_show(param) \
+ static ssize_t \
+-show_conn_param_##param(struct device *dev, \
+- struct device_attribute *attr, char *buf) \
++show_conn_param_##param(struct class_device *cdev, char *buf) \
+ { \
+- struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev->parent); \
++ struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \
+ struct iscsi_transport *t = conn->transport; \
+ return t->get_conn_param(conn, param, buf); \
+ }
+@@ -1597,16 +1614,17 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS);
+ iscsi_conn_attr(ping_tmo, ISCSI_PARAM_PING_TMO);
+ iscsi_conn_attr(recv_tmo, ISCSI_PARAM_RECV_TMO);
+
++#define iscsi_cdev_to_session(_cdev) \
++ iscsi_dev_to_session(_cdev->dev)
++
+ /*
+ * iSCSI session attrs
+ */
+ #define iscsi_session_attr_show(param, perm) \
+ static ssize_t \
+-show_session_param_##param(struct device *dev, \
+- struct device_attribute *attr, char *buf) \
++show_session_param_##param(struct class_device *cdev, char *buf) \
+ { \
+- struct iscsi_cls_session *session = \
+- iscsi_dev_to_session(dev->parent); \
++ struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \
+ struct iscsi_transport *t = session->transport; \
+ \
+ if (perm && !capable(CAP_SYS_ADMIN)) \
+@@ -1640,10 +1658,9 @@ iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
+ iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0)
+
+ static ssize_t
+-show_priv_session_state(struct device *dev, struct device_attribute *attr,
+- char *buf)
++show_priv_session_state(struct class_device *cdev, char *buf)
+ {
+- struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent);
++ struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev);
+ return sprintf(buf, "%s\n", iscsi_session_state_name(session->state));
+ }
+ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state,
+@@ -1651,11 +1668,9 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state,
+
+ #define iscsi_priv_session_attr_show(field, format) \
+ static ssize_t \
+-show_priv_session_##field(struct device *dev, \
+- struct device_attribute *attr, char *buf) \
++show_priv_session_##field(struct class_device *cdev, char *buf) \
+ { \
+- struct iscsi_cls_session *session = \
+- iscsi_dev_to_session(dev->parent); \
++ struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev);\
+ return sprintf(buf, format"\n", session->field); \
+ }
+
+@@ -1670,10 +1685,9 @@ iscsi_priv_session_attr(recovery_tmo, "%d");
+ */
+ #define iscsi_host_attr_show(param) \
+ static ssize_t \
+-show_host_param_##param(struct device *dev, \
+- struct device_attribute *attr, char *buf) \
++show_host_param_##param(struct class_device *cdev, char *buf) \
+ { \
+- struct Scsi_Host *shost = transport_class_to_shost(dev); \
++ struct Scsi_Host *shost = transport_class_to_shost(cdev); \
+ struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \
+ return priv->iscsi_transport->get_host_param(shost, param, buf); \
+ }
+@@ -1690,7 +1704,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME);
+
+ #define SETUP_PRIV_SESSION_RD_ATTR(field) \
+ do { \
+- priv->session_attrs[count] = &dev_attr_priv_sess_##field; \
++ priv->session_attrs[count] = &class_device_attr_priv_sess_##field; \
+ count++; \
+ } while (0)
+
+@@ -1698,7 +1712,7 @@ do { \
+ #define SETUP_SESSION_RD_ATTR(field, param_flag) \
+ do { \
+ if (tt->param_mask & param_flag) { \
+- priv->session_attrs[count] = &dev_attr_sess_##field; \
++ priv->session_attrs[count] = &class_device_attr_sess_##field; \
+ count++; \
+ } \
+ } while (0)
+@@ -1706,7 +1720,7 @@ do { \
+ #define SETUP_CONN_RD_ATTR(field, param_flag) \
+ do { \
+ if (tt->param_mask & param_flag) { \
+- priv->conn_attrs[count] = &dev_attr_conn_##field; \
++ priv->conn_attrs[count] = &class_device_attr_conn_##field; \
+ count++; \
+ } \
+ } while (0)
+@@ -1714,7 +1728,7 @@ do { \
+ #define SETUP_HOST_RD_ATTR(field, param_flag) \
+ do { \
+ if (tt->host_param_mask & param_flag) { \
+- priv->host_attrs[count] = &dev_attr_host_##field; \
++ priv->host_attrs[count] = &class_device_attr_host_##field; \
+ count++; \
+ } \
+ } while (0)
+@@ -1807,15 +1821,15 @@ iscsi_register_transport(struct iscsi_transport *tt)
+ if (!(tt->caps & CAP_DATA_PATH_OFFLOAD))
+ priv->t.create_work_queue = 1;
+
+- priv->dev.class = &iscsi_transport_class;
+- snprintf(priv->dev.bus_id, BUS_ID_SIZE, "%s", tt->name);
+- err = device_register(&priv->dev);
++ priv->cdev.class = &iscsi_transport_class;
++ snprintf(priv->cdev.class_id, BUS_ID_SIZE, "%s", tt->name);
++ err = class_device_register(&priv->cdev);
+ if (err)
+ goto free_priv;
+
+- err = sysfs_create_group(&priv->dev.kobj, &iscsi_transport_group);
++ err = sysfs_create_group(&priv->cdev.kobj, &iscsi_transport_group);
+ if (err)
+- goto unregister_dev;
++ goto unregister_cdev;
+
+ /* host parameters */
+ priv->t.host_attrs.ac.attrs = &priv->host_attrs[0];
+@@ -1894,9 +1908,8 @@ iscsi_register_transport(struct iscsi_transport *tt)
+ printk(KERN_NOTICE "iscsi: registered transport (%s)\n", tt->name);
+ return &priv->t;
+
+-unregister_dev:
+- device_unregister(&priv->dev);
+- return NULL;
++unregister_cdev:
++ class_device_unregister(&priv->cdev);
+ free_priv:
+ kfree(priv);
+ return NULL;
+@@ -1923,8 +1936,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt)
+ transport_container_unregister(&priv->session_cont);
+ transport_container_unregister(&priv->t.host_attrs);
+
+- sysfs_remove_group(&priv->dev.kobj, &iscsi_transport_group);
+- device_unregister(&priv->dev);
++ sysfs_remove_group(&priv->cdev.kobj, &iscsi_transport_group);
++ class_device_unregister(&priv->cdev);
+ mutex_unlock(&rx_queue_mutex);
+
+ return 0;
+@@ -1944,13 +1957,14 @@ static __init int iscsi_transport_init(void)
+ if (err)
+ return err;
+
++#if 0
+ err = class_register(&iscsi_endpoint_class);
+ if (err)
+ goto unregister_transport_class;
+-
++#endif
+ err = transport_class_register(&iscsi_host_class);
+ if (err)
+- goto unregister_endpoint_class;
++ goto unregister_transport_class;
+
+ err = transport_class_register(&iscsi_connection_class);
+ if (err)
+@@ -1981,8 +1995,10 @@ unregister_conn_class:
+ transport_class_unregister(&iscsi_connection_class);
+ unregister_host_class:
+ transport_class_unregister(&iscsi_host_class);
++#if 0
+ unregister_endpoint_class:
+ class_unregister(&iscsi_endpoint_class);
++#endif
+ unregister_transport_class:
+ class_unregister(&iscsi_transport_class);
+ return err;
+@@ -1995,7 +2011,9 @@ static void __exit iscsi_transport_exit(void)
+ transport_class_unregister(&iscsi_connection_class);
+ transport_class_unregister(&iscsi_session_class);
+ transport_class_unregister(&iscsi_host_class);
++#if 0
+ class_unregister(&iscsi_endpoint_class);
++#endif
+ class_unregister(&iscsi_transport_class);
+ }
+
+diff --git a/scsi_transport_iscsi.h b/scsi_transport_iscsi.h
+index b7652e3..3978551 100644
+--- a/scsi_transport_iscsi.h
++++ b/scsi_transport_iscsi.h
+@@ -28,6 +28,8 @@
+ #include <linux/mutex.h>
+ #include "iscsi_if.h"
+
++#include "open_iscsi_compat.h"
++
+ struct scsi_transport_template;
+ struct iscsi_transport;
+ struct iscsi_endpoint;
+@@ -175,7 +177,7 @@ struct iscsi_cls_session {
+
+ /* recovery fields */
+ int recovery_tmo;
+- struct delayed_work recovery_work;
++ struct work_struct recovery_work;
+
+ unsigned int target_id;
+
Index: open-iscsi-2.0-870-rc1/kernel/Makefile
===================================================================
--- open-iscsi-2.0-870-rc1.orig/kernel/Makefile
+++ open-iscsi-2.0-870-rc1/kernel/Makefile
@@ -54,6 +54,7 @@ has_kernel_src: kernel_check
#some constants
14to19_patch=2.6.14-19_compat.patch
+16suse_patch=2.6.16-suse.patch
20to21_patch=2.6.20-21_compat.patch
24_patch=2.6.24_compat.patch
all_patches=14to21_patch 20to21_patch 24_patch
@@ -69,6 +70,13 @@ KSUBLEVEL = $(shell cat $(KSRC)/Makefile
KSUBLEVEL?=$(shell echo $(KERNELRELEASE) | sed -n 's/.\..\.\([[:digit:]]*\)\..*/\1/p')
+ifeq (16, ${KSUBLEVEL})
+KERNEL_SUSE = $(shell cat $(KBUILD_OUTPUT)/.config | sed -n '/^CONFIG_SUSE_KERNEL=y/p')
+ifneq (${KERNEL_SUSE}, undefined)
+KSUBLEVEL := 16-suse
+endif
+endif
+
KERNEL_TARGET=linux_2_6_$(KSUBLEVEL)
kernel_check: $(KERNEL_TARGET)
@@ -78,6 +86,8 @@ linux_2_6_15: has_14to19_patch
linux_2_6_16: has_14to19_patch
+linux_2_6_16-suse: has_16suse_patch
+
linux_2_6_17: has_14to19_patch
linux_2_6_18: has_14to19_patch
@@ -115,6 +125,15 @@ has_14to19_patch: $(14to19_patch)
cp $(14to19_patch) $@
ln -s $@ $(cur_patched)
+has_16suse_patch: $(16suse_patch)
+ echo "Patching source code for linux-2.6.16 SLES10 SP2 ..."
+ if [ -e $(cur_patched) ]; then \
+ make -C . clean; \
+ fi
+ patch -p1 < $(16suse_patch)
+ cp $(16suse_patch) $@
+ ln -s $@ $(cur_patched)
+
has_20to21_patch: $(20to21_patch)
echo "Patching source code for linux-2.6.20-21 ..."
if [ -e $(cur_patched) ]; then \

View File

@ -1,42 +0,0 @@
From 33af14665a070c99fb1b8c1e049211550a883f04 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 10:11:19 +0100
Subject: [PATCH] iscsiadm: Allow 'onboot' option for loginall
There is no reason to not allow onboot for iscsiadm -L. In fact,
it's required for SUSE startup :-)
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
usr/iscsiadm.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 4b276e9..bac9a5a 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -690,12 +690,6 @@ static int
__login_by_startup(void *data, struct list_head *list, struct node_rec *rec)
{
char *mode = data;
- /*
- * we always skip onboot because this should be handled by
- * something else
- */
- if (rec->startup == ISCSI_STARTUP_ONBOOT)
- return -1;
if (match_startup_mode(rec, mode))
return -1;
@@ -711,7 +705,7 @@ login_by_startup(char *mode)
struct list_head rec_list;
if (!mode || !(!strcmp(mode, "automatic") || !strcmp(mode, "all") ||
- !strcmp(mode,"manual"))) {
+ !strcmp(mode,"manual") || !strcmp(mode, "onboot"))) {
log_error("Invalid loginall option %s.", mode);
usage(0);
return EINVAL;
--
1.6.0.2

File diff suppressed because it is too large Load Diff

View File

@ -1,362 +0,0 @@
commit 86b865b61d530188e3d6a59773ca7edbc8d30767
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Nov 20 15:45:02 2008 +0100
cxgb3 iSCSI TOE support
This patch enable cxgb3i iSCSI TOE support for open-iscsi.
References: bnc#433500, FATE#304154
Signed-off-by: Karen Xie <kxie@chelsio.com>
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index b488ad5..8fe14d4 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -63,10 +63,10 @@ specific hardware resource and instead allow the network or infinniband layer
to decide what to do. There is no need to create a iface config with the default
behavior. If you do not specify a iface, then the default behavior is used.
-As mentioned above there is a special iface name default. There are two others
-bnx2i and iser, which does not bind the session to a specific card, but
-will bind the session to either the bnx2i or iser transport. These are
-experimental and the use is not supported as a stable interface yet.
+As mentioned above there is a special iface name default. There are three
+others -- cxgb3i, bnx2i and iser, which does not bind the session to a specific
+card, but will bind the session to the cxgb3i, bnx2i or iser transport. These
+are experimental and the use is not supported as a stable interface yet.
In discovery mode multiple interfaces can be specific by passing in multiple
-I/--interface instances. For example,
diff --git a/etc/iface.example b/etc/iface.example
index 7fb7951..020b002 100644
--- a/etc/iface.example
+++ b/etc/iface.example
@@ -20,6 +20,7 @@
# - iser (Software iSCSI over infinniband
# - qla4xxx (Qlogic QLA4XXX HBAs)
# - bnx2i (Broadcom bnx iSCSI HBAs);
+# - cxgb3i (Chelsio cxgb S3 iSCSI HBAs);
#
#OPTIONAL: iface.initiatorname
# To use a initiator name other than the one set in
@@ -51,3 +52,13 @@
# Note you can only bind using one value. If you set multiple values
# the bahavior is not defined.
+
+# For some transport (cxgb3i), a user could to set the private ip address for
+# the iscsi traffic for an network interface:
+# example:
+# - set iscsi ip on eth0 to be 102.50.50.101, eth0 needs to be up and be on
+# the same subnet.
+# iface.net_ifacename = eth0
+# iface.ipaddress = 102.50.50.101
+~
+
diff --git a/usr/idbm.c b/usr/idbm.c
index a7a1072..6f4ed12 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -274,8 +274,8 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
*/
__recinfo_str("iface.hwaddress", ri, r, iface.hwaddress, IDBM_SHOW,
num, 1);
-// __recinfo_str("iface.ipaddress", ri, r, iface.ipaddress,
-// IDBM_SHOW, num);
+ __recinfo_str("iface.ipaddress", ri, r, iface.ipaddress, IDBM_SHOW,
+ num, 1);
__recinfo_str("iface.iscsi_ifacename", ri, r, iface.name, IDBM_SHOW,
num, 1);
__recinfo_str("iface.net_ifacename", ri, r, iface.netdev, IDBM_SHOW,
@@ -413,7 +413,7 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
__recinfo_str("iface.iscsi_ifacename", ri, r, name, IDBM_SHOW, num, 0);
__recinfo_str("iface.net_ifacename", ri, r, netdev, IDBM_SHOW, num, 1);
-// __recinfo_str("iface.ipaddress", ri, r, ipaddress, IDBM_SHOW, num, 1);
+ __recinfo_str("iface.ipaddress", ri, r, ipaddress, IDBM_SHOW, num, 1);
__recinfo_str("iface.hwaddress", ri, r, hwaddress, IDBM_SHOW, num, 1);
__recinfo_str("iface.transport_name", ri, r, transport_name,
IDBM_SHOW, num, 1);
diff --git a/usr/iface.c b/usr/iface.c
index 01b87da..3273197 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -104,7 +104,7 @@ static void iface_init(struct iface_rec *iface)
void iface_setup_defaults(struct iface_rec *iface)
{
sprintf(iface->netdev, DEFAULT_NETDEV);
-// sprintf(iface->ipaddress, DEFAULT_IPADDRESS);
+ sprintf(iface->ipaddress, DEFAULT_IPADDRESS);
sprintf(iface->hwaddress, DEFAULT_HWADDRESS);
sprintf(iface->transport_name, DEFAULT_TRANSPORT);
iface_init(iface);
@@ -494,8 +494,8 @@ void iface_copy(struct iface_rec *dst, struct iface_rec *src)
strcpy(dst->name, src->name);
if (strlen(src->netdev))
strcpy(dst->netdev, src->netdev);
-// if (strlen(src->ipaddress))
-// strcpy(dst->ipaddress, src->ipaddress);
+ if (strlen(src->ipaddress))
+ strcpy(dst->ipaddress, src->ipaddress);
if (strlen(src->hwaddress))
strcpy(dst->hwaddress, src->hwaddress);
if (strlen(src->transport_name))
@@ -594,6 +594,8 @@ int iface_print_tree(void *data, struct iface_rec *iface)
UNKNOWN_VALUE);
printf("\tHW Address: %s\n",
strlen(iface->hwaddress) ? iface->hwaddress : UNKNOWN_VALUE);
+ printf("\tIP Address: %s\n",
+ strlen(iface->ipaddress) ? iface->ipaddress : UNKNOWN_VALUE);
printf("\tNetdev: %s\n",
strlen(iface->netdev) ? iface->netdev : UNKNOWN_VALUE);
printf("\tInitiator Name: %s\n",
@@ -603,11 +605,12 @@ int iface_print_tree(void *data, struct iface_rec *iface)
int iface_print_flat(void *data, struct iface_rec *iface)
{
- printf("%s %s,%s,%s,%s\n",
+ printf("%s %s,%s,%s,%s,%s\n",
strlen(iface->name) ? iface->name : UNKNOWN_VALUE,
strlen(iface->transport_name) ? iface->transport_name :
UNKNOWN_VALUE,
strlen(iface->hwaddress) ? iface->hwaddress : UNKNOWN_VALUE,
+ strlen(iface->ipaddress) ? iface->ipaddress : UNKNOWN_VALUE,
strlen(iface->netdev) ? iface->netdev : UNKNOWN_VALUE,
strlen(iface->iname) ? iface->iname : UNKNOWN_VALUE);
return 0;
diff --git a/usr/initiator.c b/usr/initiator.c
index 10cf050..8e95841 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1176,7 +1176,7 @@ mgmt_ipc_err_e iscsi_host_set_param(int host_no, int param, char *value)
return MGMT_IPC_OK;
}
-#define MAX_SESSION_PARAMS 30
+#define MAX_SESSION_PARAMS 31
#define MAX_HOST_PARAMS 3
static void
@@ -1360,6 +1360,10 @@ setup_full_feature_phase(iscsi_conn_t *conn)
.param = ISCSI_PARAM_IFACE_NAME,
.value = session->nrec.iface.name,
.type = ISCSI_STRING,
+ }, {
+ .param = ISCSI_PARAM_INITIATOR_NAME,
+ .value = session->initiator_name,
+ .type = ISCSI_STRING,
},
};
@@ -1946,6 +1950,54 @@ int session_is_running(node_rec_t *rec)
return 0;
}
+static int iface_set_param(struct iscsi_transport *t, iface_rec_t *iface,
+ iscsi_session_t *session)
+{
+ int rc = 0;
+ int netdev_set = strcasecmp(iface->netdev, DEFAULT_NETDEV);
+ int ipaddr_set = strcasecmp(iface->ipaddress, DEFAULT_IPADDRESS);
+ int hwaddr_set = strcasecmp(iface->hwaddress, DEFAULT_HWADDRESS);
+ int hostno;
+ iface_rec_t *iface_tmp;
+
+ log_debug(3, "iface %s, dev %s, set ip %s, hw %s, tranport %s.\n",
+ iface->name, iface->netdev, iface->ipaddress,
+ iface->hwaddress, iface->transport_name);
+
+ /* proceed only when netdev and either ipaddress or hwaddress is set */
+ if (!netdev_set || (!ipaddr_set && !hwaddr_set))
+ return 0;
+
+ /* find out hostno via netdev */
+ iface_tmp = calloc(1, sizeof(*iface_tmp));
+ strcpy(iface_tmp->netdev, iface->netdev);
+ hostno = iscsi_sysfs_get_host_no_from_iface(iface_tmp, &rc);
+ free(iface_tmp);
+ if (rc)
+ return rc;
+ session->hostno = hostno;
+
+ if (ipaddr_set) {
+ rc = __iscsi_host_set_param(t, session->hostno,
+ ISCSI_HOST_PARAM_IPADDRESS,
+ iface->ipaddress,
+ ISCSI_STRING);
+ if (rc)
+ return rc;
+ }
+
+ if (hwaddr_set) {
+ rc = __iscsi_host_set_param(t, session->hostno,
+ ISCSI_HOST_PARAM_HWADDRESS,
+ iface->hwaddress,
+ ISCSI_STRING);
+ if (rc)
+ return rc;
+ }
+
+ return 0;
+}
+
int
session_login_task(node_rec_t *rec, queue_task_t *qtask)
{
@@ -2028,6 +2080,11 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
conn = &session->conn[0];
qtask->conn = conn;
+ if (iface_set_param(t, &rec->iface, session)) {
+ __session_destroy(session);
+ return MGMT_IPC_ERR_LOGIN_FAILURE;
+ }
+
conn->state = STATE_XPT_WAIT;
if (iscsi_conn_connect(conn, qtask)) {
__session_destroy(session);
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index cab3ec1..54b6ee6 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -531,7 +531,7 @@ uint32_t iscsi_sysfs_get_host_no_from_iface(struct iface_rec *iface, int *rc)
else if (strlen(iface->ipaddress) &&
strcasecmp(iface->ipaddress, DEFAULT_IPADDRESS))
host_no = get_host_no_from_ipaddress(iface->ipaddress, &tmp_rc);
- else if(strlen(iface->netdev) &&
+ else if (strlen(iface->netdev) &&
strcasecmp(iface->netdev, DEFAULT_NETDEV))
host_no = get_host_no_from_netdev(iface->netdev, &tmp_rc);
else
@@ -582,35 +582,78 @@ static int sysfs_read_iface(struct iface_rec *iface, int host_no, int sid)
log_debug(7, "could not read netdev for host%d\n", host_no);
}
- ret = iscsi_sysfs_get_iscsi_host_param(host_no, "initiatorname",
- iface->iname, "%s\n");
- if (ret)
- /* default iname is picked up later from initiatorname.iscsi */
- log_debug(7, "Could not read initiatorname for host%d\n",
- host_no);
-
/*
- * this is on the session, because we support multiple bindings
- * per device.
+ * If we are looping over the hosts then we want to read the
+ * initiator name set at that level instead of the session
+ * level one, because if we created a iscsi port with a different
+ * iname then they will not match.
*/
- memset(iface->name, 0, sizeof(iface->name));
- /*
- * this was added after 2.0.869 so we could be doing iscsi_tcp
- * session binding, but there may not be a ifacename set
- */
- ret = iscsi_sysfs_get_session_param(sid, "ifacename", iface->name,
- "%s\n");
+ ret = 1;
+ if (sid != -1) {
+ /*
+ * this is on the session, because we support multiple bindings
+ * per device.
+ */
+ memset(iface->name, 0, sizeof(iface->name));
+ /*
+ * this was added after 2.0.869 so we could be doing iscsi_tcp
+ * session binding, but there may not be a ifacename set
+ */
+ ret = iscsi_sysfs_get_session_param(sid, "ifacename",
+ iface->name, "%s\n");
+ /* if failed then look ifacename through binding tuple */
+ if (ret)
+ log_debug(7, "could not read iface name for sid %u\n",
+ sid);
+ }
+
if (ret) {
- log_debug(7, "could not read iface name for sid %u\n", sid);
/*
- * if the ifacename file is not there then we are using a older
- * kernel and can try to find the binding by the net info
- * which was used on these older kernels.
- */
+ * if the ifacename file (will always not be for qla4xxx)
+ * is not there then we are using a older kernel and can
+ * try to find the binding by the net info which was
+ * used on these older kernels. If scanning hosts then
+ * we must go this route currently because we do not
+ * store the ifacename on the host for qla4xxx.
+ */
if (iface_get_by_net_binding(iface, iface))
- log_debug(7, "Could not find iface for session bound "
- "to:" iface_fmt "\n", iface_str(iface));
+ log_debug(7, "Could not find iface for "
+ "session bound to:" iface_fmt "\n",
+ iface_str(iface));
+ }
+
+ ret = 1;
+ if (sid != 1) {
+ /*
+ * 2.0.870 we added the two inames to distinguish
+ * between one that may be set at the hba level
+ * as the default and one that we set for the iface
+ * so we could create a virtual initiator port.
+ */
+ ret = iscsi_sysfs_get_session_param(sid, "initiatorname",
+ iface->iname, "%s\n");
+ if (ret)
+ /*
+ * default iname is picked up later from
+ * initiatorname.iscsi
+ */
+ log_debug(7, "Could not read initiatorname for "
+ "host%d\n", host_no);
+ /* drop through to older iface iname */
}
+
+ if (ret) {
+ ret = iscsi_sysfs_get_iscsi_host_param(host_no, "initiatorname",
+ iface->iname, "%s\n");
+ if (ret)
+ /*
+ * default iname is picked up later from
+ * initiatorname.iscsi
+ */
+ log_debug(7, "Could not read initiatorname for "
+ "host%d\n", host_no);
+ }
+
return ret;
}
diff --git a/usr/transport.c b/usr/transport.c
index c2edbcc..07b61db 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -41,6 +41,13 @@ struct iscsi_transport_template iscsi_iser = {
.ep_disconnect = ktransport_ep_disconnect,
};
+struct iscsi_transport_template cxgb3i = {
+ .name = "cxgb3i",
+ .ep_connect = ktransport_ep_connect,
+ .ep_poll = ktransport_ep_poll,
+ .ep_disconnect = ktransport_ep_disconnect,
+};
+
struct iscsi_transport_template bnx2i = {
.name = "bnx2i",
.ep_connect = ktransport_ep_connect,
@@ -55,6 +62,7 @@ struct iscsi_transport_template qla4xxx = {
static struct iscsi_transport_template *iscsi_transport_templates[] = {
&iscsi_tcp,
&iscsi_iser,
+ &cxgb3i,
&bnx2i,
&qla4xxx,
NULL

View File

@ -1,43 +0,0 @@
commit 37f18edf5c61193434651fc61f5cfe5107f43c6d
Author: Hans de Goede <j.w.r.degoede@hhs.nl>
Date: Mon Sep 29 13:11:58 2008 +0200
PATCH: add error checking to iscsi discovery db lock creation
Hi Make,
I've been bitten numerous times now by iscsiadm hanging when run as normal user
(it spins trying to create the lock, which will never succeed as it simple
misses the rights todo so).
I plan on including the attached patch in the new rawhide / F-10 package with
the new initscripts I'm working on. Please scream loudly if you object against
this patch.
Regards,
Hans
p.s.
If we go ahead with this patch I assume you will take care of getting it upstream.
diff --git a/usr/idbm.c b/usr/idbm.c
index 0cb3c44..a7a1072 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -850,6 +850,14 @@ int idbm_lock(void)
if (ret == 0)
break;
+ if (errno != EEXIST) {
+ log_error("Could not lock discovery DB: %s: %s",
+ LOCK_WRITE_FILE, strerror(errno));
+ log_error("Maybe you are not root?");
+ exit(-1);
+ } else if (i == 0)
+ log_debug(2, "Waiting for discovery DB lock");
+
usleep(10000);
}

View File

@ -1,37 +0,0 @@
Handle nulls from sysfs, for recent kernels.
Sysfs in recent kernels returns "(null)" instead of "<NULL>",
handle that. Such "(null)" strings from sysfs as mapped to
NULL values.
Lack of this check, caused a non-existant password to be read as
"(null)" and treated as a valid and present password, and so,
AuthMethod=CHAP was used for a relogin.
References: bnc #683249,656119, bnc#766300
---
usr/iscsi_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: b/usr/iscsi_sysfs.c
===================================================================
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -43,7 +43,6 @@
#define ISCSI_SESSION_DIR "/sys/class/iscsi_session"
#define ISCSI_HOST_DIR "/sys/class/iscsi_host"
-#define ISCSI_SYSFS_INVALID_VALUE "<NULL>"
#define ISCSI_SESSION_SUBSYS "iscsi_session"
#define ISCSI_CONN_SUBSYS "iscsi_connection"
#define ISCSI_HOST_SUBSYS "iscsi_host"
@@ -87,7 +86,8 @@ static int iscsi_sysfs_get_param(char *i
return EIO;
}
- if (!strncmp(sysfs_value, ISCSI_SYSFS_INVALID_VALUE, 6))
+ if (!strncmp(sysfs_value, "<NULL>", 6) ||
+ !strncmp(sysfs_value, "(null)", 6))
return ENODATA;
sscanf(sysfs_value, format, ret_value);

View File

@ -1,44 +0,0 @@
Subject: Allow 'onboot' as loginall parameter
From: Hannes Reinecke <hare@suse.de>
Date: Fri Dec 5 08:57:29 2008 +0100:
Git: adcc1860e58d8e15720ff0c9473fda55c6144521
We are using to 'onboot' parameter to setup iscsi connections
in the initrd. Thus we should be able to use 'onboot' as a valid
parameter for loginall, too.
References: 449108
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index bac9a5a..3fa4964 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -235,15 +235,10 @@ static int print_ifaces(int info_level)
static int
match_startup_mode(node_rec_t *rec, char *mode)
{
- /*
- * we always skip onboot because this should be handled by
- * something else
- */
- if (rec->startup == ISCSI_STARTUP_ONBOOT)
- return -1;
-
if ((!strcmp(mode, "automatic") &&
rec->startup == ISCSI_STARTUP_AUTOMATIC) ||
+ (!strcmp(mode, "onboot") &&
+ rec->startup == ISCSI_STARTUP_ONBOOT) ||
(!strcmp(mode, "manual") &&
rec->startup == ISCSI_STARTUP_MANUAL) ||
!strcmp(mode, "all"))
@@ -252,6 +247,8 @@ match_startup_mode(node_rec_t *rec, char *mode)
/* support conn or session startup params */
if ((!strcmp(mode, "automatic") &&
rec->conn[0].startup == ISCSI_STARTUP_AUTOMATIC) ||
+ (!strcmp(mode, "onboot") &&
+ rec->conn[0].startup == ISCSI_STARTUP_ONBOOT) ||
(!strcmp(mode, "manual") &&
rec->conn[0].startup == ISCSI_STARTUP_MANUAL) ||
!strcmp(mode, "all"))

View File

@ -1,26 +0,0 @@
commit 8cf4c3b44ca99422b41e2ff0eecd473c1f1cd4e3
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Nov 27 09:34:02 2008 +0100
iscsiadm -m fw crashed on PowerPC
When no OpenFW boot parameters are found we should not try
to search iBFT on PowerPC. That doesn't work, of course.
References: 449116
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c
index fbfa3dd..072c185 100644
--- a/utils/fwparam_ibft/fw_entry.c
+++ b/utils/fwparam_ibft/fw_entry.c
@@ -28,7 +28,7 @@ int fw_get_entry(struct boot_context *context, const char *filepath)
int ret;
ret = fwparam_ppc(context, filepath);
- if (ret)
+ if (ret < 0)
ret = fwparam_ibft(context, filepath);
return ret;
}

View File

@ -1,22 +0,0 @@
diff --git a/utils/fwparam_ibft/fwparam_ppc.c b/utils/fwparam_ibft/fwparam_ppc.c
index b040837..6d344d1 100644
--- a/utils/fwparam_ibft/fwparam_ppc.c
+++ b/utils/fwparam_ibft/fwparam_ppc.c
@@ -436,10 +436,14 @@ int fwparam_ppc(struct boot_context *context, const char *filepath)
* the appropriate FCODE with a load method.
*/
if (filepath) {
- strncat(filename, filepath, FILENAMESZ);
+ strncat(filename, filepath, FILENAMESZ - 1);
+ filename[FILENAMESZ - 1] = '\0';
fplen = strlen(filename);
- } else
- strncat(filename, DT_TOP, FILENAMESZ);
+ } else {
+ strncat(filename, DT_TOP, FILENAMESZ - 1);
+ filename[FILENAMESZ - 1] = '\0';
+ fplen = strlen(filename);
+ }
strncat(filename + fplen, BOOTPATH, FILENAMESZ - fplen);

View File

@ -1,13 +0,0 @@
Index: open-iscsi-2.0-870-rc1/usr/iscsi_sysfs.c
===================================================================
--- open-iscsi-2.0-870-rc1.orig/usr/iscsi_sysfs.c
+++ open-iscsi-2.0-870-rc1/usr/iscsi_sysfs.c
@@ -22,6 +22,8 @@
#include <string.h>
#include <errno.h>
#include <dirent.h>
+#include <sys/stat.h>
+
#include "log.h"
#include "initiator.h"

View File

@ -1,22 +0,0 @@
commit 32a4c65219dbbe87d8b8bdd878b94c4baa0a91ea
Author: Mike Christie <michaelc@cs.wisc.edu>
Date: Tue Sep 30 11:28:01 2008 -0500
Fix initiator.c compile warning
A log_error message had a extra "," which was causing compile
warnings.
diff --git a/usr/initiator.c b/usr/initiator.c
index 8bd7a90..10cf050 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -2009,7 +2009,7 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
if (!(t->caps & CAP_MARKERS) &&
rec->conn[0].iscsi.OFMarker) {
- log_error("Transport '%s' does not support OFMarker.",
+ log_error("Transport '%s' does not support OFMarker."
"Disabling OFMarkers.\n", t->name);
rec->conn[0].iscsi.OFMarker = 0;
}

View File

@ -1,26 +0,0 @@
diff --git a/Makefile b/Makefile
index e405c9c..de66ae1 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ bindir = $(exec_prefix)/bin
mandir = $(prefix)/share/man
etcdir = /etc
initddir = $(etcdir)/init.d
+mkinitrd = $(exec_prefix)/lib/mkinitrd/scripts
MANPAGES = doc/iscsid.8 doc/iscsiadm.8 doc/iscsi_discovery.8
PROGRAMS = usr/iscsid usr/iscsiadm utils/iscsi_discovery utils/iscsi-iname
@@ -81,6 +82,13 @@ install_initd_suse:
$(DESTDIR)$(initddir)/open-iscsi
$(INSTALL) -m 755 etc/initd/boot.suse \
$(DESTDIR)$(initddir)/boot.open-iscsi
+ $(INSTALL) -d $(DESTDIR)$(mkinitrd)
+ $(INSTALL) -m 755 etc/mkinitrd/mkinitrd-boot.sh \
+ $(DESTDIR)$(mkinitrd)/boot-iscsi.sh
+ $(INSTALL) -m 755 etc/mkinitrd/mkinitrd-setup.sh \
+ $(DESTDIR)$(mkinitrd)/setup-iscsi.sh
+ $(INSTALL) -m 755 etc/mkinitrd/mkinitrd-stop.sh \
+ $(DESTDIR)$(mkinitrd)/boot-killiscsi.sh
install_initd_redhat:
$(INSTALL) -d $(DESTDIR)$(initddir)

View File

@ -1,72 +0,0 @@
commit 8d903115f9227a3922ec8172a0faa57b95c8a57f
Author: Erez Zilber <erezzi.list@gmail.com>
Date: Wed Oct 22 11:45:24 2008 +0200
Minor fixes in iscsi_discovery documentation
Some changes that were made in iscsi_discovery were
not reflected in the docs.
Signed-off-by: Erez Zilber <erezzi.list@gmail.com>
diff --git a/doc/iscsi_discovery.8 b/doc/iscsi_discovery.8
index c46223b..13484e7 100644
--- a/doc/iscsi_discovery.8
+++ b/doc/iscsi_discovery.8
@@ -6,19 +6,19 @@
.TH "iscsi_discovery" 8
.SH NAME
-iscsi_discovery \- discover iscsi devices
+iscsi_discovery \- discover iSCSI targets
.SH SYNOPSIS
.B iscsi_discovery <IP> [-p <port>] [-d] [-t <tcp|iser> [-f]] [-m] [-l]
.SH DESCRIPTION
Perform send-targets discovery to the specified IP. If a discovery record
-is generated, try to login to the portal using iSER and TCP transports
+is generated, try to login to the portal using the preferred transport
(-t flag specifies the requested transport type, TCP is the default).
If login using a certain transport succeeds, mark the portal for automatic
login (unless -m flag is used), and disconnect (unless -l flag is used).
-For iscsi discovery to work, open-iscsi services must be running. e.g. iscsid
-should be up, and the iscsi modules loaded. This is best accomplished by the
+For iSCSI discovery to work, open-iscsi services must be running. i.e. iscsid
+should be up, and the iSCSI modules loaded. This is best accomplished by the
init.d startup script.
.\" .SH OPTIONS
@@ -47,6 +47,6 @@ login - login to the new discovered nodes (defualt is false).
.SH AUTHOR
Written by Dan Bar Dov
.SH "REPORTING BUGS"
-Report bugs to <erezz@voltaire.com>.
+Report bugs to <erezzi.list@gmail.com>.
.SH COPYRIGHT
Copyright \(co Voltaire Ltd. 2006.
diff --git a/utils/iscsi_discovery b/utils/iscsi_discovery
index 9f1e7cf..3c6edf3 100755
--- a/utils/iscsi_discovery
+++ b/utils/iscsi_discovery
@@ -20,17 +20,17 @@
# iscsi_discovery:
# * does a send-targets discovery to the given IP
-# * set the transport type to ISER
+# * set the transport type to the preferred transport (or tcp is -t flag is not used)
# * tries to login
# * if succeeds,
# o logout,
-# o mark record autmatic
+# o mark record autmatic (unless -m flag is used)
# * else
# o reset transport type to TCP
# o try to login
# o if succeeded
# + logout
-# + mark record automatic
+# + mark record automatic (unless -m flag is used)
#
usage()

View File

@ -1,85 +0,0 @@
From 0fb47d1d2bf03b0c59e9da022174e14ec474b933 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Thu, 21 Aug 2008 20:37:30 -0500
Subject: [PATCH] iscsid: adjust requested settings for user
This patch adjusts the requested setting for the user if the
module does not support the setting.
---
usr/initiator.c | 38 +++++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/usr/initiator.c b/usr/initiator.c
index 4de618d..2f29ffc 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1932,45 +1932,49 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
rec->session.iscsi.ERL != 0) ||
(!(t->caps & CAP_RECOVERY_L1) &&
rec->session.iscsi.ERL > 1)) {
- log_error("transport '%s' does not support ERL %d",
+ log_error("Transport '%s' does not support ERL %d."
+ "Setting ERL to ERL0.\n",
t->name, rec->session.iscsi.ERL);
- return MGMT_IPC_ERR_TRANS_CAPS;
+ rec->session.iscsi.ERL = 0;
}
if (!(t->caps & CAP_MULTI_R2T) &&
rec->session.iscsi.MaxOutstandingR2T) {
- log_error("transport '%s' does not support "
- "MaxOutstandingR2T %d", t->name,
+ log_error("Transport '%s' does not support "
+ "MaxOutstandingR2T %d. Setting "
+ "MaxOutstandingR2T to 1.", t->name,
rec->session.iscsi.MaxOutstandingR2T);
- return MGMT_IPC_ERR_TRANS_CAPS;
+ rec->session.iscsi.MaxOutstandingR2T = 1;
}
if (!(t->caps & CAP_HDRDGST) &&
rec->conn[0].iscsi.HeaderDigest) {
- log_error("transport '%s' does not support "
- "HeaderDigest != None", t->name);
- return MGMT_IPC_ERR_TRANS_CAPS;
+ log_error("Transport '%s' does not support "
+ "HeaderDigest != None. Setting HeaderDigest "
+ "to None.", t->name);
+ rec->conn[0].iscsi.HeaderDigest = CONFIG_DIGEST_NEVER;
}
if (!(t->caps & CAP_DATADGST) &&
rec->conn[0].iscsi.DataDigest) {
- log_error("transport '%s' does not support "
- "DataDigest != None", t->name);
- return MGMT_IPC_ERR_TRANS_CAPS;
+ log_error("Transport '%s' does not support "
+ "DataDigest != None. Setting DataDigest "
+ "to None", t->name);
+ rec->conn[0].iscsi.DataDigest = CONFIG_DIGEST_NEVER;
}
if (!(t->caps & CAP_MARKERS) &&
rec->conn[0].iscsi.IFMarker) {
- log_error("transport '%s' does not support IFMarker",
- t->name);
- return MGMT_IPC_ERR_TRANS_CAPS;
+ log_error("Transport '%s' does not support IFMarker. "
+ "Disabling IFMarkers.\n", t->name);
+ rec->conn[0].iscsi.IFMarker = 0;
}
if (!(t->caps & CAP_MARKERS) &&
rec->conn[0].iscsi.OFMarker) {
- log_error("transport '%s' does not support OFMarker",
- t->name);
- return MGMT_IPC_ERR_TRANS_CAPS;
+ log_error("Transport '%s' does not support OFMarker.",
+ "Disabling OFMarkers.\n", t->name);
+ rec->conn[0].iscsi.OFMarker = 0;
}
session = __session_create(rec, t);
--
1.5.2.4

View File

@ -1,41 +0,0 @@
Subject: Load modules for initrd at before reading /sys/firmware/ibft
From: Hannes Reinecke <hare@suse.de>
Date: Fri Dec 5 10:02:18 2008 +0100:
Git: c7af54f96479394d2175f01cbcb770a22db1005a
The iBFT firmware can only be read after the module has been
loaded, obviously. So move the module loading around.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/etc/mkinitrd/mkinitrd-boot.sh b/etc/mkinitrd/mkinitrd-boot.sh
index 9bd22ff..59294e5 100644
--- a/etc/mkinitrd/mkinitrd-boot.sh
+++ b/etc/mkinitrd/mkinitrd-boot.sh
@@ -49,6 +49,8 @@ tmp_InitiatorName="$(get_param InitiatorName)"
# reads the InitiatorName variable
. /etc/iscsi/initiatorname.iscsi
+load_modules
+
# Check of iBFT settings
if [ -d /sys/firmware/ibft/initiator ] ; then
# only use the iBFT InitiatorName if the commandline argument is not "default"
@@ -69,13 +71,13 @@ echo "InitiatorName=$InitiatorName" > /etc/iscsi/initiatorname.iscsi
unset iSCSI_warning_InitiatorName
-load_modules
-
echo "Starting iSCSI daemon"
/sbin/iscsid -n
-# log into iBFT nodes
-/sbin/iscsiadm -m fw -l
+if [ -d /sys/firmware/ibft/initiator ] ; then
+ # log into iBFT nodes
+ /sbin/iscsiadm -m fw -l
+fi
# Check for command line sessions
if [ -n "$TargetAddress" -a -n "$TargetName" ] ; then

View File

@ -1,184 +0,0 @@
diff --git a/etc/iscsid.conf b/etc/iscsid.conf
index f2691ee..4f6e08a 100644
--- a/etc/iscsid.conf
+++ b/etc/iscsid.conf
@@ -107,14 +107,31 @@ node.session.err_timeo.lu_reset_timeout = 20
# Retry
#******
-# To speficy the number of times iscsiadm should retry a login
-# to the target when we first login, modify the following line.
-# The default is 4. Valid values are any integer value. This only
+# To specify the number of times iscsid should retry a login
+# if the login attempt fails due to the node.conn[0].timeo.login_timeout
+# expiring modify the following line. Note that if the login fails
+# quickly (before node.conn[0].timeo.login_timeout fires) because the network
+# layer or the target returns an error, iscsid may retry the login more than
+# node.session.initial_login_retry_max times.
+#
+# This retry count along with node.conn[0].timeo.login_timeout
+# determines the maximum amount of time iscsid will try to
+# establish the initial login. node.session.initial_login_retry_max is
+# multiplied by the node.conn[0].timeo.login_timeout to determine the
+# maximum amount.
+#
+# The default node.session.initial_login_retry_max is 8 and
+# node.conn[0].timeo.login_timeout is 15 so we have:
+#
+# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max =
+# 120 seconds
+#
+# Valid values are any integer value. This only
# affects the initial login. Setting it to a high value can slow
# down the iscsi service startup. Setting it to a low value can
# cause a session to not get logged into, if there are distuptions
# during startup or if the network is not ready at that time.
-node.session.initial_login_retry_max = 4
+node.session.initial_login_retry_max = 8
################################
# session and device queue depth
diff --git a/usr/initiator.c b/usr/initiator.c
index 2f29ffc..b85416e 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <sys/time.h>
#include "initiator.h"
#include "transport.h"
@@ -773,13 +774,45 @@ session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop)
__session_conn_reopen(conn, qtask, do_stop, 0);
}
+static int iscsi_retry_initial_login(struct iscsi_conn *conn)
+{
+ int initial_login_retry_max;
+ struct timeval now, timeout, fail_time;
+
+ initial_login_retry_max =
+ conn->session->nrec.session.initial_login_retry_max;
+
+ memset(&now, 0, sizeof(now));
+ memset(&timeout, 0, sizeof(timeout));
+ memset(&fail_time, 0, sizeof(fail_time));
+
+ timeout.tv_sec = initial_login_retry_max * conn->login_timeout;
+ if (gettimeofday(&now, NULL)) {
+ log_error("Could not get time of day. Dropping down to "
+ "max retry check.\n");
+ return initial_login_retry_max > conn->session->reopen_cnt;
+ }
+ timeradd(&conn->initial_connect_time, &timeout, &fail_time);
+
+ /*
+ * if we have been trying for login_retry_max * login_timeout
+ * then it is time to give up
+ */
+ if (timercmp(&now, &fail_time, >)) {
+ log_debug(1, "Giving up on initial login attempt after "
+ "%u seconds.\n",
+ initial_login_retry_max * conn->login_timeout);
+ return 0;
+ }
+
+ return 1;
+}
+
static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
mgmt_ipc_err_e err)
{
struct iscsi_session *session = conn->session;
- int initial_login_retry_max;
- initial_login_retry_max = session->nrec.session.initial_login_retry_max;
log_debug(3, "iscsi_login_eh");
/*
* Flush polls and other events
@@ -791,12 +824,10 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
switch (session->r_stage) {
case R_STAGE_NO_CHANGE:
log_debug(6, "login failed STATE_XPT_WAIT/"
- "R_STAGE_NO_CHANGE (%d/%d)",
- session->reopen_cnt,
- initial_login_retry_max);
+ "R_STAGE_NO_CHANGE");
/* timeout during initial connect.
* clean connection. write ipc rsp or retry */
- if (initial_login_retry_max < session->reopen_cnt + 1)
+ if (!iscsi_retry_initial_login(conn))
session_conn_shutdown(conn, qtask, err);
else {
session->reopen_cnt++;
@@ -808,12 +839,10 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
break;
case R_STAGE_SESSION_REDIRECT:
log_debug(6, "login failed STATE_XPT_WAIT/"
- "R_STAGE_SESSION_REDIRECT (%d/%d)",
- session->reopen_cnt,
- initial_login_retry_max);
+ "R_STAGE_SESSION_REDIRECT");
/* timeout during initial redirect connect
* clean connection. write ipc rsp or retry */
- if (initial_login_retry_max < session->reopen_cnt + 1)
+ if (!iscsi_retry_initial_login(conn))
session_conn_shutdown(conn, qtask, err);
else
session_conn_reopen(conn, qtask, 0);
@@ -845,7 +874,7 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask,
* initial redirected connect. Clean connection
* and write rsp or retry.
*/
- if (initial_login_retry_max < session->reopen_cnt + 1)
+ if (!iscsi_retry_initial_login(conn))
session_conn_shutdown(conn, qtask, err);
else
session_conn_reopen(conn, qtask,
@@ -1997,6 +2026,11 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
return MGMT_IPC_ERR_TRANS_FAILURE;
}
+ 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.");
+
qtask->rsp.command = MGMT_IPC_SESSION_LOGIN;
qtask->rsp.err = MGMT_IPC_OK;
return MGMT_IPC_OK;
diff --git a/usr/initiator.h b/usr/initiator.h
index 594e8f8..682ebfc 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <net/if.h>
+#include <sys/time.h>
#include "types.h"
#include "iscsi_proto.h"
@@ -125,6 +126,7 @@ typedef struct iscsi_conn {
iscsi_conn_state_e state;
int userspace_nop;
+ struct timeval initial_connect_time;
actor_t login_timer;
actor_t nop_out_timer;
diff --git a/usr/iscsistart.c b/usr/iscsistart.c
index eb11bcc..cc57f1c 100644
--- a/usr/iscsistart.c
+++ b/usr/iscsistart.c
@@ -130,7 +130,7 @@ static int setup_session(void)
* For root boot we cannot change this so increase to account
* for boot using static setup.
*/
- config_rec.session.initial_login_retry_max = 120;
+ config_rec.session.initial_login_retry_max = 30;
/* we cannot answer so turn off */
config_rec.conn[0].timeo.noop_out_interval = 0;
config_rec.conn[0].timeo.noop_out_timeout = 0;

View File

@ -1,68 +0,0 @@
commit 9d9425eb31ecc3d1501da83e8e9becaec441b4c7
Author: Hannes Reinecke <hare@suse.de>
Date: Thu Nov 20 15:40:10 2008 +0100
Do not use a pid file for start scripts
open-iscsi works perfectly without a pid file. So don't create one.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/etc/initd/boot.suse b/etc/initd/boot.suse
index 3e93cad..83875e2 100644
--- a/etc/initd/boot.suse
+++ b/etc/initd/boot.suse
@@ -17,10 +17,9 @@
### END INIT INFO
ISCSIADM=/sbin/iscsiadm
-PID_FILE=/var/run/iscsi.pid
CONFIG_FILE=/etc/iscsid.conf
DAEMON=/sbin/iscsid
-ARGS="-c $CONFIG_FILE -p $PID_FILE"
+ARGS="-c $CONFIG_FILE"
# Source LSB init functions
. /etc/rc.status
diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse
index 69b681b..11ee4d2 100644
--- a/etc/initd/initd.suse
+++ b/etc/initd/initd.suse
@@ -16,11 +16,10 @@
#
### END INIT INFO
-PID_FILE=/var/run/iscsi.pid
CONFIG_FILE=/etc/iscsi/iscsid.conf
DAEMON=/sbin/iscsid
ISCSIADM=/sbin/iscsiadm
-ARGS="-c $CONFIG_FILE -p $PID_FILE"
+ARGS="-c $CONFIG_FILE -n"
# Source LSB init functions
. /etc/rc.status
@@ -105,7 +104,6 @@ iscsi_list_all_nodes()
case "$1" in
start)
- [ ! -d /var/lib/iscsi ] && mkdir -p /var/lib/iscsi
if checkproc $DAEMON ; then
RETVAL=0
else
@@ -122,15 +120,14 @@ case "$1" in
;;
stop)
iscsi_umount_all_luns
+ echo -n "Stopping iSCSI initiator service: "
if iscsi_logout_all_nodes ; then
killproc -KILL $DAEMON
RETVAL=$?
else
RETVAL=1
fi
- echo -n "Stopping iSCSI initiator service: "
if [ "$RETVAL" == "0" ]; then
- rm -f $PID_FILE
status=0
modprobe -r iscsi_tcp
if [ "$?" -ne "0" -a "$?" -ne "1" ]; then

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c20a5413448f91a51b6005b9ecebac1485a5f8b66004e762e02f9c1c3b2fdf5f
size 5401

View File

@ -1,119 +0,0 @@
From 5ebb5dbca96a0854bd0c3306a42fac7c4ebefe61 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 15:24:21 +0100
Subject: [PATCH] iscsid: Implement --no-pid-file
For root on iSCSI scenarios the /var directory might not exist.
And we don't need the pid file anyway as the daemon is synchronized
via the IPC connection.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
doc/iscsid.8 | 3 +++
usr/iscsid.c | 40 ++++++++++++++++++++++++----------------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/doc/iscsid.8 b/doc/iscsid.8
index 1dfa1e5..92b7f81 100644
--- a/doc/iscsid.8
+++ b/doc/iscsid.8
@@ -35,6 +35,9 @@ run under user ID \fIuid\fR (default is the current user ID)
.BI [-g|--gid=]\fIgid\fP
run under user group ID \fIgid\fR (default is the current user group ID).
.TP
+.BI [-n|--no-pid-file]\fP
+do not write a process ID file.
+.TP
.BI [-p|--pid=]\fIpid\-file\fP
write process ID to \fIpid\-file\fR rather than the default
\fI/var/run/iscsid.pid\fR
diff --git a/usr/iscsid.c b/usr/iscsid.c
index 578a206..3da235b 100644
--- a/usr/iscsid.c
+++ b/usr/iscsid.c
@@ -59,6 +59,7 @@ static struct option const long_options[] = {
{"debug", required_argument, NULL, 'd'},
{"uid", required_argument, NULL, 'u'},
{"gid", required_argument, NULL, 'g'},
+ {"no-pid-file", no_argument, NULL, 'n'},
{"pid", required_argument, NULL, 'p'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
@@ -80,6 +81,7 @@ Open-iSCSI initiator daemon.\n\
-d, --debug debuglevel print debugging information\n\
-u, --uid=uid run as uid, default is current user\n\
-g, --gid=gid run as gid, default is current user group\n\
+ -n, --no-pid-file do not use a pid file\n\
-p, --pid=pidfile use pid file (default " PID_FILE ").\n\
-h, --help display this help and exit\n\
-v, --version display version and exit\n\
@@ -332,7 +334,7 @@ int main(int argc, char *argv[])
sigaction(SIGPIPE, &sa_new, &sa_old );
sigaction(SIGTERM, &sa_new, &sa_old );
- while ((ch = getopt_long(argc, argv, "c:i:fd:u:g:p:vh", long_options,
+ while ((ch = getopt_long(argc, argv, "c:i:fd:nu:g:p:vh", long_options,
&longindex)) >= 0) {
switch (ch) {
case 'c':
@@ -353,6 +355,9 @@ int main(int argc, char *argv[])
case 'g':
gid = strtoul(optarg, NULL, 10);
break;
+ case 'n':
+ pid_file = NULL;
+ break;
case 'p':
pid_file = optarg;
break;
@@ -404,13 +409,15 @@ int main(int argc, char *argv[])
if (log_daemon) {
char buf[64];
- int fd;
-
- fd = open(pid_file, O_WRONLY|O_CREAT, 0644);
- if (fd < 0) {
- log_error("Unable to create pid file");
- log_close(log_pid);
- exit(1);
+ int fd = -1;
+
+ if (pid_file) {
+ fd = open(pid_file, O_WRONLY|O_CREAT, 0644);
+ if (fd < 0) {
+ log_error("Unable to create pid file");
+ log_close(log_pid);
+ exit(1);
+ }
}
pid = fork();
if (pid < 0) {
@@ -428,15 +435,16 @@ int main(int argc, char *argv[])
}
chdir("/");
- if (lockf(fd, F_TLOCK, 0) < 0) {
- log_error("Unable to lock pid file");
- log_close(log_pid);
- exit(1);
+ if (fd > 0) {
+ if (lockf(fd, F_TLOCK, 0) < 0) {
+ log_error("Unable to lock pid file");
+ log_close(log_pid);
+ exit(1);
+ }
+ ftruncate(fd, 0);
+ sprintf(buf, "%d\n", getpid());
+ write(fd, buf, strlen(buf));
}
- ftruncate(fd, 0);
- sprintf(buf, "%d\n", getpid());
- write(fd, buf, strlen(buf));
-
daemon_init();
} else {
if ((control_fd = ipc->ctldev_open()) < 0) {
--
1.6.0.2

View File

@ -1,29 +0,0 @@
Subject: Comment out unused definitions in log.c
From: Hannes Reinecke <hare@suse.de>
Date: Fri Dec 5 08:56:45 2008 +0100:
Git: ceb0079d1fd46ee67e585d02543400004490877c
dump_line and dump_char are never used. So comment them out.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/usr/log.c b/usr/log.c
index 4351456..0fb1595 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -308,6 +308,7 @@ void log_debug(int level, const char *fmt, ...)
}
}
+#if 0
static void __dump_line(int level, unsigned char *buf, int *cp)
{
char line[16*3+5], *lp = line;
@@ -341,6 +342,7 @@ static void __dump_char(int level, unsigned char *buf, int *cp, int ch)
#define dump_line() __dump_line(level, char_buf, &char_cnt)
#define dump_char(ch) __dump_char(level, char_buf, &char_cnt, ch)
+#endif
static void log_flush(void)
{

View File

@ -1,24 +0,0 @@
commit b6b41fcd43f7426ef6b10cf4faf0f50d3a4bbe54
Author: Hannes Reinecke <hare@suse.de>
Date: Wed Dec 3 16:11:03 2008 +0100
Remove trailing tilde from iface.example
There was a stale tilde in iface.example, causing the iscsiadm
to barf.
References: 450870
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/etc/iface.example b/etc/iface.example
index 020b002..aa41ce7 100644
--- a/etc/iface.example
+++ b/etc/iface.example
@@ -60,5 +60,5 @@
# the same subnet.
# iface.net_ifacename = eth0
# iface.ipaddress = 102.50.50.101
-~
+

View File

@ -1,21 +0,0 @@
commit de8a96fe313aecaf73e94810b571f342f627e288
Author: Erez Zilber <erezzi.list@gmail.com>
Date: Wed Oct 22 12:00:00 2008 +0200
rm unused variable in fw_entry.c
Signed-off-by: Erez Zilber <erezzi.list@gmail.com>
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c
index 915bbb7..fbfa3dd 100644
--- a/utils/fwparam_ibft/fw_entry.c
+++ b/utils/fwparam_ibft/fw_entry.c
@@ -38,8 +38,6 @@ int fw_get_entry(struct boot_context *context, const char *filepath)
*/
static void dump_mac(struct boot_context *context)
{
- int i;
-
if (!strlen(context->mac))
return;

View File

@ -1,35 +0,0 @@
From 96de3656d3eb10dedcee1d9b31156f35bf519d17 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 15:28:46 +0100
Subject: [PATCH] Allow LOCK_DIR to be set via CFLAGS
For root on iSCSI we have to move idbm's LOCK_DIR to eg /etc/iscsi,
as the /var directory might not be available. So make it configurable
during compile-time.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
usr/initiator.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/usr/initiator.h b/usr/initiator.h
index 682ebfc..033cce9 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -39,9 +39,11 @@
#define INITIATOR_NAME_FILE ISCSI_CONFIG_ROOT"initiatorname.iscsi"
#define PID_FILE "/var/run/iscsid.pid"
+#ifndef LOCK_DIR
#define LOCK_DIR "/var/lock/iscsi"
-#define LOCK_FILE "/var/lock/iscsi/lock"
-#define LOCK_WRITE_FILE "/var/lock/iscsi/lock.write"
+#endif
+#define LOCK_FILE LOCK_DIR"/lock"
+#define LOCK_WRITE_FILE LOCK_DIR"/lock.write"
typedef enum iscsi_conn_state_e {
STATE_FREE,
--
1.6.0.2

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:afd88eed2d2f3860f406e1232cbc681a6a3580bba9a8309726ef211c76c4cb61
size 2551

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:461b8ce6f45c1cf9f198b4b33bc159d370b0d02eae893c351139268eae52d540
size 40258

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e82d577fa79ed506e536b6318364745212cd2a2b530506078f250ac45f59db03
size 17225

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:041f180b007883ee4a156ddae70998d8818ef46b684d0b8cd32b68dec769ac19
size 6522

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a0c6f2a84a9a11d909f835cf5a5c50f9ac7030e8d20d72f6b44b949d0fdf1fc1
size 881

View File

@ -1,13 +0,0 @@
diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse
index 23bbac0..d8b91cc 100644
--- a/etc/initd/initd.suse
+++ b/etc/initd/initd.suse
@@ -5,7 +5,7 @@
### BEGIN INIT INFO
# Provides: iscsi
# Required-Start: $network
-# Should-Start:
+# Should-Start: iscsitarget
# Required-Stop:
# Should-Stop:
# Default-Start: 3 5

View File

@ -1,250 +0,0 @@
From: Lee Duncan <lduncan@suse.com>
Subject: [PATCH] support non-root boot-time volumes
Support SUSE non-root boot-time volumes.
---
diff -Narup open-iscsi-2.0-870-rc1.orig/etc/initd/boot.suse open-iscsi-2.0-870-rc1/etc/initd/boot.suse
--- open-iscsi-2.0-870-rc1.orig/etc/initd/boot.suse 2013-01-08 15:11:27.694140109 -0800
+++ open-iscsi-2.0-870-rc1/etc/initd/boot.suse 2013-01-08 15:53:57.486120236 -0800
@@ -31,13 +31,17 @@ ARGS="-c $CONFIG_FILE"
#
iscsi_mark_root_nodes()
{
+ echo -n "Marking iSCSI targets needed at boot time: "
+ rc_failed 5
$ISCSIADM -m session 2> /dev/null | while read t num i target ; do
ip=${i%%:*}
STARTUP=`$ISCSIADM -m node -p $ip -T $target 2> /dev/null | grep "node.conn\[0\].startup" | cut -d' ' -f3`
if [ "$STARTUP" -a "$STARTUP" != "onboot" ] ; then
$ISCSIADM -m node -p $ip -T $target -o update -n node.conn[0].startup -v onboot
+ rc_failed 0
fi
done
+ rc_status -v
}
# Reset status of this service
@@ -51,9 +55,11 @@ fi
case "$1" in
start)
- echo -n "Starting iSCSI initiator for the root device: "
- startproc $DAEMON $ARGS
- rc_status -v
+ if ! checkproc $DAEMON ; then
+ echo -n "Starting iSCSI initiator for the root device: "
+ startproc $DAEMON $ARGS
+ rc_status -v
+ fi
iscsi_mark_root_nodes
;;
stop|restart|reload)
diff -Narup open-iscsi-2.0-870-rc1.orig/etc/initd/initd.suse open-iscsi-2.0-870-rc1/etc/initd/initd.suse
--- open-iscsi-2.0-870-rc1.orig/etc/initd/initd.suse 2013-01-08 15:11:27.694140109 -0800
+++ open-iscsi-2.0-870-rc1/etc/initd/initd.suse 2013-01-09 14:56:25.263995190 -0800
@@ -60,7 +60,7 @@ iscsi_umount_all_luns()
{
local d m dev p s
- cat /proc/mounts | sed -ne '/^\/dev\/.*/p' | while read d m t o x; do
+ sed -ne '/^\/dev\/.*/p' /proc/mounts | while read d m t o x; do
if [ "$m" = "/" ] ; then
continue;
fi
@@ -93,6 +93,7 @@ iscsi_list_all_nodes()
{
# Check for active sessions
if $ISCSIADM -m session > /dev/null; then
+ echo "No active connections."
return 0
fi
echo "Active connections:"
diff -Narup open-iscsi-2.0-870-rc1.orig/etc/mkinitrd/mkinitrd-setup.sh open-iscsi-2.0-870-rc1/etc/mkinitrd/mkinitrd-setup.sh
--- open-iscsi-2.0-870-rc1.orig/etc/mkinitrd/mkinitrd-setup.sh 2013-01-08 15:11:27.670139620 -0800
+++ open-iscsi-2.0-870-rc1/etc/mkinitrd/mkinitrd-setup.sh 2013-01-09 14:36:49.394294388 -0800
@@ -2,69 +2,138 @@
#
#%stage: device
#
-check_iscsi_root() {
- local devname=$1
- local sysfs_path
-
- sysfs_path=$(/sbin/udevadm info -q path -n $devname 2> /dev/null)
- if [ -z "$sysfs_path" ] || [ ! -d /sys$sysfs_path ] ; then
- return;
+function verify_path()
+{
+ local devname="$1" path="$2"
+
+ if [[ ! -d "${path}" ]] ; then
+ if [[ "${path}" =~ .+\ .+ ]] ; then
+ error 2 "iSCSI device ${devname} is connected to more than one iSCSI target!"
+ # not reached
+ else
+ # does not seem to be an iSCSI attached device
+ return 1
+
+ fi
fi
+ return 0
+}
- pushd /sys$sysfs_path > /dev/null
- if [ ! -d device ] ; then
- cd ..
+function check_iscsi()
+{
+ local devname="$1" retval=1
+ local sysfs_path=$(/sbin/udevadm info -q path -n "${devname}" 2>/dev/null)
+ local ip target startup
+
+ # do we have a valid device?
+ [[ -z "${sysfs_path}" ]] && sysfs_path="/block${devname##/dev}"
+ sysfs_path="/sys${sysfs_path}"
+ [[ ! -d "${sysfs_path}" ]] && return 1 # no, return false
+
+ # Do we have a valid device link?
+ [[ ! -d "${sysfs_path}/device" ]] && sysfs_path="${sysfs_path%/*}"
+ [[ ! -d "${sysfs_path}/device" ]] && return 1 # no, return false
+
+ # Is device an iSCSI device?
+ sysfs_path="${sysfs_path}/device/../.."
+
+ ip="$(echo ${sysfs_path}/connection*)"
+ verify_path "${devname}" "${ip}" || return 1 # no, return false
+
+ ip="${ip}/iscsi_connection/${ip##*/}/persistent_"
+ [[ ! -r "${ip}address" || ! -r "${ip}port" ]] &&
+ error 2 "iSCSI device ${devname} connected to iSCSI target without any persistent_{address,port}!"
+ ip="$(cat "${ip}address"):$(cat "${ip}port")"
+
+ target=$(echo ${sysfs_path}/iscsi_session/*)
+ verify_path "${devname}" "${target}" || return 1 # no, return false
+
+ target="${target}/targetname"
+ [[ ! -r "${target}" ]] &&
+ error 2 "iSCSI device ${devname} connected to iSCSI target without any targetname!"
+ target="$(cat ${target})"
+
+ # figure out whether it has been correctly configured
+ [[ ! -x "${_iadm_}" ]] &&
+ error 2 "iSCSI device ${devname} connected to iSCSI target, but no ${_iadm_} command available!"
+
+ startup="$(
+ ${_iadm_} -m node -p "${ip}" -T "${target}" 2>/dev/null | grep 'node.conn\[0\].startup'
+ )"
+ startup="${startup##* }"
+ startup="${startup%% *}"
+ if [[ "${startup}" != "onboot" ]] ; then
+ [[ -z "${startup}" ]] && return 1 # Oops, no parameter - not an iSCSI, return false
+
+ ## Either:
+ #echo >&2 "WARNING: iSCSI device ${devname} is using 'node.conn[0].startup = ${startup}',"
+ #echo >&2 "WARNING: setting it to 'onboot' instead."
+ #${_iadm_} -m node -p "${ip}" -T "${target}" -o update -n 'node.conn[0].startup' -v onboot
+
+ ## or:
+ echo >&2 "WARNING: iSCSI device ${devname} is using 'node.conn[0].startup = ${startup}'!"
+ echo >&2 "WARNING: System not bootable with this setting, need to be set to 'onboot' instead, using:"
+ echo >&2 "
+ ${_iadm_} -m node -p '${ip}' -T '${target}' -o update -n 'node.conn[0].startup' -v onboot"
fi
- if [ ! -d device ] ; then
- # no device link; return
- popd > /dev/null
- return;
- fi
+ # attached to an iSCSI device
+ return 0
+}
- cd -P device
- cd ../..
- if [ -d connection* ]; then
- cd -P connection*
- cid=${PWD#*connection}
- sid=${cid%%:*}
- if [ -d /sys/class/iscsi_session/session$sid ]; then
- cd -P /sys/class/iscsi_session/session$sid
- echo $(basename $PWD)
- fi
- fi
- popd > /dev/null
-}
-for bd in $blockdev; do
+_iadm_="/sbin/iscsiadm"
+
+# Are system device(s) attached to iSCSI devices?
+# In case they are, ensure:
+# (1) the iSCSI gets included in "initrd", and
+# (2) the iSCSI sessions have been configured with
+# "node.conn[0].startup = onboot".
+for bd in $blockdev ; do
update_blockdev $bd
- sid=$(check_iscsi_root $bd)
- if [ "$sid" ]; then
- root_iscsi=1
- iscsi_sessions="$iscsi_sessions ${sid#session}"
- fi
+ check_iscsi $bd && root_iscsi=1
done
+# Are any of the defined file partitions to be mounted at system boot
+# attached to iSCSI devices? In case they are, ensure:
+# (1) the iSCSI gets included in "initrd", and
+# (2) the iSCSI sessions have been configured with
+# "node.conn[0].startup = onboot".
+for bd in $(awk '/^[[:space:]]*(\/dev\/|(LABEL|UUID)=)/ { print $1 }' /etc/fstab)
+do
+ bd="${bd/LABEL=//dev/disk/by-label/}"
+ bd="${bd/UUID=//dev/disk/by-uuid/}"
+ update_blockdev $bd
+ check_iscsi $bd && root_iscsi=1
+done
+
+# Include the iSCSI stack, when at least one active iSCSI session has
+# been configured with "node.conn[0].startup = onboot", even if it was
+# not used for a system device or mounted partition.
+if [[ -x "${_iadm_}" ]] ; then
+ for node in $(${_iadm_} -m node 2>/dev/null | sed -e 's/ /,/g') ; do
+ [[ "$(
+ ${_iadm_} -m node -T "${node##*,}" -p "${node%%,*}" 2>/dev/null |
+ grep "node.conn\[0\].startup"
+ )" =~ [[:space:]]*=[[:space:]]*onboot ]] && root_iscsi=1
+ done
+fi
+
+unset _iadm_
+
save_var root_iscsi
-save_var iscsi_sessions
if [ "${root_iscsi}" ]; then
- for session in $iscsi_sessions; do
- eval TargetName${session}=$(cat /sys/class/iscsi_session/session${session}/targetname)
- eval TargetAddress${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/address)
- eval TargetPort${session}=$(cat /sys/class/iscsi_connection/connection${session}:0/port)
-
- save_var TargetName${session}
- save_var TargetAddress${session}
- save_var TargetPort${session}
- done
# copy the iscsi configuration
cp -rp /etc/iscsi etc/
+
if [ -z "$interface" ] ; then
- interface="default"
+ interface="default" # needed?
fi
+
+ # In case target port was not defined via command line, assign default port
+ save_var TargetPort 3260
fi
-save_var TargetPort 3260 # in case the port was not defined via command line we assign a default port

View File

@ -1,89 +0,0 @@
diff --git a/Makefile b/Makefile
index e405c9c..58bb24d 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,7 @@ clean:
install_etc install_iface install_doc install_kernel install_iname
install: install_kernel install_programs install_doc install_etc \
- install_initd install_iname install_iface
+ install_initd install_iface
install_usr: install_programs install_doc install_etc \
install_initd install_iname install_iface
diff --git a/kernel/Makefile b/kernel/Makefile
index 3dae671..65a291a 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -32,11 +32,16 @@ V ?= 0
# eg to compile for a kernel that you aren't currently running
KERNELRELEASE ?= $(shell uname -r)
KSRC ?= /lib/modules/$(KERNELRELEASE)/build
+KSRC := $(shell test -f $(KSRC)/Makefile || echo "")
KBUILD_OUTPUT ?=
# this is the basic Kbuild invocation, just append your make target
KBUILD_BASE = +$(MAKE) -C $(KSRC) M=`pwd` KBUILD_OUTPUT=$(KBUILD_OUTPUT) $(KARCH) V=$(V)
-all: kernel_check
+all: kernel_src
+
+kernel_src: $(shell test -n "$(KSRC)" && echo has_kernel_src)
+
+has_kernel_src: kernel_check
$(KBUILD_BASE) modules
# ============ BEGIN code for kernel_check and source patching ================
@@ -59,9 +64,11 @@ cur_patched=cur_patched
# check to see if code is unpatched
unpatch_code=$(shell test -e $(cur_patched) && echo do_unpatch_code )
-KSUBLEVEL = $(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
+KSUBLEVEL = $(shell cat $(KSRC)/Makefile 2> /dev/null | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
sed 's/^[ \t]*//;s/[ \t]*$$//')
+KSUBLEVEL?=$(shell echo $(KERNELRELEASE) | sed -n 's/.\..\.\([[:digit:]]*\)\..*/\1/p')
+
KERNEL_TARGET=linux_2_6_$(KSUBLEVEL)
kernel_check: $(KERNEL_TARGET)
@@ -128,7 +135,11 @@ has_24_patch: $(24_patch)
# ============ END code for kernel_check and source patching =================
-clean: $(unpatch_code)
+clean: clean_kernel_src
+
+clean_kernel_src: $(shell test -n "$(KSRC)" && echo has_clean_kernel_src)
+
+has_clean_kernel_src: $(unpatch_code)
$(KBUILD_BASE) clean
rm -f Module.symvers
@@ -167,7 +178,9 @@ ko = $(patsubst %.o,%.ko,$(obj-m))
$(ko): all
# now the actual command
-install_kernel: $(ko)
+install_kernel: $(shell test -n "$(KSRC)" && echo install_kernel_obj);
+
+install_kernel_obj: $(ko)
$(KBUILD_BASE) modules_install INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) INSTALL_MOD_PATH=$(INSTALL_MOD_PATH)
dpkg_divert:
diff --git a/usr/Makefile b/usr/Makefile
index 7794831..840510d 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -7,9 +7,11 @@ OSNAME=$(shell uname -s)
KERNELRELEASE ?= $(shell uname -r)
KSRC ?= /lib/modules/$(KERNELRELEASE)/build
-KSUBLEVEL=$(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
+KSUBLEVEL=$(shell cat $(KSRC)/Makefile 2> /dev/null | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
sed 's/^[ \t]*//;s/[ \t]*$$//')
+KSUBLEVEL?=$(shell echo $OSNAME | sed -n 's/.\..\.\([[:digit:]]*\)\..*/\1/p')
+
ifeq ($(OSNAME),Linux)
ifeq ($(KSUBLEVEL),11)
IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE

View File

@ -1,82 +0,0 @@
commit 23a7691b724548cc096996ab8f1cb5823c573880
Author: Mike Christie <michaelc@cs.wisc.edu>
Date: Sat Sep 13 19:35:33 2008 -0500
Sync kernel modules with 2.6.27
Update kernel modules for 2.6.27 kernel API changes.
diff --git a/kernel/Makefile b/kernel/Makefile
index 139fd7b..7c5b5ac 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -101,6 +101,8 @@ linux_2_6_25: has_24_patch
linux_2_6_26: $(unpatch_code)
+linux_2_6_27: $(unpatch_code)
+
do_unpatch_code:
echo "Un-patching source code for use with linux-2.6.14 and up ..."
patch -R -E -p1 < $(cur_patched)
diff --git a/kernel/scsi_transport_iscsi.c b/kernel/scsi_transport_iscsi.c
index 535e461..7dfb7da 100644
--- a/kernel/scsi_transport_iscsi.c
+++ b/kernel/scsi_transport_iscsi.c
@@ -170,7 +170,7 @@ iscsi_create_endpoint(int dd_size)
int err;
for (id = 1; id < ISCSI_MAX_EPID; id++) {
- dev = class_find_device(&iscsi_endpoint_class, &id,
+ dev = class_find_device(&iscsi_endpoint_class, NULL, &id,
iscsi_match_epid);
if (!dev)
break;
@@ -219,14 +219,21 @@ EXPORT_SYMBOL_GPL(iscsi_destroy_endpoint);
struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle)
{
+ struct iscsi_endpoint *ep;
struct device *dev;
- dev = class_find_device(&iscsi_endpoint_class, &handle,
+ dev = class_find_device(&iscsi_endpoint_class, NULL, &handle,
iscsi_match_epid);
if (!dev)
return NULL;
- return iscsi_dev_to_endpoint(dev);
+ ep = iscsi_dev_to_endpoint(dev);
+ /*
+ * we can drop this now because the interface will prevent
+ * removals and lookups from racing.
+ */
+ put_device(dev);
+ return ep;
}
EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint);
@@ -240,8 +247,8 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev,
atomic_set(&ihost->nr_scans, 0);
mutex_init(&ihost->mutex);
- snprintf(ihost->scan_workq_name, KOBJ_NAME_LEN, "iscsi_scan_%d",
- shost->host_no);
+ snprintf(ihost->scan_workq_name, sizeof(ihost->scan_workq_name),
+ "iscsi_scan_%d", shost->host_no);
ihost->scan_workq = create_singlethread_workqueue(
ihost->scan_workq_name);
if (!ihost->scan_workq)
diff --git a/kernel/scsi_transport_iscsi.h b/kernel/scsi_transport_iscsi.h
index b7652e3..7013828 100644
--- a/kernel/scsi_transport_iscsi.h
+++ b/kernel/scsi_transport_iscsi.h
@@ -198,7 +198,7 @@ struct iscsi_cls_host {
atomic_t nr_scans;
struct mutex mutex;
struct workqueue_struct *scan_workq;
- char scan_workq_name[KOBJ_NAME_LEN];
+ char scan_workq_name[20];
};
extern void iscsi_host_for_each_session(struct Scsi_Host *shost,

View File

@ -1,81 +0,0 @@
--- open-iscsi-2.0-870-rc1/etc/initd/boot.suse
+++ open-iscsi-2.0-870-rc1/etc/initd/boot.suse
@@ -5,13 +5,15 @@
### BEGIN INIT INFO
# Provides: iscsiboot
# Required-Start: boot.proc
-# Should-Start:
-# Required-Stop:
+# Should-Start:
+# Required-Stop: $null
# Should-Stop:
# Default-Start: B
# Default-Stop:
-# Short-Description: Starts the iSCSI initiator daemon
-#
+# Short-Description: iSCSI initiator daemon root-fs support
+# Description: Starts the iSCSI initiator daemon if the
+# root-filesystem is on an iSCSI device
+#
### END INIT INFO
ISCSIADM=/sbin/iscsiadm
@@ -56,7 +58,7 @@
rc_status -v
iscsi_mark_root_nodes
;;
- stop)
+ stop|restart|reload)
rc_failed 0
;;
status)
@@ -68,13 +70,8 @@
rc_status -v
fi
;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
*)
- echo "Usage: $0 {start|stop|status|restart}"
+ echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
--- open-iscsi-2.0-870-rc1/etc/initd/initd.suse
+++ open-iscsi-2.0-870-rc1/etc/initd/initd.suse
@@ -6,11 +6,13 @@
# Provides: iscsi
# Required-Start: $network
# Should-Start: iscsitarget
-# Required-Stop:
-# Should-Stop:
+# Required-Stop: $network
+# Should-Stop: iscsitarget
# Default-Start: 3 5
# Default-Stop:
-# Short-Description: Starts and stops the iSCSI client initiator
+# Short-Description: iSCSI initiator daemon
+# Description: The iSCSI initator is used to create and
+# manage iSCSI connections to a iSCSI Target.
#
### END INIT INFO
@@ -190,13 +192,13 @@
rc_status -v
fi
;;
- restart)
+ restart|reload)
$0 stop
sleep 1
$0 start
;;
*)
- echo "Usage: $0 {start|stop|status|restart}"
+ echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac

View File

@ -1,113 +0,0 @@
From e734d56e6a45eb85cbd8d728310a793970e90757 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 12 Nov 2008 15:25:55 +0100
Subject: [PATCH] Update SUSE init scripts
Update SUSE init scripts to work properly for root-on-iSCSI.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
etc/initd/boot.suse | 15 +++++++--------
etc/initd/initd.suse | 36 ------------------------------------
2 files changed, 7 insertions(+), 44 deletions(-)
diff --git a/etc/initd/boot.suse b/etc/initd/boot.suse
index e4a54a6..3e93cad 100644
--- a/etc/initd/boot.suse
+++ b/etc/initd/boot.suse
@@ -4,7 +4,7 @@
#
### BEGIN INIT INFO
# Provides: iscsiboot
-# Required-Start: boot.proc
+# Required-Start:
# Should-Start:
# Required-Stop: $null
# Should-Stop:
@@ -26,16 +26,16 @@ ARGS="-c $CONFIG_FILE -p $PID_FILE"
. /etc/rc.status
#
-# This service is run right after booting. So all activated targets
-# must be enabled during mkinitrd run and thus should not be removed
-# when the open-iscsi service is stopped.
+# This service is run right after booting. So all targets activated
+# during mkinitrd run should not be removed when the open-iscsi
+# service is stopped.
#
iscsi_mark_root_nodes()
{
$ISCSIADM -m session 2> /dev/null | while read t num i target ; do
ip=${i%%:*}
- STARTUP=`$ISCSIADM -m node -p $ip -T $target | grep "node.conn\[0\].startup" | cut -d' ' -f3`
- if [ "$STARTUP" != "onboot" ] ; then
+ STARTUP=`$ISCSIADM -m node -p $ip -T $target 2> /dev/null | grep "node.conn\[0\].startup" | cut -d' ' -f3`
+ if [ "$STARTUP" -a "$STARTUP" != "onboot" ] ; then
$ISCSIADM -m node -p $ip -T $target -o update -n node.conn[0].startup -v onboot
fi
done
@@ -52,7 +52,6 @@ fi
case "$1" in
start)
- [ ! -d /var/lib/open-iscsi ] && mkdir -p /var/lib/open-iscsi
echo -n "Starting iSCSI initiator for the root device: "
startproc $DAEMON $ARGS
rc_status -v
diff --git a/etc/initd/initd.suse b/etc/initd/initd.suse
index 5c42b88..69b681b 100644
--- a/etc/initd/initd.suse
+++ b/etc/initd/initd.suse
@@ -103,38 +103,6 @@ iscsi_list_all_nodes()
done
}
-iscsi_discover_all_targets()
-{
- # Strip off any existing ID information
- RAW_NODE_LIST=`iscsiadm -m node | sed -nre 's/^(\[[0-9a-f]*\] )?(.*)$/\2/p'`
- # Obtain IPv4 list
- IPV4_NODE_LIST=`echo "$RAW_NODE_LIST" | sed -nre 's/^([0-9]{1,3}(\.[0-9]{1,3}){3}):[^: ]* (.*)$/\1 \3/p'`
- # Now obtain IPv6 list
- IPV6_NODE_LIST=`echo "$RAW_NODE_LIST" | sed -nre 's/^([0-9a-f]{1,4}(:[0-9a-f]{0,4}){6}:[0-9a-f]{1,4}):[^: ]* (.*)$/\1 \3/p'`
-
- DISC_TARGETS=""
- while read NODE_ADDR NODE_NAME; do
- [ -z "$NODE_ADDR" -a -z "$NODE_NAME" ] && continue
- NODE_ATTRS=`iscsiadm -m node -p "$NODE_ADDR" -T "$NODE_NAME"`
- NODE_STATUS=`echo "$NODE_ATTRS" | sed -nre 's/^.*node\.conn\[0\]\.startup = ([a-z]*).*$/\1/p'`
-
- if [ "$NODE_STATUS" == 'automatic' ]; then
- DISC_TARGETS=`echo "$DISC_TARGETS" | sed -re '/'"$NODE_ADDR"'/!{s/(.*)/\1 '"$NODE_ADDR"'/}'`
- fi
- done < <(echo "$IPV4_NODE_LIST"; echo "$IPV6_NODE_LIST")
-
- for TARGET_ADDR in $DISC_TARGETS; do
- echo -n "Attempting discovery on target at ${TARGET_ADDR}: "
- iscsiadm -m discovery -t st -p "$TARGET_ADDR" > /dev/null 2>&1
- if [ "$?" -ne 0 ]; then
- rc_failed 1
- rc_status -v
- return 1
- fi
- rc_status -v
- done
-}
-
case "$1" in
start)
[ ! -d /var/lib/iscsi ] && mkdir -p /var/lib/iscsi
@@ -149,10 +117,6 @@ case "$1" in
rc_status -v
fi
if [ "$RETVAL" == "0" ]; then
- iscsi_discover_all_targets
- RETVAL=$?
- fi
- if [ "$RETVAL" == "0" ]; then
iscsi_login_all_nodes
fi
;;
--
1.6.0.2

View File

@ -1,32 +1,374 @@
-------------------------------------------------------------------
Fri Jan 11 14:25:51 PST 2013 - lduncan@suse.com
Wed Jul 3 15:01:50 UTC 2013 - meissner@suse.com
- moved the open-iscsi branch to the SLES 11 SP3 codebase.
Update coalesces and drops patches:
iscsi-gen-initiatorname.sh
open-iscsi-2.0-870-rc1-static.patch
open-iscsi-2.0-870-rc1.tar.bz2
open-iscsi-add-error-msg-to-log.c
open-iscsi-add-mkinitrd-scriptlets
open-iscsi-add-rhel5-compat
open-iscsi-add-sles10-compat
open-iscsi-allow-onboot-for-loginall
open-iscsi-beta5-kernel-patch-update
open-iscsi.changes
open-iscsi-cxgb3i-support
open-iscsi-error-check-in-db-lock-creation
open-iscsi-fix-sysfs-get-value-null.patch
open-iscsi-fixup-onboot-for-loginall
open-iscsi-fw-crash-on-ppc
open-iscsi-fwparam_ppc-string-overflow
open-iscsi-header.patch
open-iscsi-initiator-compile-warning
open-iscsi-install-mkinitrd-scriptlets
open-iscsi-iscsid-adjust-settings
open-iscsi-iscsi_discovery-doc-fixes
open-iscsi-load-ibft-before-reading-sys-firmware
open-iscsi-login-retry-update
open-iscsi-no-pid-file
open-iscsi-option-no-pid-file
open-iscsi-remove-dump-char
open-iscsi-remove-trailing-tilde
open-iscsi-rm-unused-variable
open-iscsi-set-LOCK_DIR-during-compilation
open-iscsi.spec
open-iscsi-start-target-before-initiator
open-iscsi-support-non-root-boot-volume.patch
open-iscsi-suse-build-fixes
open-iscsi-sync-modules-with-2.6.27
open-iscsi-update-init-script
open-iscsi-update-suse-init-scripts
- New patches:
open-iscsi-openSUSE-12.3-first-merge.diff.bz2
open-iscsi-sles11-sp2-latest.diff.bz2
open-iscsi-sles11-sp2-update.diff.bz2
open-iscsi-sles11-sp3-flash-update.diff.bz2
open-iscsi-sles11-sp3-general-updates-1.diff.bz2
open-iscsi-sles11-sp3-iscsiuio-update.diff.bz2
-------------------------------------------------------------------
Wed Jun 5 15:53:34 PDT 2013 - lduncan@suse.com
- check return from nice() correctly (bnc#807936)
-------------------------------------------------------------------
Tue Jun 4 11:27:55 PDT 2013 - lduncan@suse.com
- Branched from SLES 11 SP3
- Modified for openSUSE by removing iscsiuio references, and
by changing service name from open-iscsi to iscsid (bnc#821695)
-------------------------------------------------------------------
Thu May 23 19:24:20 PDT 2013 - lduncan@suse.com
- Adds support to be able to use isns discovery and
bind the portals found to offload ifaces (bnc#820881)
-------------------------------------------------------------------
Fri May 17 18:34:23 PDT 2013 - lduncan@suse.com
- Now handles boot-time non-root iSCSI volumes (bnc#630434)
-------------------------------------------------------------------
Thu May 9 10:32:17 PDT 2013 - lduncan@suse.com
- Fixed iscsiadm name/value command-line parsing
bug caused by previous update (bnc#818517)
-------------------------------------------------------------------
Fri Apr 5 11:04:21 PDT 2013 - lduncan@suse.com
- Added iscsiadm support for user management of target adapter
flash (bnc#810208)
-------------------------------------------------------------------
Thu Mar 14 13:19:32 PDT 2013 - lduncan@suse.com
- Add open-iscsi-support-non-root-boot-volume.patch: handle non-
root boot-time iscsi volumes (bnc#630434)
- Add open-iscsi-fix-sysfs-get-value-null.patch: accept "(null)"
password as meaning no password, when using sysfs (bnc#766300)
-------------------------------------------------------------------
Mon Mar 11 15:20:47 PDT 2013 - lduncan@suse.com
- Updated iscsiuio to latest (bnc#769125)
-------------------------------------------------------------------
Fri Sep 7 10:19:41 PDT 2012 - lduncan@suse.com
- Added iscsiuio patches and other cleanup (bnc#751056)
-------------------------------------------------------------------
Thu Jun 21 11:12:01 PDT 2012 - lduncan@suse.com
- Updated open-iscsi to version 2.0.873 (bnc#751056)
- Updated iscsiuio to version 0.7.4.3, to match
-------------------------------------------------------------------
Mon Feb 6 15:57:43 CET 2012 - hare@suse.de
- Do not install initiatorname.iscsi (bnc#742430)
- iscsi_offload: Fixup qla4xxx booting (bnc#742570)
-------------------------------------------------------------------
Fri Feb 3 12:38:57 CET 2012 - hare@suse.de
- Append '.suse' to version string (bnc#713975)
- iscsiadm dumps core on invalid config file (bnc#742570)
- Load iscsi_tcp kernel modules unconditionally (bnc#738040)
-------------------------------------------------------------------
Fri Dec 9 15:09:01 CET 2011 - hare@suse.de
- iscsiadm: Return correct error when login fails (bnc#715071)
- Add bnx2i to list of modules (bnc#718014)
- iscsi_offload: Configure interface from iBFT
- Allow modifications for iface.gateway and iface.subnet_mask
- Remove OFFLOAD_BOOT_SUPPORTED define
- iscsiadm: Allow -d flag for firmware mode
- iscsid prints invalid log message
- Start iscsiuio early in boot.open-iscsi (bnc#731216)
-------------------------------------------------------------------
Mon Nov 28 16:20:20 CET 2011 - hare@suse.de
- Enable offload interfaces from iscsi_offload script (bnc#730157)
-------------------------------------------------------------------
Fri Nov 25 15:18:49 CET 2011 - hare@suse.de
- Start iscsiuio manually again (bnc#732798)
- Remove compat code from iscsiuio
- Fixup build warnings
- Add uip_broadcast() header declaration
- Handle error when starting iscsiuio from iscsid
- Fixup definition for krecv_conn_state()
- Include iscsi-gen-initiatorname script
- Update mkinitrd scripts for iSCSI offload boot (bnc#732634)
- Added launching of iscsiuio before session sync (bnc#731216)
-------------------------------------------------------------------
Fri Nov 4 09:15:52 CET 2011 - hare@suse.de
- Update iscsiuio to 0.7.0.14g (bnc#726708)
- Merge with mainline:
* Update for mixed mode on qla4xxx (bnc#727415)
* Fix printing of unknown host values in iscsiadm
* Fix IPv6 ibft/firmware boot
* Remove iSNS RFC files
- Stop iscsiuio when run inside initrd (bnc#728095)
-------------------------------------------------------------------
Thu Oct 27 09:25:02 UTC 2011 - aj@suse.de
- Rename init scripts (bnc#661401).
-------------------------------------------------------------------
Mon Oct 24 09:13:19 CEST 2011 - hare@suse.de
- Update iscsiuio to 0.7.0.14f (bnc#687392)
- Default iscsid version to 872 for iscsiuio (bnc#687392)
-------------------------------------------------------------------
Mon Oct 10 13:46:21 CEST 2011 - hare@suse.de
- Update iscsi_offload script (bnc#718014)
- Fixup mac address calculation
- Fixup iscsi_offload script to work on qla4xxx (bnc#722268)
-------------------------------------------------------------------
Fri Oct 7 16:17:58 CEST 2011 - hare@suse.de
- Fix build error.
-------------------------------------------------------------------
Thu Oct 6 19:07:04 CEST 2011 - hare@suse.de
- Merge with mainline:
* Include qla4xxx support (bnc#722268)
* Multiple sessions from single iface (bnc#713975)
- Fix memory leak when parsing config file
-------------------------------------------------------------------
Mon Sep 19 11:52:52 CEST 2011 - hare@suse.de
- Update iscsiuio to 0.7.0.14d (bnc#687392)
- Fixup README (bnc#711953)
- Start iscsiuio from iscsid (bnc#718014)
-------------------------------------------------------------------
Fri Sep 16 16:30:05 CEST 2011 - hare@suse.de
- Update iscsiuio to 0.7.0.14 (bnc#687392)
-------------------------------------------------------------------
Fri Jul 29 14:53:55 CEST 2011 - hare@suse.de
- iscsi fails to start with bnx2i offloading (bnc#708261)
- /etc/init.d/open-iscsi fails to shutdown daemon on 'stop'
- Add 'iscsi_offload' script (FATE#311488)
- Configure all interfaces from iBFT (FATE#311345)
-------------------------------------------------------------------
Mon Jul 18 10:02:49 CEST 2011 - hare@suse.de
- Update iscsi_uio to version 0.7.0.8 (bnc#687392)
- Add uip callbacks (bnc#687392)
- Fixup spec file to refer to iscsiuio
-------------------------------------------------------------------
Tue Jun 21 15:09:46 CEST 2011 - hare@suse.de
- Update to version 2.0-872 (FATE#312030)
- Update brcm_iscsi_uio to version 0.7.0.4 (FATE#312028)
- Rediff patches to apply to upstream codebase
- Include scripts for automated build
-------------------------------------------------------------------
Mon Jun 6 09:20:29 UTC 2011 - aj@suse.de
- Fix build with newer glibc.
-------------------------------------------------------------------
Wed Feb 2 11:32:12 CET 2011 - mweckbecker@suse.de
- Fix the following issues:
bnc#608224: iscsi stop fails though root is not on iSCSI device-
FIXUP
bnc#435689: root on multipath iSCSI SLES10 SP2 host occasionally
hangs
bnc#455995: iSCSI connections should not get closed if unmount
fails
-------------------------------------------------------------------
Mon Jan 31 10:25:12 CET 2011 - mweckbecker@suse.de
- open-iscsi-start-multipath-before-iscsi: updated to apply w/
fuzz=0
-------------------------------------------------------------------
Fri Jul 30 10:55:05 CEST 2010 - hare@suse.de
- Parse iface entry correctly in init script
- Tear down block device stack on 'open-iscsi stop' (bnc#608224)
-------------------------------------------------------------------
Mon Jun 28 15:33:06 CEST 2010 - hare@suse.de
- open-iscsi stop returns 'failed' for root on iSCSI (bnc#608224)
- Extract correct session information for firmware sessions
(bnc#617883)
- Start multipathd before open-iscsi (bnc#603382)
-------------------------------------------------------------------
Mon Apr 26 14:47:47 CEST 2010 - ro@suse.de
- also enter boot.multipath in Should-Stop
-------------------------------------------------------------------
Mon Apr 26 11:42:49 CEST 2010 - hare@suse.de
- Start boot.multipath prior to boot.open-iscsi (bnc#595629)
-------------------------------------------------------------------
Tue Apr 20 16:53:52 CEST 2010 - hare@suse.de
- Do send SIGTERM to pid 0 (bnc#589064)
-------------------------------------------------------------------
Thu Apr 15 09:35:24 CEST 2010 - hare@suse.de
- Set correct 'interface' variable for mkinitrd (bnc#596627)
-------------------------------------------------------------------
Tue Apr 13 09:03:11 CEST 2010 - hare@suse.de
- Remove ibft mkinitrd scripts.
-------------------------------------------------------------------
Mon Apr 12 16:40:27 CEST 2010 - hare@suse.de
- Only set nettype to 'dhcp' if a valid DHCP address was found
(bnc#576601)
- Do not print 'umounting failed' on shutdown (bnc#581259)
-------------------------------------------------------------------
Fri Mar 26 16:22:01 CET 2010 - hare@suse.de
- Do no umount root fs on shutdown (bnc#581259)
-------------------------------------------------------------------
Thu Mar 25 15:46:40 CET 2010 - hare@suse.de
- Update brcm_uio daemon to version 0.5.7 (bnc#576601)
- Load transport modules if configured (bnc#590531)
-------------------------------------------------------------------
Fri Mar 12 18:05:27 CET 2010 - mmarek@suse.cz
- Do not hardcode the iscsi_ibft module in the iscsi mkinitrd
script, the ibft script handles this correctly (bnc#528657).
-------------------------------------------------------------------
Fri Mar 12 15:57:43 CET 2010 - hare@suse.de
- Don't close sessions if umount fails (bnc#581259)
-------------------------------------------------------------------
Mon Feb 22 16:06:55 CET 2010 - hare@suse.de
- Start brcm_uio daemon conditionally if HW is present (bnc#576601)
-------------------------------------------------------------------
Mon Feb 15 18:12:41 CET 2010 - mmarek@suse.de
- Include <sys/types.h> for pid_t.
-------------------------------------------------------------------
Mon Feb 8 16:19:20 CET 2010 - hare@suse.de
- Add brcm_uio daemon for bnx2i iSCSI offload (bnc#576601)
-------------------------------------------------------------------
Thu Dec 17 14:20:45 CET 2009 - hare@suse.de
- Do not modify network parameter when iBFT is not found
(bnc#562030)
- Use correct value for iBFT 'origin' parameter (bnc#565116)
-------------------------------------------------------------------
Thu Dec 10 11:17:57 CET 2009 - hare@suse.de
- iscsiadm fails to read ibft (bnc#561596)
-------------------------------------------------------------------
Wed Nov 18 10:33:27 CET 2009 - hare@suse.de
- Update to 2.0-871 (FATE#307216)
- Renumber patches
- Add mkinitrd scriptlet for iBFT setup (bnc#541892)
- Fall back to kernel name in mkinitrd setup if udev fails
- Allow empty usernames for CHAP
- Read initiatorname correctly from sysfs (bnc#541882)
-------------------------------------------------------------------
Tue Nov 3 19:09:35 UTC 2009 - coolo@novell.com
- updated patches to apply with fuzz=0
-------------------------------------------------------------------
Wed Aug 19 12:58:13 CEST 2009 - hare@suse.de
- Synchronize startup settings (bnc#514273)
- Fix daemon segfault with CHAP (bnc#519402)
- Do not use temp file in iscsi_discovery (bnc#528711)
-------------------------------------------------------------------
Sun Jun 21 14:36:45 CEST 2009 - crrodriguez@suse.de
@ -34,12 +376,22 @@ Sun Jun 21 14:36:45 CEST 2009 - crrodriguez@suse.de
- do not use static libc, this does not work in reality, use
of getaddrinfo(3) requires shared libraries at runtime
-------------------------------------------------------------------
Tue Feb 10 10:56:19 CET 2009 - hare@suse.de
- search_ibft() might crash when no iBFT is found (bnc#471475)
-------------------------------------------------------------------
Mon Jan 26 11:51:54 CET 2009 - ro@suse.de
- change fillup call from "-Y" to "-y" the boot script has
been present in this package for long enough (SLES10-GA)
-------------------------------------------------------------------
Thu Jan 22 13:41:40 CET 2009 - hare@suse.de
- Fix relogin retry handling (bnc#466846)
-------------------------------------------------------------------
Mon Dec 8 15:43:29 CET 2008 - hare@suse.de

View File

@ -20,50 +20,24 @@ Name: open-iscsi
BuildRequires: bison
BuildRequires: db-devel
BuildRequires: flex
BuildRequires: openssl-devel
Url: http://www.open-iscsi.org
PreReq: %fillup_prereq %insserv_prereq
Version: 2.0.870
Version: 2.0.873
Release: 0
Provides: linux-iscsi
Obsoletes: linux-iscsi
%define iscsi_release 865
%define iscsi_release 873
Summary: Linux* Open-iSCSI Software Initiator
License: GPL-2.0+
Group: Productivity/Networking/Other
Source: %{name}-2.0-870-rc1.tar.bz2
Source11: iscsi-gen-initiatorname.sh
Patch1: %{name}-start-target-before-initiator
Patch2: %{name}-suse-build-fixes
Patch3: %{name}-fwparam_ppc-string-overflow
Patch4: %{name}-update-init-script
Patch5: %{name}-add-rhel5-compat
Patch6: %{name}-add-sles10-compat
Patch7: %{name}-iscsid-adjust-settings
Patch8: %{name}-login-retry-update
Patch9: %{name}-beta5-kernel-patch-update
Patch10: %{name}-error-check-in-db-lock-creation
Patch11: %{name}-initiator-compile-warning
Patch12: %{name}-iscsi_discovery-doc-fixes
Patch13: %{name}-rm-unused-variable
Patch14: %{name}-add-error-msg-to-log.c
Patch15: %{name}-sync-modules-with-2.6.27
Patch16: %{name}-allow-onboot-for-loginall
Patch17: %{name}-option-no-pid-file
Patch18: %{name}-update-suse-init-scripts
Patch19: %{name}-set-LOCK_DIR-during-compilation
Patch20: %{name}-add-mkinitrd-scriptlets
Patch21: %{name}-install-mkinitrd-scriptlets
Patch22: %{name}-no-pid-file
Patch23: %{name}-cxgb3i-support
Patch24: %{name}-fw-crash-on-ppc
Patch25: %{name}-fixup-onboot-for-loginall
Patch26: %{name}-remove-dump-char
Patch27: %{name}-load-ibft-before-reading-sys-firmware
Patch28: %{name}-remove-trailing-tilde
Patch29: open-iscsi-2.0-870-rc1-static.patch
Patch30: %{name}-header.patch
Patch31: %{name}-fix-sysfs-get-value-null.patch
Patch32: %{name}-support-non-root-boot-volume.patch
Source: %{name}-2.0-%{iscsi_release}.tar.bz2
Patch1: %{name}-sles11-sp2-update.diff.bz2
Patch2: %{name}-sles11-sp2-latest.diff.bz2
Patch3: %{name}-sles11-sp3-iscsiuio-update.diff.bz2
Patch4: %{name}-sles11-sp3-flash-update.diff.bz2
Patch5: %{name}-sles11-sp3-general-updates-1.diff.bz2
Patch6: %{name}-openSUSE-12.3-first-merge.diff.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -92,51 +66,30 @@ Authors:
open-iscsi@googlegroups.com
%prep
%setup -n %{name}-2.0-870-rc1
%setup -n %{name}-2.0-%{iscsi_release}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29
%patch30 -p1
%patch31 -p1
%patch32 -p1
%build
%{__make} OPTFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -DLOCK_DIR=\\\"/etc/iscsi\\\""
%{__make} OPTFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -DLOCK_DIR=\\\"/etc/iscsi\\\"" user
%install
make DESTDIR=${RPM_BUILD_ROOT} install
make DESTDIR=${RPM_BUILD_ROOT} install_user
make DESTDIR=${RPM_BUILD_ROOT} install_initd_suse
install -D -m 755 %{S:11} ${RPM_BUILD_ROOT}/sbin/iscsi-gen-initiatorname
mv ${RPM_BUILD_ROOT}/etc/init.d/boot.open-iscsi ${RPM_BUILD_ROOT}/etc/init.d/boot.iscsid-early
mv ${RPM_BUILD_ROOT}/etc/init.d/open-iscsi ${RPM_BUILD_ROOT}/etc/init.d/iscsid
(cd ${RPM_BUILD_ROOT}/sbin; ln -sf /etc/init.d/iscsid rciscsid)
# rename open-iscsi service to iscsid for openSUSE
mv ${RPM_BUILD_ROOT}/etc/init.d/boot.open-iscsi \
${RPM_BUILD_ROOT}/etc/init.d/boot.iscsid-early
mv ${RPM_BUILD_ROOT}/etc/init.d/open-iscsi \
${RPM_BUILD_ROOT}/etc/init.d/iscsid
# create rc shortcut
[ -d ${RPM_BUILD_ROOT}/usr/sbin ] || mkdir -p ${RPM_BUILD_ROOT}/usr/sbin
ln -sf ../../etc/init.d/iscsid ${RPM_BUILD_ROOT}/usr/sbin/rciscsid
(cd ${RPM_BUILD_ROOT}/etc; ln -sf iscsi/iscsid.conf iscsid.conf)
touch ${RPM_BUILD_ROOT}/etc/iscsi/initiatorname.iscsi
%clean
[ "${RPM_BUILD_ROOT}" != "/" -a -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
@ -159,12 +112,14 @@ fi
%defattr(-,root,root)
%dir /etc/iscsi
%attr(0600,root,root) %config(noreplace) /etc/iscsi/iscsid.conf
%ghost /etc/iscsi/initiatorname.iscsi
%dir /etc/iscsi/ifaces
%config /etc/iscsi/ifaces/iface.example
/etc/iscsid.conf
%config /etc/init.d/iscsid
%config /etc/init.d/boot.iscsid-early
/sbin/*
/usr/sbin/rciscsid
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/setup-iscsi.sh