rpms/scsi-target-utils/devel scsi-target-utils-dynamic-link-iser.patch, NONE, 1.1 scsi-target-utils-hack-check-for-eventfd.patch, NONE, 1.1 scsi-target-utils-redhatify-docs.patch, NONE, 1.1 sysconfig.tgtd, NONE, 1.1 targets.conf, NONE, 1.1 .cvsignore, 1.6, 1.7 scsi-target-utils.spec, 1.13, 1.14 sources, 1.6, 1.7 tgtd.init, 1.1, 1.2 tgt-0.9.5-makefile.patch, 1.1, NONE tgt-20080805-shebang.patch, 1.1, NONE

Hans de Goede jwrdegoede at fedoraproject.org
Tue Dec 22 11:12:22 UTC 2009


Author: jwrdegoede

Update of /cvs/pkgs/rpms/scsi-target-utils/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16825

Modified Files:
	.cvsignore scsi-target-utils.spec sources tgtd.init 
Added Files:
	scsi-target-utils-dynamic-link-iser.patch 
	scsi-target-utils-hack-check-for-eventfd.patch 
	scsi-target-utils-redhatify-docs.patch sysconfig.tgtd 
	targets.conf 
Removed Files:
	tgt-0.9.5-makefile.patch tgt-20080805-shebang.patch 
Log Message:
* Mon Dec 21 2009 Hans de Goede <hdegoede at redhat.com> - 0.9.11-1.20091205snap
- Rebase to 0.9.11 + some fixes from git (git id
  97832d8dcd00202a493290b5d134b581ce20885c)
- Rewrite initscript, make it follow:
  http://fedoraproject.org/wiki/Packaging/SysVInitScript
  And merge in RHEL-5 initscript improvements:
  - Parse /etc/tgt/targets.conf, which allows easy configuration of targets
  - Better initiator status checking in stop
  - Add force-stop, to stop even when initiators are still connected
  - Make reload reload configuration from /etc/tgt/targets.conf without
    stopping tgtd (but only for unused targets)
  - Add force-reload (reloads configs for all targets including busy ones)


scsi-target-utils-dynamic-link-iser.patch:
 Makefile           |    5 -
 iscsi/iscsi_rdma.c |  214 +++++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 194 insertions(+), 25 deletions(-)

--- NEW FILE scsi-target-utils-dynamic-link-iser.patch ---
diff --git a/usr/Makefile b/usr/Makefile
index 2dcae2a..78be3e1 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -17,12 +17,13 @@ TGTD_OBJS += $(addprefix iscsi/, conn.o param.o session.o \
 		isns.o)
 TGTD_OBJS += bs_rdwr.o bs_aio.o
 
-ifneq ($(ISCSI_RDMA),)
-CFLAGS += -DISCSI_RDMA
+ifneq ($(findstring verbs.h,$(wildcard /usr/include/infiniband/*.h)), )
+ifneq ($(findstring rdma_cma.h,$(wildcard /usr/include/rdma/*.h)), )
 TGTD_OBJS += iscsi/iscsi_rdma.o
 LIBS += -libverbs -lrdmacm
 endif
 endif
+endif
 
 ifneq ($(FCP),)
 CFLAGS += -DFCP -DUSE_KERNEL
diff --git a/usr/iscsi/iscsi_rdma.c b/usr/iscsi/iscsi_rdma.c
index 6cf5677..72e4eaf 100644
--- a/usr/iscsi/iscsi_rdma.c
+++ b/usr/iscsi/iscsi_rdma.c
@@ -30,6 +30,8 @@
 #include <sys/epoll.h>
 #include <infiniband/verbs.h>
 #include <rdma/rdma_cma.h>
+#include <dlfcn.h>
+#include <syslog.h>
 
 #include "util.h"
 #include "iscsid.h"
@@ -283,6 +285,67 @@ static void iser_sched_poll_cq(struct event_data *tev);
 static void iser_sched_consume_cq(struct event_data *tev);
 static void iser_sched_tx(struct event_data *evt);
 
+
+static void *pverbs;
+static void *prdma;
+typedef void (*ibv_ack_cq_events_t)(struct ibv_cq *cq, unsigned int nevents);
+typedef struct ibv_pd *(*ibv_alloc_pd_t)(struct ibv_context *context);
+typedef struct ibv_comp_channel *(*ibv_create_comp_channel_t)(struct ibv_context *context);
+typedef struct ibv_cq *(*ibv_create_cq_t)(struct ibv_context *context, int cqe,
+                              void *cq_context,
+                              struct ibv_comp_channel *channel,
+                              int comp_vector);
+typedef int (*ibv_dereg_mr_t)(struct ibv_mr *mr);
+typedef int (*ibv_destroy_qp_t)(struct ibv_qp *qp);
+typedef int (*ibv_get_cq_event_t)(struct ibv_comp_channel *channel,
+                      struct ibv_cq **cq, void **cq_context);
+typedef int (*ibv_query_device_t)(struct ibv_context *context,
+                      struct ibv_device_attr *device_attr);
+typedef struct ibv_mr *(*ibv_reg_mr_t)(struct ibv_pd *pd, void *addr,
+                          size_t length, enum ibv_access_flags access);
+typedef int (*rdma_ack_cm_event_t)(struct rdma_cm_event *event);
+typedef int (*rdma_bind_addr_t)(struct rdma_cm_id *id, struct sockaddr *addr);
+typedef struct rdma_event_channel *(*rdma_create_event_channel_t)(void);
+typedef int (*rdma_create_id_t)(struct rdma_event_channel *channel,
+                   struct rdma_cm_id **id, void *context,
+                   enum rdma_port_space ps);
+typedef int (*rdma_create_qp_t)(struct rdma_cm_id *id, struct ibv_pd *pd,
+                   struct ibv_qp_init_attr *qp_init_attr);
+typedef int (*rdma_destroy_id_t)(struct rdma_cm_id *id);
+typedef int (*rdma_disconnect_t)(struct rdma_cm_id *id);
+typedef int (*rdma_get_cm_event_t)(struct rdma_event_channel *channel,
+                      struct rdma_cm_event **event);
+typedef int (*rdma_listen_t)(struct rdma_cm_id *id, int backlog);
+typedef int (*rdma_accept_t)(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
+typedef int (*rdma_reject_t)(struct rdma_cm_id *id, const void *private_data,
+                uint8_t private_data_len);
+
+typedef struct {
+	ibv_ack_cq_events_t ibv_ack_cq_events;
+	ibv_alloc_pd_t ibv_alloc_pd;
+	ibv_create_comp_channel_t ibv_create_comp_channel;
+	ibv_create_cq_t ibv_create_cq;
+	ibv_dereg_mr_t ibv_dereg_mr;
+	ibv_destroy_qp_t ibv_destroy_qp;
+	ibv_get_cq_event_t ibv_get_cq_event;
+	ibv_query_device_t ibv_query_device;
+	ibv_reg_mr_t ibv_reg_mr;
+	rdma_ack_cm_event_t rdma_ack_cm_event;
+	rdma_bind_addr_t rdma_bind_addr;
+	rdma_create_event_channel_t rdma_create_event_channel;
+	rdma_create_id_t rdma_create_id;
+	rdma_create_qp_t rdma_create_qp;
+	rdma_destroy_id_t rdma_destroy_id;
+	rdma_disconnect_t rdma_disconnect;
+	rdma_get_cm_event_t rdma_get_cm_event;
+	rdma_listen_t rdma_listen;
+	rdma_accept_t rdma_accept;
+	rdma_reject_t rdma_reject;
+} tgt_fptr_t;
+
+static tgt_fptr_t tgt_fptr;
+
+
 /*
  * Called when ready for full feature, builds resources.
  */
@@ -308,7 +371,7 @@ static int iser_init_comm(struct conn_info *conn)
 		goto out;
 	}
 
-	conn->srmr = ibv_reg_mr(conn->dev->pd, conn->srbuf, size,
+	conn->srmr = tgt_fptr.ibv_reg_mr(conn->dev->pd, conn->srbuf, size,
 				IBV_ACCESS_LOCAL_WRITE);
 	if (!conn->srmr) {
 		eprintf("register srbuf\n");
@@ -415,7 +478,7 @@ static int iser_init_comm_login(struct conn_info *conn)
 		goto out;
 	}
 
-	conn->srmr_login = ibv_reg_mr(conn->dev->pd, conn->srbuf_login, size,
+	conn->srmr_login = tgt_fptr.ibv_reg_mr(conn->dev->pd, conn->srbuf_login, size,
 				      IBV_ACCESS_LOCAL_WRITE);
 	if (!conn->srmr_login) {
 		eprintf("ibv_reg_mr srbuf failed\n");
@@ -495,7 +558,7 @@ static void iser_free_comm(struct conn_info *ci)
 
 	/* release mr and free the lists */
 	dprintf("dereg mr %p\n", ci->srmr);
-	ret = ibv_dereg_mr(ci->srmr);
+	ret = tgt_fptr.ibv_dereg_mr(ci->srmr);
 	if (ret)
 		eprintf("ibv_dereg_mr\n");
 	free(ci->srbuf);
@@ -515,7 +578,7 @@ static void iser_free_comm_login(struct conn_info *ci)
 	dprintf("freeing, login phase %d\n", ci->login_phase);
 
 	/* release mr and free the lists */
-	ret = ibv_dereg_mr(ci->srmr_login);
+	ret = tgt_fptr.ibv_dereg_mr(ci->srmr_login);
 	if (ret)
 		eprintf("ibv_dereg_mr\n");
 	free(ci->srbuf_login);
@@ -546,7 +609,7 @@ static int iser_init_mempool(struct iser_device *dev)
 		return -ENOMEM;
 	}
 
-	dev->mempool_mr = ibv_reg_mr(dev->pd, regbuf,
+	dev->mempool_mr = tgt_fptr.ibv_reg_mr(dev->pd, regbuf,
 				     mempool_num * mempool_size,
 				     IBV_ACCESS_LOCAL_WRITE);
 	if (!dev->mempool_mr) {
@@ -583,7 +646,7 @@ static int iser_device_init(struct iser_device *dev)
 	int ret = -1;
 
 	dprintf("dev %p\n", dev);
-	dev->pd = ibv_alloc_pd(dev->ibv_hndl);
+	dev->pd = tgt_fptr.ibv_alloc_pd(dev->ibv_hndl);
 	if (dev->pd == NULL) {
 		eprintf("ibv_alloc_pd failed\n");
 		goto out;
@@ -595,7 +658,7 @@ static int iser_device_init(struct iser_device *dev)
 		goto out;
 	}
 
-	ret = ibv_query_device(dev->ibv_hndl, &device_attr);
+	ret = tgt_fptr.ibv_query_device(dev->ibv_hndl, &device_attr);
 	if (ret < 0) {
 		eprintf("ibv_query_device: %m\n");
 		goto out;
@@ -604,13 +667,13 @@ static int iser_device_init(struct iser_device *dev)
 	dprintf("max %d CQEs\n", cqe_num);
 
 	ret = -1;
-	dev->cq_channel = ibv_create_comp_channel(dev->ibv_hndl);
+	dev->cq_channel = tgt_fptr.ibv_create_comp_channel(dev->ibv_hndl);
 	if (dev->cq_channel == NULL) {
 		eprintf("ibv_create_comp_channel failed: %m\n");
 		goto out;
 	}
 
-	dev->cq = ibv_create_cq(dev->ibv_hndl, cqe_num, NULL,
+	dev->cq = tgt_fptr.ibv_create_cq(dev->ibv_hndl, cqe_num, NULL,
 				dev->cq_channel, 0);
 	if (dev->cq == NULL) {
 		eprintf("ibv_create_cq failed: %m\n");
@@ -729,7 +792,7 @@ static void iser_accept_connection(struct rdma_cm_event *event)
 	/* only generate completion queue entries if requested */
 	qp_init_attr.sq_sig_all = 0;
 
-	ret = rdma_create_qp(ci->cma_id, dev->pd, &qp_init_attr);
+	ret = tgt_fptr.rdma_create_qp(ci->cma_id, dev->pd, &qp_init_attr);
 	if (ret) {
 		eprintf("create qp failed\n");
 		goto free_conn;
@@ -759,7 +822,7 @@ static void iser_accept_connection(struct rdma_cm_event *event)
 	}
 
 	/* now we can actually accept the connection */
-	ret = rdma_accept(ci->cma_id, &conn_param);
+	ret = tgt_fptr.rdma_accept(ci->cma_id, &conn_param);
 	if (ret) {
 		eprintf("rdma_accept failed\n");
 		iser_free_comm_login(ci);
@@ -772,7 +835,7 @@ free_conn:
 	conn_exit(conn);
 	free(ci);
 reject:
-	ret = rdma_reject(event->id, NULL, 0);
+	ret = tgt_fptr.rdma_reject(event->id, NULL, 0);
 	if (ret)
 		eprintf("rdma_reject failed: %s\n", strerror(-ret));
 }
@@ -836,7 +899,7 @@ static void iser_handle_rdmacm(int fd __attribute__((unused)),
 	struct rdma_cm_id *destroy_cm_id = NULL;
 
 	dprintf("entry\n");
-	ret = rdma_get_cm_event(rdma_evt_channel, &event);
+	ret = tgt_fptr.rdma_get_cm_event(rdma_evt_channel, &event);
 	if (ret) {
 		eprintf("rdma_get_cm_event failed\n");
 		return;
@@ -859,14 +922,14 @@ static void iser_handle_rdmacm(int fd __attribute__((unused)),
 		break;
 	}
 
-	ret = rdma_ack_cm_event(event);
+	ret = tgt_fptr.rdma_ack_cm_event(event);
 	if (ret) {
 		eprintf("ack cm event failed\n");
 		return;
 	}
 
 	if (destroy_cm_id) {
-		ret = rdma_destroy_id(destroy_cm_id);
+		ret = tgt_fptr.rdma_destroy_id(destroy_cm_id);
 		if (ret)
 			eprintf("rdma_destroy_id failed\n");
 	}
@@ -1089,13 +1152,13 @@ static void iser_cqe_handler(int fd __attribute__((unused)),
 	void *cq_context;
 	int ret;
 
-	ret = ibv_get_cq_event(dev->cq_channel, &dev->cq, &cq_context);
+	ret = tgt_fptr.ibv_get_cq_event(dev->cq_channel, &dev->cq, &cq_context);
 	if (ret != 0) {
 		eprintf("notification, but no CQ event\n");
 		exit(1);
 	}
 
-	ibv_ack_cq_events(dev->cq, 1);
+    tgt_fptr.ibv_ack_cq_events(dev->cq, 1);
 
 	/* if a poll was previosuly scheduled, remove it,
 	   as it will be scheduled when necessary */
@@ -1148,14 +1211,14 @@ static int iscsi_rdma_init(void)
 	struct sockaddr_in sock_addr;
 	short int port = iscsi_listen_port;
 
-	rdma_evt_channel = rdma_create_event_channel();
+	rdma_evt_channel = tgt_fptr.rdma_create_event_channel();
 
 	if (!rdma_evt_channel) {
 		eprintf("cannot initialize RDMA; load kernel modules?\n");
 		return -1;
 	}
 
-	ret = rdma_create_id(rdma_evt_channel, &cma_listen_id, NULL,
+	ret = tgt_fptr.rdma_create_id(rdma_evt_channel, &cma_listen_id, NULL,
 			     RDMA_PS_TCP);
 	if (ret) {
 		eprintf("rdma_create_id: %s\n", strerror(ret));
@@ -1166,7 +1229,7 @@ static int iscsi_rdma_init(void)
 	sock_addr.sin_family = AF_INET;
 	sock_addr.sin_port = htons(port);
 	sock_addr.sin_addr.s_addr = INADDR_ANY;
-	ret = rdma_bind_addr(cma_listen_id, (struct sockaddr *) &sock_addr);
+	ret = tgt_fptr.rdma_bind_addr(cma_listen_id, (struct sockaddr *) &sock_addr);
 	if (ret) {
 		if (ret == -1)
 			eprintf("rdma_bind_addr -1: %m\n");
@@ -1176,7 +1239,7 @@ static int iscsi_rdma_init(void)
 	}
 
 	/* 0 == maximum backlog */
-	ret = rdma_listen(cma_listen_id, 0);
+	ret = tgt_fptr.rdma_listen(cma_listen_id, 0);
 	if (ret) {
 		if (ret == -1)
 			eprintf("rdma_listen -1: %m\n");
@@ -1574,7 +1637,7 @@ static size_t iscsi_rdma_close(struct iscsi_connection *conn)
 	struct conn_info *ci = RDMA_CONN(conn);
 	int ret;
 
-	ret = rdma_disconnect(ci->cma_id);
+	ret = tgt_fptr.rdma_disconnect(ci->cma_id);
 	if (ret)
 		eprintf("rdma_disconnect: %s\n", strerror(-ret));
 	dprintf("did rdma_disconnect\n");
@@ -1607,7 +1670,7 @@ static void iscsi_rdma_release(struct iscsi_connection *conn)
 		iser_free_comm(ci);
 
 	/* finally destory QP */
-	ret = ibv_destroy_qp(ci->qp_hndl);
+	ret = tgt_fptr.ibv_destroy_qp(ci->qp_hndl);
 	if (ret)
 		eprintf("ibv_destroy_qp: %s\n", strerror(-ret));
 
@@ -1744,7 +1807,112 @@ static struct iscsi_transport iscsi_iser = {
 	.ep_getpeername		= iscsi_rdma_getpeername,
 };
 
+
+int is_dlerror(const char *symbol)
+{
+	char *error;
+
+	if ((error = dlerror()) != NULL) {
+		syslog(LOG_ERR, "symbol %s not found - %s", symbol, error);
+		return 1;
+	}
+	return 0;
+}
+
+
+
 __attribute__((constructor)) static void iser_transport_init(void)
 {
+	pverbs = dlopen("libibverbs.so",RTLD_LAZY);
+	if (!pverbs) {
+		goto Exit; /* do not register iser transport */
+	}
+
+	prdma = dlopen("librdmacm.so",RTLD_LAZY);
+	if (!prdma) {
+		goto Exit; /* do not register iser transport */
+	}
+
+	/* initialize function pointers */
+	tgt_fptr.ibv_ack_cq_events = dlsym(pverbs, "ibv_ack_cq_events");
+	if (is_dlerror("ibv_ack_cq_events"))
+		goto Exit;
+	tgt_fptr.ibv_alloc_pd = dlsym(pverbs, "ibv_alloc_pd");
+	if (is_dlerror("ibv_alloc_pd"))
+		goto Exit;
+	tgt_fptr.ibv_create_comp_channel = dlsym(pverbs, "ibv_create_comp_channel");
+	if (is_dlerror("ibv_create_comp_channel"))
+		goto Exit;
+	tgt_fptr.ibv_create_cq = dlsym(pverbs, "ibv_create_cq");
+	if (is_dlerror("ibv_create_cq"))
+		goto Exit;
+	tgt_fptr.ibv_dereg_mr = dlsym(pverbs, "ibv_dereg_mr");
+	if (is_dlerror("ibv_dereg_mr"))
+		goto Exit;
+	tgt_fptr.ibv_destroy_qp = dlsym(pverbs, "ibv_destroy_qp");
+	if (is_dlerror("ibv_destroy_qp"))
+		goto Exit;
+	tgt_fptr.ibv_get_cq_event = dlsym(pverbs, "ibv_get_cq_event");
+	if (is_dlerror("ibv_get_cq_event"))
+		goto Exit;
+	tgt_fptr.ibv_query_device = dlsym(pverbs, "ibv_query_device");
+	if (is_dlerror("ibv_query_device"))
+		goto Exit;
+	tgt_fptr.ibv_reg_mr = dlsym(pverbs, "ibv_reg_mr");
+	if (is_dlerror("ibv_reg_mr"))
+		goto Exit;
+	tgt_fptr.rdma_ack_cm_event = dlsym(prdma, "rdma_ack_cm_event");
+	if (is_dlerror("rdma_ack_cm_event"))
+		goto Exit;
+	tgt_fptr.rdma_bind_addr = dlsym(prdma, "rdma_bind_addr");
+	if (is_dlerror("rdma_bind_addr"))
+		goto Exit;
+	tgt_fptr.rdma_create_event_channel = dlsym(prdma, "rdma_create_event_channel");
+	if (is_dlerror("rdma_create_event_channel"))
+		goto Exit;
+	tgt_fptr.rdma_create_id = dlsym(prdma, "rdma_create_id");
+	if (is_dlerror("rdma_create_id"))
+		goto Exit;
+	tgt_fptr.rdma_create_qp = dlsym(prdma, "rdma_create_qp");
+	if (is_dlerror("rdma_create_qp"))
+		goto Exit;
+	tgt_fptr.rdma_destroy_id = dlsym(prdma, "rdma_destroy_id");
+	if (is_dlerror("rdma_destroy_id"))
+		goto Exit;
+	tgt_fptr.rdma_disconnect = dlsym(prdma, "rdma_disconnect");
+	if (is_dlerror("rdma_disconnect"))
+		goto Exit;
+	tgt_fptr.rdma_get_cm_event = dlsym(prdma, "rdma_get_cm_event");
+	if (is_dlerror("rdma_get_cm_event"))
+		goto Exit;
+	tgt_fptr.rdma_listen = dlsym(prdma, "rdma_listen");
+	if (is_dlerror("rdma_listen"))
+		goto Exit;
+	tgt_fptr.rdma_accept = dlsym(prdma, "rdma_accept");
+	if (is_dlerror("rdma_accept"))
+		goto Exit;
+	tgt_fptr.rdma_reject = dlsym(prdma, "rdma_reject");
+	if (is_dlerror("rdma_reject"))
+		goto Exit;
+
+	syslog(LOG_INFO, "iser transport register");
 	iscsi_transport_register(&iscsi_iser);
+	return;
+
+Exit:
+	syslog(LOG_ERR, "%s - iser transport not used", dlerror());
+	if (pverbs)
+		dlclose(pverbs);
+	if (prdma)
+		dlclose(prdma);
 }
+
+__attribute__((destructor)) static void iser_transport_close(void)
+{
+	syslog(LOG_INFO, "iser transport register");
+	if (pverbs)
+		dlclose(pverbs);
+	if (prdma)
+		dlclose(prdma);
+}
+

scsi-target-utils-hack-check-for-eventfd.patch:
 bs_aio.c |    5 +++++
 bs_aio.h |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

--- NEW FILE scsi-target-utils-hack-check-for-eventfd.patch ---
diff --git a/usr/bs_aio.c b/usr/bs_aio.c
index 0d6a640..794018a 100644
--- a/usr/bs_aio.c
+++ b/usr/bs_aio.c
@@ -124,6 +124,11 @@ static int bs_aio_init(struct scsi_lu *lu)
 	struct bs_aio_info *info =
 		(struct bs_aio_info *) ((char *)lu + sizeof(*lu));
 
+	if (__NR_eventfd < 0) {
+		eprintf("aio not suppored on this ARCH at this time.\n");
+		return -1;
+	}
+
 	ret = io_setup(MAX_AIO_REQS, &info->ctx);
 	if (ret) {
 		eprintf("fail to create aio_queue, %m\n");
diff --git a/usr/bs_aio.h b/usr/bs_aio.h
index f62e99c..b5c4bf9 100644
--- a/usr/bs_aio.h
+++ b/usr/bs_aio.h
@@ -53,7 +53,7 @@ enum {
 #elif defined(__sparc__) || defined(__sparc64__)
 #define __NR_eventfd 313
 #else
-#error Cannot detect your architecture
+#define __NR_eventfd -1
 #endif
 #endif
 

scsi-target-utils-redhatify-docs.patch:
 README           |   17 -----------------
 doc/README.iscsi |   16 +++++++++-------
 doc/README.iser  |   37 +++++++++++++++----------------------
 3 files changed, 24 insertions(+), 46 deletions(-)

--- NEW FILE scsi-target-utils-redhatify-docs.patch ---
diff --git a/README b/README
index 22785fc..22b963f 100644
--- a/README
+++ b/README
@@ -9,17 +9,6 @@ Currently, tgt supports the following target drivers:
 
 - iSER software target driver for Infiniband and RDMA NICs
 
-- IBM System p VIO server
-
-- FCoE software target driver for Ethernet NICs (in progress)
-
-- Qlogic qla2xxx FC target driver (in progress)
-
-Tgt consists of kernel modules, user-space daemon, and user-space
-tools. iSCSI, iSER, and FCoE target drivers use only user-space daemon
-and tools (i.e. they are just user-space applications. They don't need
-any kernel support).
-
 tgt can emulate the following device types:
 
 - SBC: a virtual disk drive that can use a file to store the content.
@@ -40,12 +29,6 @@ store the content (in progress).
 The code is under the GNU General Public License version 2.
 
 
-Preparation
--------------
-Target drivers have their own ways to build, configure, etc. So find
-an appropriate documentation in the doc directory.
-
-
 Developer Notes
 -------------
 The central resource for tgt development is the mailing list
diff --git a/doc/README.iscsi b/doc/README.iscsi
index 321b1d8..cd63de2 100644
--- a/doc/README.iscsi
+++ b/doc/README.iscsi
@@ -1,25 +1,27 @@
 Preface
 -------------
-This show a simple example to set up some targets.
+This shows a simple example to set up some targets.
 
+See man tgt-admin and the example /etc/tgt/targets.conf
+file for how to setup a persistent configuration that is
+started when the tgtd service is started (when "service tgtd start"
+is run).
 
 Starting the daemon
 -------------
 The iSCSI target driver works with the 2.6.X kernels.
 
-First, you need to compile the source code:
-
-host:~/tgt/usr$ make ISCSI=1
-
 Try the following commands:
 
 host:~/tgt$ su
-host:~/tgt# ./usr/tgtd
+host:~/tgt# service tgtd start
 
 
 Configuration
 -------------
-Everyting is configured via the tgtadm management tool.
+When started, the tgtd service will setup targets defined in
+/etc/tgt/targets.conf. To manually configure a target tgtadm
+or tgt-admin can be used.
 
 The following example creates a target with id 1 (the iqn is
 iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz) and adds a
diff --git a/doc/README.iser b/doc/README.iser
index 2361c4e..92edc61 100644
--- a/doc/README.iser
+++ b/doc/README.iser
@@ -1,6 +1,21 @@
 iSCSI Extensions for RDMA (iSER)
 ================================
 
+This is an detailed description of the iSER tgtd target. It
+covers issues from the design to how to manually set it up.
+
+NOTE:
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+To run this iSER target you must have installed the libiverbs
+and librdma rpms on your system. They will not get brought in
+automatically when installing this rpm.
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+See man tgt-admin and the example /etc/tgt/targets.conf
+file for how to setup a persistent configuration that is
+started when the tgtd service is started (when "service tgtd start"
+is run).
+
 Copyright (C) 2007 Pete Wyckoff <pw at osc.edu>
 
 Background
@@ -156,28 +171,6 @@ the Linux initiator does not add padding either.
 Using iSER
 ----------
 
-Compile tgtd with "make ISCSI=1 ISCSI_RDMA=1" to build iSCSI and iSER.
-You'll need to have two libraries installed on your system:
-libibverbs.so and librdmacm.so.  If they are installed in the normal
-system paths (/usr/include and /usr/lib or /usr/lib64), they will be
-found automatically.  Otherwise, edit CFLAGS and LIBS in usr/Makefile
-near ISCSI_RDMA to specify the paths by hand, e.g., for a /usr/local
-install, it should look like:
-
-	ifneq ($(ISCSI_RDMA),)
-	CFLAGS += -DISCSI_RDMA -I/usr/local/include
-	TGTD_OBJS += iscsi/iscsi_rdma.o
-	LIBS += -L/usr/local/lib -libverbs -lrdmacm
-	endif
-
-If these libraries are not in the normal system paths, you may
-possibly also have to set, e.g., LD_LIBRARY_PATH=/usr/local/lib
-in your environment to find the shared libraries at runtime.
-
-The target will listen on all TCP interfaces (as usual), as well as all
-RDMA devices.  Both use the same default iSCSI port, 3260.  Clients on
-TCP or RDMA will connect to the same tgtd instance.
-
 Start the daemon (as root):
 
 	./tgtd


--- NEW FILE sysconfig.tgtd ---
# configuration file
#TGTD_CONFIG=/etc/tgt/targets.conf


--- NEW FILE targets.conf ---
# This is a sample config file for tgt-admin.
# By default, tgt-admin looks for its config file in /etc/tgt/targets.conf
#
# The "#" symbol disables the processing of a line.


# This one includes other config files:

#include /etc/tgt/temp/*.conf


# Set the driver. If not specified, defaults to "iscsi".

default-driver iscsi


# Continue if tgtadm exits with non-zero code (equivalent of
# --ignore-errors command line option)
#ignore-errors yes


# Sample target with one LUN only. Defaults to allow access for all initiators:

#<target iqn.2008-09.com.example:server.target1>
#    backing-store /dev/LVM/somedevice
#</target>


# Similar, but we use "direct-store" instead of "backing-store".
# "direct-store" reads drive parameters with sg_inq command and sets them to
# the target.
# Parameters fatched with sg_inq are:
# - Vendor identification
# - Product identification
# - Product revision level
# - Unit serial number (if present)
# We also specify "incominguser".

#<target iqn.2008-09.com.example:server.target2>
#    direct-store /dev/sdd
#    incominguser someuser secretpass12
#</target>


# An example with multiple LUNs, disabled write-cache (tgtd enables write-cache
# by default) and vendor identification set to "MyVendor"

#<target iqn.2008-09.com.example:server.target3>
#    backing-store /dev/LVM/somedevice1	# Becomes LUN 1
#    backing-store /dev/LVM/somedevice2	# Becomes LUN 2
#    backing-store /dev/LVM/somedevice3	# Becomes LUN 3
#    write-cache off
#    vendor_id MyCompany Inc.
#</target>


# Similar to the one above, but we fetch vendor_id, product_id, product_rev and
# scsi_sn from the disks.
# Vendor identification (vendor_id) is replaced in all disks by "MyVendor"

#<target iqn.2008-09.com.example:server.target4>
#    direct-store /dev/sdb	# Becomes LUN 1
#    direct-store /dev/sdc	# Becomes LUN 2
#    direct-store /dev/sdd	# Becomes LUN 3
#    write-cache off
#    vendor_id MyCompany Inc.
#</target>


# Note that "first-device-first-lun numbering" will work only for simple
# scenarios above, where _only_ direct-store _or_ backing-store is used.
# If you mix backing-store and direct-store, then all backing-store entries
# are processed before direct-store-entries.

#<target iqn.2008-09.com.example:server.target4>
#    direct-store /dev/sdb	# Becomes LUN 3
#    backing-store /dev/sdc	# Becomes LUN 1
#    direct-store /dev/sdd	# Becomes LUN 4
#    backing-store /dev/sde	# Becomes LUN 2
#</target>


# Even more complicated example - each device has different parameters.
# You can use indentation to make the config file more readable.
# Note that LUNs will be assigned more or less randomly here (and still
# backing-store get LUNs assigned before drect-store).
# You can specify multiple mode_page parameters (they are commented out
# in this example).
# Note that some parameters (write-cache, scsi_sn) were specified "globally".
# "Global" parameters will be applied to all LUNs; they can be overwritten
# "locally", per LUN.
# If lun is not specified, it will be allocated automatically (first available).

#<target iqn.2008-09.com.example:server.target5>

#    <direct-store /dev/sdd>
#	vendor_id VENDOR1
#	removable 1
#	device-type cd
#	lun 1
#    </direct-store>

#    <direct-store /dev/sda>
#	vendor_id VENDOR2
#	lun 2
#    </direct-store>

#    <backing-store /dev/sdb1>
#	vendor_id back1
#	scsi_sn SERIAL
#	write-cache on
	# lun 3		# lun is commented out - will be allocated automatically
#   </backing-store>

#    <backing-store /dev/sdd1>
#	vendor_id back2
	#mode_page 8:0:18:0x10:0:0xff....
	#mode_page 8:0:18:0x10:0:0xff....
	#bs-type aio
#	lun 15
#    </backing-store>

    # Some more parameters which can be specified locally or globally:
    #scsi_id ...
    #scsi_sn ...
    #vendor_id ...
    #product_id ...
    #product_rev ...
    #sense_format ...
    #removable ...
    #online ...
    #path ...
    #mode_page 8:0:18:0x10:0:0xff....
    #mode_page 8:0:18:0x10:0:0xff....
    #device-type ...
    #bs-type ...	# backing store type - default rdwr, can be aio, mmap, etc...
    #allow-in-use yes	# if specified globally, can't be overwritten locally

#    write-cache off
#    scsi_sn multipath-10

    # Parameters below are only global. They can't be configured per LUN.
    # Only allow connections from 192.168.100.1 and 192.168.200.5
#    initiator-address 192.168.100.1
#    initiator-address 192.168.200.5

    # Tuning parameters (global, per target)
    #MaxRecvDataSegmentLength 8192
    #MaxXmitDataSegmentLength 8192
    #HeaderDigest None
    #DataDigest None
    #InitialR2T Yes
    #MaxOutstandingR2T 1
    #ImmediateData Yes
    #FirstBurstLength 65536
    #MaxBurstLength 262144
    #DataPDUInOrder Yes
    #DataSequenceInOrder Yes
    #ErrorRecoveryLevel 0
    #IFMarker No
    #OFMarker No
    #DefaultTime2Wait 2
    #DefaultTime2Retain 20
    #OFMarkInt Reject
    #IFMarkInt Reject
    #MaxConnections 1

    # Allowed incoming users
#    incominguser user1 secretpass12
#    incominguser user2 secretpass23

    # Outgoing user
#    outgoinguser userA secretpassA

#</target>


# The device will have lun 1 unless you specify something else
#<target iqn.2008-09.com.example:server.target6>
#    backing-store /dev/LVM/somedevice
#    lun 10
#</target>


# Devices which are in use (by system: mounted, for swap, part of RAID, or by
# userspace: dd, by tgtd for another target etc.) can't be used, unless you use
# --force flag or add 'allow-in-use yes' option
#<target iqn.2008-09.com.example:server.target7>
#    backing-store /dev/LVM/somedevice
#    allow-in-use yes
#</target>

#<target iqn.2008-09.com.example:server.target8>
#    <backing-store /dev/LVM/somedevice>
#        scsi_sn serial1
#    </backing-store>

#    <backing-store /dev/LVM/somedevice2>
#        scsi_sn serial2
#    </backing-store>

#    allow-in-use yes
#</target>





# Not supported configurations, and therefore, commented out:

#<target iqn.2008-09.com.example:server.target9>
#    backing-store /dev/LVM/somedevice1
#    backing-store /dev/LVM/somedevice2
#    lun 10
#    lun 11
#</target>

#<target iqn.2008-09.com.example:server.target10>
#    <direct-store /dev/sdd>
#        vendor_id VENDOR1
#    </direct-store>
#
#    direct-store /dev/sdc
#</target>

# This one will break the parser:

#<target iqn.2008-09.com.example:server.target11>
#    <direct-store /dev/sdd>
#        vendor_id VENDOR1
#    </direct-store>
#
#    direct-store /dev/sdc
#
#    <direct-store /dev/sdd>
#        vendor_id VENDOR1
#    </direct-store>
#</target>


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/scsi-target-utils/devel/.cvsignore,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- .cvsignore	17 Mar 2009 08:23:28 -0000	1.6
+++ .cvsignore	22 Dec 2009 11:12:20 -0000	1.7
@@ -1 +1 @@
-tgt-0.9.5.tar.bz2
+tgt-20091205.tar.bz2


Index: scsi-target-utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/scsi-target-utils/devel/scsi-target-utils.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- scsi-target-utils.spec	21 Aug 2009 15:47:07 -0000	1.13
+++ scsi-target-utils.spec	22 Dec 2009 11:12:21 -0000	1.14
@@ -1,62 +1,75 @@
+%define         date 20091205
+
 Name:           scsi-target-utils
-Version:        0.9.5
-Release:        3%{?dist}
+Version:        0.9.11
+Release:        1.%{date}snap%{?dist}
 Summary:        The SCSI target daemon and utility programs
 
 Group:          System Environment/Daemons
 License:        GPLv2
 URL:            http://stgt.berlios.de
-Source0:        http://stgt.berlios.de/releases/tgt-%{version}.tar.bz2
+#Source0:        http://stgt.berlios.de/releases/tgt-%{version}.tar.bz2
+Source0:        http://people.redhat.com/mchristi/target/tgt/snapshots/tgt-%{date}.tar.bz2
 Source1:        tgtd.init
-Patch0:         tgt-20080805-shebang.patch
-Patch1:         tgt-0.9.5-makefile.patch
+Source2:        sysconfig.tgtd
+Source3:        targets.conf
+Patch0:         scsi-target-utils-redhatify-docs.patch
+Patch1:         scsi-target-utils-dynamic-link-iser.patch
+Patch2:         scsi-target-utils-hack-check-for-eventfd.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-BuildRequires:  openssl-devel pkgconfig
-Requires:       /sbin/chkconfig  /sbin/service
+BuildRequires:  pkgconfig libibverbs-devel librdmacm-devel
+Requires(post): chkconfig
+Requires(preun): chkconfig
+Requires(preun): initscripts
 
 %description
 The SCSI target package contains the daemon and tools to setup a SCSI targets.
 Currently, software iSCSI targets are supported.
 
+
 %prep
-%setup -q -n tgt-%{version}
-%patch0 -p1
-%patch1 -p1
-%{__chmod}  0644 scripts/tgt-core-test
+%setup -q -n tgt-%{date}
+%patch0 -p1 -b .redhatify-docs
+%patch1 -p1 -b .dynamic-link-iser
+%patch2 -p1 -b .hack-check-for-eventfd
+
 
 %build
-if pkg-config openssl ; then
-        CPPFLAGS=$(pkg-config --cflags openssl) ; export CPPFLAGS
-        LDFLAGS=$(pkg-config --libs openssl) ; export LDFLAGS
-fi
 pushd usr
-%{__sed} -i -e 's|-g -O2|%{optflags}|' Makefile
-%{__make} %{?_smp_mflags} ISCSI=1
+%{__sed} -i -e 's|-Wall -g -O2|%{optflags}|' Makefile
+%{__make} %{?_smp_mflags} ISCSI=1 ISCSI_RDMA=1
+popd
+
 
 %install
 %{__rm} -rf %{buildroot}
 %{__install} -d %{buildroot}%{_sbindir}
 %{__install} -d %{buildroot}%{_mandir}/man8
 %{__install} -d %{buildroot}%{_initrddir}
+%{__install} -d %{buildroot}/etc/tgt
+%{__install} -d %{buildroot}/etc/sysconfig
 
+%{__install} -p -m 0755 scripts/tgt-setup-lun %{buildroot}%{_sbindir}
 %{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/tgtd
 %{__install} -p -m 0755 scripts/tgt-admin %{buildroot}/%{_sbindir}/tgt-admin
 %{__install} -p -m 0644 doc/manpages/tgtadm.8 %{buildroot}/%{_mandir}/man8
 %{__install} -p -m 0644 doc/manpages/tgt-admin.8 %{buildroot}/%{_mandir}/man8
+%{__install} -p -m 0644 doc/manpages/tgt-setup-lun.8 %{buildroot}/%{_mandir}/man8
+%{__install} -p -m 0600 %{SOURCE2} %{buildroot}/etc/sysconfig/tgtd
+%{__install} -p -m 0600 %{SOURCE3} %{buildroot}/etc/tgt
 
 pushd usr
-%{__make} install DESTDIR=%{buildroot}
+%{__make} install DESTDIR=%{buildroot} sbindir=%{_sbindir}
 
-# we ship these by doc macro
-%{__rm} -rf %{buildroot}/usr/share/doc/tgt
 
 %post
 /sbin/chkconfig --add tgtd
 
 %postun
 if [ "$1" = "1" ] ; then
-     /sbin/service tgtd condrestart > /dev/null 2>&1
+     /sbin/service tgtd condrestart > /dev/null 2>&1 || :
 fi
 
 %preun
@@ -65,13 +78,14 @@ if [ "$1" = "0" ] ; then
      /sbin/chkconfig --del tgtd
 fi
 
+
 %clean
 %{__rm} -rf %{buildroot}
 
+
 %files
 %defattr(-, root, root, -)
-%doc README doc/README.* doc/targets.conf.example doc/tmf.txt doc/TODO
-%doc scripts/tgt-core-test
+%doc README doc/README.iscsi doc/README.iser doc/README.lu_configuration doc/README.mmc
 %{_sbindir}/tgtd
 %{_sbindir}/tgtadm
 %{_sbindir}/tgt-setup-lun
@@ -79,8 +93,24 @@ fi
 %{_sbindir}/tgtimg
 %{_mandir}/man8/*
 %{_initrddir}/tgtd
+%attr(0600,root,root) %config(noreplace) /etc/sysconfig/tgtd
+%attr(0600,root,root) %config(noreplace) /etc/tgt/targets.conf
+
 
 %changelog
+* Mon Dec 21 2009 Hans de Goede <hdegoede at redhat.com> - 0.9.11-1.20091205snap
+- Rebase to 0.9.11 + some fixes from git (git id
+  97832d8dcd00202a493290b5d134b581ce20885c)
+- Rewrite initscript, make it follow:
+  http://fedoraproject.org/wiki/Packaging/SysVInitScript
+  And merge in RHEL-5 initscript improvements:
+  - Parse /etc/tgt/targets.conf, which allows easy configuration of targets
+  - Better initiator status checking in stop
+  - Add force-stop, to stop even when initiators are still connected
+  - Make reload reload configuration from /etc/tgt/targets.conf without
+    stopping tgtd (but only for unused targets)
+  - Add force-reload (reloads configs for all targets including busy ones)
+
 * Fri Aug 21 2009 Tomas Mraz <tmraz at redhat.com> - 0.9.5-3
 - rebuilt with new openssl
 


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/scsi-target-utils/devel/sources,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- sources	17 Mar 2009 08:23:28 -0000	1.6
+++ sources	22 Dec 2009 11:12:21 -0000	1.7
@@ -1 +1 @@
-43d95cb4163de21459ffee300764d11a  tgt-0.9.5.tar.bz2
+6f469f376b1ceb00725ceb00b2f1e6f8  tgt-20091205.tar.bz2


Index: tgtd.init
===================================================================
RCS file: /cvs/pkgs/rpms/scsi-target-utils/devel/tgtd.init,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- tgtd.init	11 Oct 2007 17:41:40 -0000	1.1
+++ tgtd.init	22 Dec 2009 11:12:21 -0000	1.2
@@ -17,73 +17,200 @@
 . /etc/init.d/functions
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
+TGTD_CONFIG=/etc/tgt/targets.conf
 
-RETVAL=0
+prog="SCSI target daemon"
+exec=tgtd
+lockfile=/var/lock/subsys/$exec
+
+# Check for and source configuration file otherwise use defaults above
+[ -f /etc/sysconfig/$exec ] && . /etc/sysconfig/$exec
 
 start()
 {
-	echo -n $"Starting SCSI target daemon: "
-	if [ -f /var/lock/subsys/tgtd ]; then
+	[ -x /usr/sbin/$exec ] || exit 5
+	echo -n $"Starting $prog: "
+	# Note /dev/null redirection to silence rdma not found messages
+	daemon $exec >/dev/null 2>&1
+	retval=$?
+	if [ $retval -ne 0 ] ; then
+		failure
 		echo
-		success
-		return
+		return $retval
 	fi
 
-	daemon tgtd
+	success
 	echo
-	RETVAL=$?
-	if [ $RETVAL -eq "0" ]; then
-		touch /var/lock/subsys/tgtd
-	fi
+	touch $lockfile
+
+	# Put tgtd into "offline" state until all the targets are configured.
+	# We don't want initiators to (re)connect and fail the connection
+	# if it's not ready.
+	tgtadm --op update --mode sys --name State -v offline
+	# Configure the targets.
+	tgt-admin -e -c $TGTD_CONFIG
+	# Put tgtd into "ready" state.
+	tgtadm --op update --mode sys --name State -v ready
+
+	return 0
 }
 
 stop()
 {
-	echo -n $"Stopping SCSI target daemon: "
+	if [ "$RUNLEVEL" == 0 -o "$RUNLEVEL" == 6 ] ; then
+		force_stop
+		return $?
+	fi
+
+	echo -n $"Stopping $prog: "
+	# Remove all targets. It only removes targets which are not in use.
+	tgt-admin --update ALL -c /dev/null >/dev/null 2>&1
+	# tgtd will exit if all targets were removed
+	tgtadm --op delete --mode system >/dev/null 2>&1
+	retval=$?
+	if [ "$retval" -eq 107 ] ; then
+		echo -n $"not running"
+		failure
+		echo
+		return 7
+	elif [ "$retval" -ne 0 ] ; then
+		echo -n $"initiators still connected"
+		failure
+		echo
+		return 1
+	fi
+
+	success
+	echo
+	rm -f $lockfile
+	return 0
+}
 
-	if [ ! -f /var/lock/subsys/tgtd ]; then
+force_stop()
+{
+	# NOTE: Forced shutdown of the iscsi target may cause data corruption
+	# for initiators that are connected.
+	echo -n $"Force-stopping $prog: "
+	# Offline everything first. May be needed if we're rebooting, but
+	# expect the initiators to reconnect cleanly when we boot again
+	# (i.e. we don't want them to reconnect to a tgtd which is still
+	# working, but the target is gone).
+	tgtadm --op update --mode sys --name State -v offline >/dev/null 2>&1
+	retval=$?
+	if [ "$retval" -eq 107 ] ; then
+		echo -n $"not running"
+		failure
 		echo
-		success
-		return
+		return 7
+	else
+		tgt-admin --offline ALL
+		# Remove all targets, even if they are still in use.
+		tgt-admin --update ALL -c /dev/null -f
+		# It will shut down tgtd only after all targets were removed.
+		tgtadm --op delete --mode system
+		retval=$?
+		if [ "$retval" -ne 0 ] ; then
+			failure
+			echo
+			return 1
+		fi
 	fi
 
-	if tgtadm --op show -m target | grep "Target" >/dev/null ; then
-		echo $"Targets still in use. Cannot shutdown service."
-		RETVAL=1
-		return
+	success
+	echo
+	rm -f $lockfile
+	return 0
+}
+
+reload() {
+	echo -n $"Updating $prog configuration: "
+	# Update configuration for targets. Only targets which
+	# are not in use will be updated.
+	tgt-admin --update ALL -c $TGTD_CONFIG >/dev/null 2>&1
+	retval=$?
+	if [ "$retval" -eq 107 ] ; then
+		echo -n $"not running"
+		failure
+		echo
+		return 7
+	elif [ "$retval" -ne 0 ] ; then
+		failure
+		echo
+		return 1
 	fi
 
-	killproc tgtd
+	success
 	echo
-	RETVAL=$?
-	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/tgtd
+	return 0
 }
 
-restart()
-{
-	stop
-	start
+force_reload() {
+	echo -n $"Force-updating $prog configuration: "
+	# Update configuration for targets, even those in use.
+	tgt-admin --update ALL -f -c $TGTD_CONFIG >/dev/null 2>&1
+	retval=$?
+	if [ "$retval" -eq 107 ] ; then
+		echo -n $"not running"
+		failure
+		echo
+		return 7
+	elif [ "$retval" -ne 0 ] ; then
+		failure
+		echo
+		return 1
+	fi
+
+	success
+	echo
+	return 0
+}
+
+rh_status() {
+	# run checks to determine if the service is running or use generic status
+	status $exec
+}
+
+rh_status_q() {
+	rh_status >/dev/null 2>&1
 }
 
+
 case "$1" in
 	start)
-		start
+		rh_status_q && exit 0
+		$1
 		;;
 	stop)
-		stop
+		rh_status_q || exit 0
+		$1
+		;;
+	force-stop)
+		force_stop
 		;;
 	restart)
-		restart
+		stop
+		start
+		;;
+	force-restart)
+		force_stop
+		start
+		;;
+	reload)
+		rh_status_q || exit 7
+		$1
+		;;
+	force-reload)
+		force_reload
 		;;
 	status)
-		status tgtd
-		RETVAL=$?
+		rh_status
 		;;
-	condrestart)
-		[ -f /var/lock/subsys/tgtd ] && restart
+	condrestart|try-restart)
+		rh_status_q || exit 0
+		restart
 		;;
 	*)
-		echo $"Usage: $0 {start|stop|restart|status|condrestart}"
-		exit 1
+		echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-stop|force-restart|force-reload}"
+		exit 2
 esac
-exit $RETVAL
+exit $?


--- tgt-0.9.5-makefile.patch DELETED ---


--- tgt-20080805-shebang.patch DELETED ---




More information about the fedora-extras-commits mailing list