rpms/iscsitarget-kmod/F-8 .cvsignore,1.1,1.2 sources,1.1,1.2
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget-kmod/F-8
In directory se02.es.rpmfusion.net:/tmp/cvs-serv3826
Modified Files:
.cvsignore sources
Log Message:
uploading sources helps getting things running
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/iscsitarget-kmod/F-8/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 3 Oct 2008 11:59:46 -0000 1.1
+++ .cvsignore 3 Oct 2008 14:22:59 -0000 1.2
@@ -0,0 +1 @@
+iscsitarget-0.4.15.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/iscsitarget-kmod/F-8/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 3 Oct 2008 11:59:46 -0000 1.1
+++ sources 3 Oct 2008 14:22:59 -0000 1.2
@@ -0,0 +1 @@
+81390e388d87e3cc17383ef5f4322c28 iscsitarget-0.4.15.tar.gz
16 years, 1 month
rpms/iscsitarget-kmod/F-9 .cvsignore,1.1,1.2 sources,1.1,1.2
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget-kmod/F-9
In directory se02.es.rpmfusion.net:/tmp/cvs-serv3751
Modified Files:
.cvsignore sources
Log Message:
uploading sources helps getting things running
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/iscsitarget-kmod/F-9/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 3 Oct 2008 11:59:46 -0000 1.1
+++ .cvsignore 3 Oct 2008 14:22:38 -0000 1.2
@@ -0,0 +1 @@
+iscsitarget-0.4.15.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/iscsitarget-kmod/F-9/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 3 Oct 2008 11:59:46 -0000 1.1
+++ sources 3 Oct 2008 14:22:38 -0000 1.2
@@ -0,0 +1 @@
+81390e388d87e3cc17383ef5f4322c28 iscsitarget-0.4.15.tar.gz
16 years, 1 month
rpms/iscsitarget-kmod/devel .cvsignore,1.1,1.2 sources,1.1,1.2
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget-kmod/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv3672
Modified Files:
.cvsignore sources
Log Message:
uploading sources helps getting things running
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/iscsitarget-kmod/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 3 Oct 2008 11:59:46 -0000 1.1
+++ .cvsignore 3 Oct 2008 14:22:10 -0000 1.2
@@ -0,0 +1 @@
+iscsitarget-0.4.15.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/iscsitarget-kmod/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 3 Oct 2008 11:59:46 -0000 1.1
+++ sources 3 Oct 2008 14:22:10 -0000 1.2
@@ -0,0 +1 @@
+81390e388d87e3cc17383ef5f4322c28 iscsitarget-0.4.15.tar.gz
16 years, 1 month
rpms/iscsitarget-kmod/F-8 iscsitarget-0.4.15-svn147.patch, NONE, 1.1 iscsitarget-0.4.15-types.h.patch, NONE, 1.1 iscsitarget-kmod.spec, NONE, 1.1
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget-kmod/F-8
In directory se02.es.rpmfusion.net:/tmp/cvs-serv2486
Added Files:
iscsitarget-0.4.15-svn147.patch
iscsitarget-0.4.15-types.h.patch iscsitarget-kmod.spec
Log Message:
import from livna
iscsitarget-0.4.15-svn147.patch:
--- NEW FILE iscsitarget-0.4.15-svn147.patch ---
Index: kernel/block-io.c
===================================================================
--- kernel/block-io.c (.../tags/0.4.15) (revision 147)
+++ kernel/block-io.c (.../trunk) (revision 147)
@@ -28,15 +28,10 @@
struct completion tio_complete;
};
-static int
-blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+static void blockio_bio_endio(struct bio *bio, int error)
{
struct tio_work *tio_work = bio->bi_private;
- /* Ignore partials */
- if (bio->bi_size)
- return 1;
-
error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
if (error)
@@ -47,8 +42,6 @@
complete(&tio_work->tio_complete);
bio_put(bio);
-
- return 0;
}
/*
@@ -169,8 +162,8 @@
bdev = open_bdev_excl(path, flags, THIS_MODULE);
if (IS_ERR(bdev)) {
- err = PTR_ERR (bdev);
- eprintk("Can't open device %s \n", path);
+ err = PTR_ERR(bdev);
+ eprintk("Can't open device %s, error %d\n", path, err);
bio_data->bdev = NULL;
} else {
bio_data->bdev = bdev;
@@ -217,7 +210,7 @@
p = (u32 *) (volume->scsi_id + VENDOR_ID_LEN);
*(p + 0) = volume->target->trgt_param.target_type;
*(p + 1) = volume->target->tid;
- *(p + 2) = (unsigned int) inode->i_ino;
+ *(p + 2) = volume->lun;
*(p + 3) = (unsigned int) inode->i_sb->s_dev;
}
@@ -319,6 +312,7 @@
if (bio_data->bdev)
close_bdev_excl(bio_data->bdev);
+ kfree(bio_data->path);
kfree(volume->private);
}
Index: kernel/target_disk.c
===================================================================
--- kernel/target_disk.c (.../tags/0.4.15) (revision 147)
+++ kernel/target_disk.c (.../trunk) (revision 147)
@@ -66,13 +66,15 @@
unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00};
- u32 ncyl, *p;
+ u32 ncyl;
+ u32 n;
/* assume 0xff heads, 15krpm. */
memcpy(ptr, geo_m_pg, sizeof(geo_m_pg));
ncyl = sec >> 14; /* 256 * 64 */
- p = (u32 *)(ptr + 1);
- *p = *p | cpu_to_be32(ncyl);
+ memcpy(&n, ptr+1, sizeof(u32));
+ n = n | cpu_to_be32(ncyl);
+ memcpy(ptr+1, &n, sizeof(u32));
return sizeof(geo_m_pg);
}
@@ -249,7 +251,8 @@
struct iet_volume *lun;
int rest, idx = 0;
- size = be32_to_cpu(*(u32 *)&req->scb[6]);
+ size = (u32)req->scb[6] << 24 | (u32)req->scb[7] << 16 |
+ (u32)req->scb[8] << 8 | (u32)req->scb[9];
if (size < 16)
return -1;
Index: kernel/config.c
===================================================================
--- kernel/config.c (.../tags/0.4.15) (revision 147)
+++ kernel/config.c (.../trunk) (revision 147)
@@ -40,7 +40,7 @@
int i;
struct proc_dir_entry *ent;
- if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
goto err;
proc_iet_dir->owner = THIS_MODULE;
Index: kernel/volume.c
===================================================================
--- kernel/volume.c (.../tags/0.4.15) (revision 147)
+++ kernel/volume.c (.../trunk) (revision 147)
@@ -132,6 +132,8 @@
list_add_tail(&volume->list, &target->volumes);
atomic_inc(&target->nr_volumes);
+ kfree(args);
+
return 0;
free_args:
kfree(args);
Index: kernel/iotype.c
===================================================================
--- kernel/iotype.c (.../tags/0.4.15) (revision 147)
+++ kernel/iotype.c (.../trunk) (revision 147)
@@ -89,9 +89,11 @@
for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
if (!(err = register_iotype(iotype_array[i])))
- eprintk("register %s\n", iotype_array[i]->name);
+ iprintk("Registered io type %s\n",
+ iotype_array[i]->name);
else {
- eprintk("failed to register %s\n", iotype_array[i]->name);
+ eprintk("Failed to register io type %s\n",
+ iotype_array[i]->name);
break;
}
}
Index: kernel/iscsi.c
===================================================================
--- kernel/iscsi.c (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi.c (.../trunk) (revision 147)
@@ -726,13 +726,18 @@
case READ_10:
case WRITE_10:
case WRITE_VERIFY:
- *off = be32_to_cpu(*(u32 *)&cmd[2]);
+ *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
+ (u32)cmd[4] << 8 | (u32)cmd[5];
*len = (cmd[7] << 8) + cmd[8];
break;
case READ_16:
case WRITE_16:
- *off = be64_to_cpu(*(u64 *)&cmd[2]);
- *len = be32_to_cpu(*(u32 *)&cmd[10]);
+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
+ (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
+ (u64)cmd[8] << 8 | (u64)cmd[9];
+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
+ (u32)cmd[12] << 8 | (u32)cmd[13];
break;
default:
BUG();
@@ -1191,10 +1196,56 @@
}
}
+static inline char *tmf_desc(int fun)
+{
+ static char *tmf_desc[] = {
+ "Unknown Function",
+ "Abort Task",
+ "Abort Task Set",
+ "Clear ACA",
+ "Clear Task Set",
+ "Logical Unit Reset",
+ "Target Warm Reset",
+ "Target Cold Reset",
+ "Task Reassign",
+ };
+
+ if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
+ (fun > ISCSI_FUNCTION_TASK_REASSIGN))
+ fun = 0;
+
+ return tmf_desc[fun];
+}
+
+static inline char *rsp_desc(int rsp)
+{
+ static char *rsp_desc[] = {
+ "Function Complete",
+ "Unknown Task",
+ "Unknown LUN",
+ "Task Allegiant",
+ "Failover Unsupported",
+ "Function Unsupported",
+ "No Authorization",
+ "Function Rejected",
+ "Unknown Response",
+ };
+
+ if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
+ (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
+ (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
+ rsp = 8;
+ else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
+ rsp = 7;
+
+ return rsp_desc[rsp];
+}
+
static void execute_task_management(struct iscsi_cmnd *req)
{
struct iscsi_conn *conn = req->conn;
- struct iscsi_target *target = conn->session->target;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_target *target = session->target;
struct iscsi_cmnd *rsp;
struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
struct iscsi_task_rsp_hdr *rsp_hdr;
@@ -1209,8 +1260,6 @@
rsp_hdr->itt = req_hdr->itt;
rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
- eprintk("%x %d %x\n", cmnd_itt(req), function, req_hdr->rtt);
-
switch (function) {
case ISCSI_FUNCTION_ABORT_TASK:
case ISCSI_FUNCTION_ABORT_TASK_SET:
@@ -1255,6 +1304,11 @@
break;
}
out:
+ iprintk("%s (%02x) issued on tid:%d lun:%d by sid:%llu (%s)\n",
+ tmf_desc(function), function, target->tid,
+ translate_lun(req_hdr->lun), session->sid,
+ rsp_desc(rsp_hdr->response));
+
iscsi_cmnd_init_write(rsp);
}
@@ -1708,8 +1762,7 @@
if ((err = event_init()) < 0)
goto err;
- iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
- 0, 0, NULL, NULL);
+ iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
if (!iscsi_cmnd_cache)
goto err;
Index: kernel/null-io.c
===================================================================
--- kernel/null-io.c (.../tags/0.4.15) (revision 147)
+++ kernel/null-io.c (.../trunk) (revision 147)
@@ -16,7 +16,7 @@
#include "iotype.h"
struct nullio_data {
- u32 sectors;
+ u64 sectors;
};
enum {
@@ -32,7 +32,7 @@
static int parse_nullio_params(struct iet_volume *volume, char *params)
{
int err = 0;
- char *p;
+ char *p, *q;
struct nullio_data *data = volume->private;
while ((p = strsep(¶ms, ",")) != NULL) {
@@ -43,7 +43,11 @@
token = match_token(p, tokens, args);
switch (token) {
case Opt_sectors:
- match_int(&args[0], &data->sectors);
+ q = match_strdup(&args[0]);
+ if (!q)
+ return -ENOMEM;
+ data->sectors = simple_strtoull(q, NULL, 10);
+ kfree(q);
break;
case Opt_ignore:
break;
@@ -97,7 +101,7 @@
void nullio_show(struct iet_volume *lu, struct seq_file *seq)
{
struct nullio_data *p = lu->private;
- seq_printf(seq, " sectors:%u\n", p->sectors);
+ seq_printf(seq, " sectors:%llu\n", p->sectors);
}
struct iotype nullio =
Index: kernel/iscsi.h
===================================================================
--- kernel/iscsi.h (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi.h (.../trunk) (revision 147)
@@ -116,9 +116,6 @@
struct worker_thread_info wthread_info;
struct semaphore target_sem;
-
- struct list_head initiator_list;
- u32 initiator_iid_count;
};
struct iscsi_queue {
@@ -189,8 +186,6 @@
struct list_head cmnd_hash[1 << IET_HASH_ORDER];
u32 next_ttt;
-
- struct iscsi_initiator *rinitiator;
};
enum connection_state_bit {
Index: kernel/digest.c
===================================================================
--- kernel/digest.c (.../tags/0.4.15) (revision 147)
+++ kernel/digest.c (.../trunk) (revision 147)
@@ -161,22 +161,17 @@
}
}
-/* Copied from linux-iscsi initiator and slightly adjusted */
-#define SETSG(sg, p, l) do { \
- (sg).page = virt_to_page((p)); \
- (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
- (sg).length = (l); \
-} while (0)
-
static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
u8 *crc)
{
struct scatterlist sg[2];
unsigned int nbytes = sizeof(struct iscsi_hdr);
- SETSG(sg[0], &pdu->bhs, nbytes);
+ sg_init_table(sg, pdu->ahssize ? 2 : 1);
+
+ sg_set_buf(&sg[0], &pdu->bhs, nbytes);
if (pdu->ahssize) {
- SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
nbytes += pdu->ahssize;
}
@@ -218,8 +213,9 @@
count = get_pgcnt(size, offset);
assert(idx + count <= tio->pg_cnt);
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
+ sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
crypto_hash_init(hash);
for (i = 0; size; i++) {
@@ -228,13 +224,13 @@
else
length = size;
- sg[i].page = tio->pvec[idx + i];
- sg[i].offset = offset;
- sg[i].length = length;
+ sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
size -= length;
offset = 0;
}
+ sg_mark_end(&sg[i - 1]);
+
crypto_hash_update(hash, sg, nbytes);
crypto_hash_final(hash, crc);
}
Index: kernel/event.c
===================================================================
--- kernel/event.c (.../tags/0.4.15) (revision 147)
+++ kernel/event.c (.../trunk) (revision 147)
@@ -28,7 +28,7 @@
return 0;
}
-static int event_recv_skb(struct sk_buff *skb)
+static void event_recv_skb(struct sk_buff *skb)
{
int err;
struct nlmsghdr *nlh;
@@ -37,7 +37,7 @@
while (skb->len >= NLMSG_SPACE(0)) {
nlh = (struct nlmsghdr *)skb->data;
if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
- return 0;
+ break;
rlen = NLMSG_ALIGN(nlh->nlmsg_len);
if (rlen > skb->len)
rlen = skb->len;
@@ -47,21 +47,8 @@
netlink_ack(skb, nlh, 0);
skb_pull(skb, rlen);
}
- return 0;
}
-static void event_recv(struct sock *sk, int length)
-{
- struct sk_buff *skb;
-
- while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
- if (event_recv_skb(skb) && skb->len)
- skb_queue_head(&sk->sk_receive_queue, skb);
- else
- kfree_skb(skb);
- }
-}
-
static int notify(void *data, int len, int gfp_mask)
{
struct sk_buff *skb;
@@ -95,7 +82,8 @@
int event_init(void)
{
- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+ NULL, THIS_MODULE);
if (!nl)
return -ENOMEM;
else
Index: kernel/nthread.c
===================================================================
--- kernel/nthread.c (.../tags/0.4.15) (revision 147)
+++ kernel/nthread.c (.../trunk) (revision 147)
@@ -13,8 +13,6 @@
#include "iscsi_dbg.h"
#include "digest.h"
-DECLARE_WAIT_QUEUE_HEAD(iscsi_ctl_wait);
-
enum daemon_state_bit {
D_ACTIVE,
D_DATA_READY,
Index: kernel/target.c
===================================================================
--- kernel/target.c (.../tags/0.4.15) (revision 147)
+++ kernel/target.c (.../trunk) (revision 147)
@@ -148,7 +148,6 @@
INIT_LIST_HEAD(&target->session_list);
INIT_LIST_HEAD(&target->volumes);
- INIT_LIST_HEAD(&target->initiator_list);
atomic_set(&target->nr_volumes, 0);
Index: kernel/iscsi_dbg.h
===================================================================
--- kernel/iscsi_dbg.h (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi_dbg.h (.../trunk) (revision 147)
@@ -15,21 +15,25 @@
extern unsigned long debug_enable_flags;
-#define dprintk(debug, fmt, args...) \
-do { \
- if ((debug) & debug_enable_flags) { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
- } \
+#define PFX "iscsi_trgt: "
+
+#define dprintk(debug, fmt, args...) do { \
+ if ((debug) & debug_enable_flags) { \
+ printk(KERN_DEBUG PFX "%s(%d) " fmt, __FUNCTION__,\
+ __LINE__, args);\
+ } \
} while (0)
-#define eprintk(fmt, args...) \
-do { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
+#define eprintk(fmt, args...) do { \
+ printk(KERN_ERR PFX "%s(%d) " fmt, __FUNCTION__, \
+ __LINE__, args);\
} while (0)
+#define iprintk(X...) printk(KERN_INFO PFX X)
+
#define assert(p) do { \
if (!(p)) { \
- printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
+ printk(KERN_CRIT PFX "BUG at %s:%d assert(%s)\n",\
__FILE__, __LINE__, #p); \
dump_stack(); \
BUG(); \
@@ -40,9 +44,10 @@
static inline void iscsi_dump_iov(struct msghdr *msg)
{
int i;
- printk("%p, %d\n", msg->msg_iov, msg->msg_iovlen);
+ printk(PFX "%p, %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0; i < min_t(size_t, msg->msg_iovlen, ISCSI_CONN_IOV_MAX); i++)
- printk("%d: %p,%d\n", i, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
+ printk(PFX "%d: %p,%d\n", i, msg->msg_iov[i].iov_base,
+ msg->msg_iov[i].iov_len);
}
#else
#define iscsi_dump_iov(x) do {} while (0)
@@ -84,18 +89,18 @@
int i;
buf = (void *)&pdu->bhs;
- printk("BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
+ printk(PFX "BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
for (i = 0; i < sizeof(pdu->bhs); i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
buf = (void *)pdu->ahs;
- printk("AHS: (%p,%d)\n", buf, pdu->ahssize);
+ printk(PFX "AHS: (%p,%d)\n", buf, pdu->ahssize);
for (i = 0; i < pdu->ahssize; i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
- printk("Data: (%d)\n", pdu->datasize);
+ printk(PFX "Data: (%d)\n", pdu->datasize);
}
#else
Index: kernel/tio.c
===================================================================
--- kernel/tio.c (.../tags/0.4.15) (revision 147)
+++ kernel/tio.c (.../trunk) (revision 147)
@@ -110,8 +110,7 @@
int tio_init(void)
{
- tio_cache = kmem_cache_create("tio", sizeof(struct tio),
- 0, 0, NULL, NULL);
+ tio_cache = KMEM_CACHE(tio, 0);
return tio_cache ? 0 : -ENOMEM;
}
Index: patches/compat-2.6.19-2.6.21.patch
===================================================================
--- patches/compat-2.6.19-2.6.21.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.19-2.6.21.patch (.../trunk) (revision 147)
@@ -0,0 +1,41 @@
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 122)
+@@ -95,8 +95,7 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+- THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/iscsi.c
+===================================================================
+--- kernel/iscsi.c (working copy)
++++ kernel/iscsi.c (revision 137)
+@@ -1757,7 +1757,8 @@ static int iscsi_init(void)
+ if ((err = event_init()) < 0)
+ goto err;
+
+- iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
++ iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
++ 0, 0, NULL, NULL);
+ if (!iscsi_cmnd_cache)
+ goto err;
+
+Index: kernel/tio.c
+===================================================================
+--- kernel/tio.c (working copy)
++++ kernel/tio.c (revision 137)
+@@ -110,7 +110,8 @@ int tio_sync(struct iet_volume *lu, stru
+
+ int tio_init(void)
+ {
+- tio_cache = KMEM_CACHE(tio, 0);
++ tio_cache = kmem_cache_create("tio", sizeof(struct tio),
++ 0, 0, NULL, NULL);
+ return tio_cache ? 0 : -ENOMEM;
+ }
Index: patches/compat-2.6.14-2.6.18.patch
===================================================================
--- patches/compat-2.6.14-2.6.18.patch (.../tags/0.4.15) (revision 147)
+++ patches/compat-2.6.14-2.6.18.patch (.../trunk) (revision 147)
@@ -2,7 +2,7 @@
===================================================================
--- kernel/iscsi.h (revision 105)
+++ kernel/iscsi.h (working copy)
-@@ -238,8 +238,8 @@ struct iscsi_conn {
+@@ -233,8 +233,8 @@ struct iscsi_conn {
u32 write_offset;
int write_state;
@@ -134,7 +134,7 @@
idx = offset >> PAGE_CACHE_SHIFT;
@@ -220,7 +211,7 @@ static void digest_data(struct hash_desc
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
- crypto_hash_init(hash);
+ crypto_digest_init(tfm);
Index: patches/compat-2.6.22-2.6.23.patch
===================================================================
--- patches/compat-2.6.22-2.6.23.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.22-2.6.23.patch (.../trunk) (revision 147)
@@ -0,0 +1,592 @@
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 142)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 142)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 142)
+@@ -161,15 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -221,7 +228,9 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 142)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
Index: usr/isns.c
===================================================================
--- usr/isns.c (.../tags/0.4.15) (revision 147)
+++ usr/isns.c (.../trunk) (revision 147)
@@ -256,7 +256,8 @@
scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE |
ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED;
- scn_flags = htonl(set_scn_flag(scn_flags));
+ set_scn_flag(scn_flags);
+ scn_flags = htonl(scn_flags);
length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_SCN_BITMAP,
sizeof(scn_flags), &scn_flags);
Index: usr/iscsid.c
===================================================================
--- usr/iscsid.c (.../tags/0.4.15) (revision 147)
+++ usr/iscsid.c (.../trunk) (revision 147)
@@ -89,11 +89,16 @@
char *buffer;
if (!conn->rsp.datasize) {
- if (!conn->rsp_buffer)
+ if (!conn->rsp_buffer) {
conn->rsp_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->rsp_buffer) {
+ log_error("Failed to alloc send buffer");
+ return;
+ }
+ }
conn->rsp.data = conn->rsp_buffer;
}
- if (conn->rwsize + len > INCOMING_BUFSIZE) {
+ if (conn->rsp.datasize + len > INCOMING_BUFSIZE) {
log_warning("Dropping key (%s=%s)", key, value);
return;
}
@@ -385,7 +390,12 @@
/* return; */
/* } */
- ki->param_get(conn->tid, 0, key_session, conn->session_param);
+ if (ki->param_get(conn->tid, 0, key_session,
+ conn->session_param)) {
+ rsp->status_class = ISCSI_STATUS_TARGET_ERROR;
+ rsp->status_detail = ISCSI_STATUS_SVC_UNAVAILABLE;
+ conn->state = STATE_EXIT;
+ }
}
conn->exp_cmd_sn = be32_to_cpu(req->cmd_sn);
log_debug(1, "exp_cmd_sn: %d,%d", conn->exp_cmd_sn, req->cmd_sn);
Index: usr/ietd.c
===================================================================
--- usr/ietd.c (.../tags/0.4.15) (revision 147)
+++ usr/ietd.c (.../trunk) (revision 147)
@@ -307,9 +307,24 @@
(conn->req.bhs.datalength[1] << 8) +
conn->req.bhs.datalength[2]);
conn->rwsize = (conn->req.ahssize + conn->req.datasize + 3) & -4;
+ if (conn->rwsize > INCOMING_BUFSIZE) {
+ log_warning("Recv PDU with "
+ "invalid size %d "
+ "(max: %d)",
+ conn->rwsize,
+ INCOMING_BUFSIZE);
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
if (conn->rwsize) {
- if (!conn->req_buffer)
+ if (!conn->req_buffer) {
conn->req_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->req_buffer) {
+ log_error("Failed to alloc recv buffer");
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
+ }
conn->buffer = conn->req_buffer;
conn->req.ahs = conn->buffer;
conn->req.data = conn->buffer + conn->req.ahssize;
@@ -396,6 +411,7 @@
exit(1);
}
+ conn_close:
if (conn->state == STATE_CLOSE) {
log_debug(0, "connection closed");
conn_free_pdu(conn);
Index: etc/initd/initd.gentoo
===================================================================
--- etc/initd/initd.gentoo (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.gentoo (.../trunk) (revision 147)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
depend()
{
use net
}
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
Index: etc/initd/initd
===================================================================
--- etc/initd/initd (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd (.../trunk) (revision 147)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
}
-
+
stop_server()
{
ietadm --op delete
Index: etc/initd/initd.debian
===================================================================
--- etc/initd/initd.debian (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.debian (.../trunk) (revision 147)
@@ -10,65 +10,29 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# Don't touch this "memsize thingy" unless you are blessed
-# with knowledge about it.
-MEM_SIZE=1048576
-
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
ietd_start()
{
echo -n "Starting iSCSI enterprise target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
start-stop-daemon --start --exec $DAEMON --quiet
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
- fi
+ fi
}
-
+
ietd_stop()
{
echo -n "Removing iSCSI enterprise target devices: "
- # ugly, but ietadm does not allways provides correct exit values
+ # ugly, but ietadm does not always provide correct exit values
RETURN=`ietadm --op delete 2>&1`
RETVAL=$?
- if [ $RETVAL == "0" ] && [[ $RETURN != "something wrong" ]]; then
+ if [ $RETVAL -eq 0 ] && [ x$RETURN != x"something wrong" ]; then
echo "succeeded."
else
echo "failed with reason :$RETURN"
@@ -78,19 +42,19 @@
echo -n "Stopping iSCSI enterprise target service: "
start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
fi
- # ugly, but pid file is not removed ba ietd
+ # ugly, but pid file is not removed by ietd
rm -f $PID_FILE
echo -n "Removing iSCSI enterprise target modules: "
modprobe -r iscsi_trgt
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
@@ -117,18 +81,18 @@
else
echo "no iSCSI enterprise target found!"
exit 1
- fi
+ fi
;;
dump)
DUMP=`tempfile -p ietd`
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Failed to create dump file $DUMP"
exit 1
fi
ietadm --mode dump --all >$DUMP
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Error dumping config from daemon"
rm $DUMP
exit 1
Index: etc/initd/initd.redhat
===================================================================
--- etc/initd/initd.redhat (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.redhat (.../trunk) (revision 147)
@@ -16,45 +16,12 @@
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
start()
{
echo -n "Starting iSCSI target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
daemon /usr/sbin/ietd
@@ -62,7 +29,7 @@
echo
return $RETVAL
}
-
+
stop()
{
echo -n "Stopping iSCSI target service: "
@@ -71,7 +38,7 @@
modprobe -r iscsi_trgt 2>/dev/null
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
@@ -102,7 +69,7 @@
exit 1
else
echo "ietd (pid $PID) is running..."
- fi
+ fi
}
case "$1" in
Index: Makefile
===================================================================
--- Makefile (.../tags/0.4.15) (revision 147)
+++ Makefile (.../trunk) (revision 147)
@@ -51,6 +51,16 @@
# base first the earlier patch sets will not need to be modified.
#
+# Compatibility patch for kernels >= 2.6.22 and <= 2.6.23
+ifeq ($(call kver_le,2,6,23),1)
+ PATCHES := $(PATCHES) compat-2.6.22-2.6.23.patch
+endif
+
+# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
+ifeq ($(call kver_le,2,6,21),1)
+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
+endif
+
# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
ifeq ($(call kver_le,2,6,18),1)
PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
@@ -140,27 +150,34 @@
rm -f .patched.*; \
fi
-install: install-kernel install-usr install-etc install-doc
+depmod:
+ @echo "Running depmod"
+ @if [ x$(DISTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
+ depmod -aq -b $(DISTDIR)$(INSTALL_MOD_PATH) $(KVER); \
+ else \
+ depmod -aq $(KVER); \
+ fi
+install: install-usr install-etc install-doc install-kernel depmod
+
install-kernel: kernel/iscsi_trgt.ko
@install -vD kernel/iscsi_trgt.ko \
$(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
install-usr: usr/ietd usr/ietadm
@install -vD usr/ietd $(DISTDIR)/usr/sbin/ietd
@install -vD usr/ietadm $(DISTDIR)/usr/sbin/ietadm
install-etc: install-initd
- @if [ ! -e /etc/ietd.conf ]; then \
+ @if [ ! -e $(DISTDIR)/etc/ietd.conf ]; then \
install -vD -m 644 etc/ietd.conf \
$(DISTDIR)/etc/ietd.conf; \
fi
- @if [ ! -e /etc/initiators.allow ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.allow ]; then \
install -vD -m 644 etc/initiators.allow \
$(DISTDIR)/etc/initiators.allow; \
fi
- @if [ ! -e /etc/initiators.deny ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.deny ]; then \
install -vD -m 644 etc/initiators.deny \
$(DISTDIR)/etc/initiators.deny; \
fi
@@ -204,11 +221,10 @@
$(DISTDIR)$(MANDIR)/man$$s/$$f ; \
done
-uninstall: uninstall-kernel uninstall-usr uninstall-etc uninstall-doc
+uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
uninstall-kernel:
rm -f $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
uninstall-usr:
@rm -f $(DISTDIR)/usr/sbin/ietd
iscsitarget-0.4.15-types.h.patch:
--- NEW FILE iscsitarget-0.4.15-types.h.patch ---
diff -up iscsitarget-0.4.15/kernel/block-io.c~ iscsitarget-0.4.15/kernel/block-io.c
--- iscsitarget-0.4.15/kernel/block-io.c~ 2008-09-23 09:20:55.000000000 +0200
+++ iscsitarget-0.4.15/kernel/block-io.c 2008-09-23 09:20:55.000000000 +0200
@@ -9,6 +9,7 @@
* This code is licenced under the GPL.
*/
+#include <linux/types.h>
#include <linux/parser.h>
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
--- NEW FILE iscsitarget-kmod.spec ---
# buildforkernels macro hint: when you build a new version or a new release
# that contains bugfixes or other improvements then you must disable the
# "buildforkernels newest" macro for just that build; immediately after
# queuing that build enable the macro again for subsequent builds; that way
# a new akmod package will only get build when a new one is actually needed
%define buildforkernels newest
# Release code won't build for newer kernels
%define patchlevel svn147
Name: iscsitarget-kmod
Version: 0.4.15
Release: 41.%{patchlevel}%{?dist}.1
Epoch: 1
Summary: iscsitarget kernel modules
Group: System Environment/Kernel
License: GPLv2
URL: http://sourceforge.net/projects/iscsitarget/
Source0: http://dl.sf.net/iscsitarget/iscsitarget-%{version}.tar.gz
# This was created with:
# svn diff http://svn.berlios.de/svnroot/repos/iscsitarget/tags/0.4.15/ \
# http://svn.berlios.de/svnroot/repos/iscsitarget/trunk/@147
Patch0: iscsitarget-0.4.15-%{patchlevel}.patch
Patch1: iscsitarget-0.4.15-types.h.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: i586 i686 x86_64 ppc64
# ppc disabled by knurd on 20081003 as it is known to fail on 2.6.26:
# https://bugzilla.redhat.com/show_bug.cgi?id=464613
# get the needed BuildRequires (in parts depending on what we build for)
BuildRequires: %{_bindir}/kmodtool
%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} }
# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
Kernel module for a kernel-based open source iSCSI target.
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
# go
%setup -q -c -T -a 0
pushd iscsitarget-%{version}
%patch0 -p0
%patch1 -p1
#%patch0 -p0 -b .svn142
# -b creates empty mode 000 file that cannot be copied with cp -a
popd
for kernel_version in %{?kernel_versions}; do
cp -a iscsitarget-%{version} _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions}; do
make -C "_kmod_build_${kernel_version%%___*}" KSRC="${kernel_version##*___}" patch
make -C "${kernel_version##*___}" SUBDIRS="${PWD}/_kmod_build_${kernel_version%%___*}"/kernel modules
done
%install
rm -rf $RPM_BUILD_ROOT
for kernel_version in %{?kernel_versions}; do
install -D -m 755 _kmod_build_${kernel_version%%___*}/kernel/iscsi_trgt.ko \
$RPM_BUILD_ROOT%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/iscsi_trgt.ko
done
%{?akmod_install}
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Oct 03 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-41.svn147.1
- rebuild for rpm fusion
* Wed Oct 01 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-40.svn147
- rebuild for new kernels
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-39.svn147
- temporary disable ppc due to http://bugzilla.kernel.org/show_bug.cgi?id=11143
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-38.svn147
- rebuild for new kernels
- add patch iscsitarget-0.4.15-types.h.patch from hansg
* Sat Aug 16 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-37.svn147
- rebuild for new kernels
* Thu Jul 24 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-36
- rebuild for new Fedora kernels
* Tue Jul 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-35
- rebuild for new Fedora kernels
* Wed Jul 02 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-34
- rebuild for new Fedora kernels
* Fri Jun 13 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-33
- rebuild for new Fedora kernels
* Fri Jun 06 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-32
- rebuild for new Fedora kernels
* Thu May 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-31
- rebuild for new Fedora kernels
* Sun May 04 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-30.svn142
- build for f9
* Sat Feb 16 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-9.svn142
- fix typo
* Thu Feb 14 2008 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-8.svn147
- Fix compilation for 2.6.24
* Sat Jan 26 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-7.svn142
- rebuild for new kmodtools, akmod adjustments
* Mon Jan 21 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-6.svn142
- build akmods package
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-5.svn142
- Correct versioning, bump epoch
- Comment on how the svn142 patch was created
* Wed Dec 05 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-4
- Convert to kmod2
* Sun Nov 11 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-2
- Added make patch before building, to fix builds for 2.6.18 kernels and earlier
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-1
- Initial package
16 years, 1 month
rpms/iscsitarget-kmod/F-9 iscsitarget-0.4.15-svn147.patch, NONE, 1.1 iscsitarget-0.4.15-types.h.patch, NONE, 1.1 iscsitarget-kmod.spec, NONE, 1.1
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget-kmod/F-9
In directory se02.es.rpmfusion.net:/tmp/cvs-serv2357
Added Files:
iscsitarget-0.4.15-svn147.patch
iscsitarget-0.4.15-types.h.patch iscsitarget-kmod.spec
Log Message:
import from livna
iscsitarget-0.4.15-svn147.patch:
--- NEW FILE iscsitarget-0.4.15-svn147.patch ---
Index: kernel/block-io.c
===================================================================
--- kernel/block-io.c (.../tags/0.4.15) (revision 147)
+++ kernel/block-io.c (.../trunk) (revision 147)
@@ -28,15 +28,10 @@
struct completion tio_complete;
};
-static int
-blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+static void blockio_bio_endio(struct bio *bio, int error)
{
struct tio_work *tio_work = bio->bi_private;
- /* Ignore partials */
- if (bio->bi_size)
- return 1;
-
error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
if (error)
@@ -47,8 +42,6 @@
complete(&tio_work->tio_complete);
bio_put(bio);
-
- return 0;
}
/*
@@ -169,8 +162,8 @@
bdev = open_bdev_excl(path, flags, THIS_MODULE);
if (IS_ERR(bdev)) {
- err = PTR_ERR (bdev);
- eprintk("Can't open device %s \n", path);
+ err = PTR_ERR(bdev);
+ eprintk("Can't open device %s, error %d\n", path, err);
bio_data->bdev = NULL;
} else {
bio_data->bdev = bdev;
@@ -217,7 +210,7 @@
p = (u32 *) (volume->scsi_id + VENDOR_ID_LEN);
*(p + 0) = volume->target->trgt_param.target_type;
*(p + 1) = volume->target->tid;
- *(p + 2) = (unsigned int) inode->i_ino;
+ *(p + 2) = volume->lun;
*(p + 3) = (unsigned int) inode->i_sb->s_dev;
}
@@ -319,6 +312,7 @@
if (bio_data->bdev)
close_bdev_excl(bio_data->bdev);
+ kfree(bio_data->path);
kfree(volume->private);
}
Index: kernel/target_disk.c
===================================================================
--- kernel/target_disk.c (.../tags/0.4.15) (revision 147)
+++ kernel/target_disk.c (.../trunk) (revision 147)
@@ -66,13 +66,15 @@
unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00};
- u32 ncyl, *p;
+ u32 ncyl;
+ u32 n;
/* assume 0xff heads, 15krpm. */
memcpy(ptr, geo_m_pg, sizeof(geo_m_pg));
ncyl = sec >> 14; /* 256 * 64 */
- p = (u32 *)(ptr + 1);
- *p = *p | cpu_to_be32(ncyl);
+ memcpy(&n, ptr+1, sizeof(u32));
+ n = n | cpu_to_be32(ncyl);
+ memcpy(ptr+1, &n, sizeof(u32));
return sizeof(geo_m_pg);
}
@@ -249,7 +251,8 @@
struct iet_volume *lun;
int rest, idx = 0;
- size = be32_to_cpu(*(u32 *)&req->scb[6]);
+ size = (u32)req->scb[6] << 24 | (u32)req->scb[7] << 16 |
+ (u32)req->scb[8] << 8 | (u32)req->scb[9];
if (size < 16)
return -1;
Index: kernel/config.c
===================================================================
--- kernel/config.c (.../tags/0.4.15) (revision 147)
+++ kernel/config.c (.../trunk) (revision 147)
@@ -40,7 +40,7 @@
int i;
struct proc_dir_entry *ent;
- if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
goto err;
proc_iet_dir->owner = THIS_MODULE;
Index: kernel/volume.c
===================================================================
--- kernel/volume.c (.../tags/0.4.15) (revision 147)
+++ kernel/volume.c (.../trunk) (revision 147)
@@ -132,6 +132,8 @@
list_add_tail(&volume->list, &target->volumes);
atomic_inc(&target->nr_volumes);
+ kfree(args);
+
return 0;
free_args:
kfree(args);
Index: kernel/iotype.c
===================================================================
--- kernel/iotype.c (.../tags/0.4.15) (revision 147)
+++ kernel/iotype.c (.../trunk) (revision 147)
@@ -89,9 +89,11 @@
for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
if (!(err = register_iotype(iotype_array[i])))
- eprintk("register %s\n", iotype_array[i]->name);
+ iprintk("Registered io type %s\n",
+ iotype_array[i]->name);
else {
- eprintk("failed to register %s\n", iotype_array[i]->name);
+ eprintk("Failed to register io type %s\n",
+ iotype_array[i]->name);
break;
}
}
Index: kernel/iscsi.c
===================================================================
--- kernel/iscsi.c (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi.c (.../trunk) (revision 147)
@@ -726,13 +726,18 @@
case READ_10:
case WRITE_10:
case WRITE_VERIFY:
- *off = be32_to_cpu(*(u32 *)&cmd[2]);
+ *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
+ (u32)cmd[4] << 8 | (u32)cmd[5];
*len = (cmd[7] << 8) + cmd[8];
break;
case READ_16:
case WRITE_16:
- *off = be64_to_cpu(*(u64 *)&cmd[2]);
- *len = be32_to_cpu(*(u32 *)&cmd[10]);
+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
+ (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
+ (u64)cmd[8] << 8 | (u64)cmd[9];
+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
+ (u32)cmd[12] << 8 | (u32)cmd[13];
break;
default:
BUG();
@@ -1191,10 +1196,56 @@
}
}
+static inline char *tmf_desc(int fun)
+{
+ static char *tmf_desc[] = {
+ "Unknown Function",
+ "Abort Task",
+ "Abort Task Set",
+ "Clear ACA",
+ "Clear Task Set",
+ "Logical Unit Reset",
+ "Target Warm Reset",
+ "Target Cold Reset",
+ "Task Reassign",
+ };
+
+ if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
+ (fun > ISCSI_FUNCTION_TASK_REASSIGN))
+ fun = 0;
+
+ return tmf_desc[fun];
+}
+
+static inline char *rsp_desc(int rsp)
+{
+ static char *rsp_desc[] = {
+ "Function Complete",
+ "Unknown Task",
+ "Unknown LUN",
+ "Task Allegiant",
+ "Failover Unsupported",
+ "Function Unsupported",
+ "No Authorization",
+ "Function Rejected",
+ "Unknown Response",
+ };
+
+ if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
+ (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
+ (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
+ rsp = 8;
+ else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
+ rsp = 7;
+
+ return rsp_desc[rsp];
+}
+
static void execute_task_management(struct iscsi_cmnd *req)
{
struct iscsi_conn *conn = req->conn;
- struct iscsi_target *target = conn->session->target;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_target *target = session->target;
struct iscsi_cmnd *rsp;
struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
struct iscsi_task_rsp_hdr *rsp_hdr;
@@ -1209,8 +1260,6 @@
rsp_hdr->itt = req_hdr->itt;
rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
- eprintk("%x %d %x\n", cmnd_itt(req), function, req_hdr->rtt);
-
switch (function) {
case ISCSI_FUNCTION_ABORT_TASK:
case ISCSI_FUNCTION_ABORT_TASK_SET:
@@ -1255,6 +1304,11 @@
break;
}
out:
+ iprintk("%s (%02x) issued on tid:%d lun:%d by sid:%llu (%s)\n",
+ tmf_desc(function), function, target->tid,
+ translate_lun(req_hdr->lun), session->sid,
+ rsp_desc(rsp_hdr->response));
+
iscsi_cmnd_init_write(rsp);
}
@@ -1708,8 +1762,7 @@
if ((err = event_init()) < 0)
goto err;
- iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
- 0, 0, NULL, NULL);
+ iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
if (!iscsi_cmnd_cache)
goto err;
Index: kernel/null-io.c
===================================================================
--- kernel/null-io.c (.../tags/0.4.15) (revision 147)
+++ kernel/null-io.c (.../trunk) (revision 147)
@@ -16,7 +16,7 @@
#include "iotype.h"
struct nullio_data {
- u32 sectors;
+ u64 sectors;
};
enum {
@@ -32,7 +32,7 @@
static int parse_nullio_params(struct iet_volume *volume, char *params)
{
int err = 0;
- char *p;
+ char *p, *q;
struct nullio_data *data = volume->private;
while ((p = strsep(¶ms, ",")) != NULL) {
@@ -43,7 +43,11 @@
token = match_token(p, tokens, args);
switch (token) {
case Opt_sectors:
- match_int(&args[0], &data->sectors);
+ q = match_strdup(&args[0]);
+ if (!q)
+ return -ENOMEM;
+ data->sectors = simple_strtoull(q, NULL, 10);
+ kfree(q);
break;
case Opt_ignore:
break;
@@ -97,7 +101,7 @@
void nullio_show(struct iet_volume *lu, struct seq_file *seq)
{
struct nullio_data *p = lu->private;
- seq_printf(seq, " sectors:%u\n", p->sectors);
+ seq_printf(seq, " sectors:%llu\n", p->sectors);
}
struct iotype nullio =
Index: kernel/iscsi.h
===================================================================
--- kernel/iscsi.h (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi.h (.../trunk) (revision 147)
@@ -116,9 +116,6 @@
struct worker_thread_info wthread_info;
struct semaphore target_sem;
-
- struct list_head initiator_list;
- u32 initiator_iid_count;
};
struct iscsi_queue {
@@ -189,8 +186,6 @@
struct list_head cmnd_hash[1 << IET_HASH_ORDER];
u32 next_ttt;
-
- struct iscsi_initiator *rinitiator;
};
enum connection_state_bit {
Index: kernel/digest.c
===================================================================
--- kernel/digest.c (.../tags/0.4.15) (revision 147)
+++ kernel/digest.c (.../trunk) (revision 147)
@@ -161,22 +161,17 @@
}
}
-/* Copied from linux-iscsi initiator and slightly adjusted */
-#define SETSG(sg, p, l) do { \
- (sg).page = virt_to_page((p)); \
- (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
- (sg).length = (l); \
-} while (0)
-
static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
u8 *crc)
{
struct scatterlist sg[2];
unsigned int nbytes = sizeof(struct iscsi_hdr);
- SETSG(sg[0], &pdu->bhs, nbytes);
+ sg_init_table(sg, pdu->ahssize ? 2 : 1);
+
+ sg_set_buf(&sg[0], &pdu->bhs, nbytes);
if (pdu->ahssize) {
- SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
nbytes += pdu->ahssize;
}
@@ -218,8 +213,9 @@
count = get_pgcnt(size, offset);
assert(idx + count <= tio->pg_cnt);
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
+ sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
crypto_hash_init(hash);
for (i = 0; size; i++) {
@@ -228,13 +224,13 @@
else
length = size;
- sg[i].page = tio->pvec[idx + i];
- sg[i].offset = offset;
- sg[i].length = length;
+ sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
size -= length;
offset = 0;
}
+ sg_mark_end(&sg[i - 1]);
+
crypto_hash_update(hash, sg, nbytes);
crypto_hash_final(hash, crc);
}
Index: kernel/event.c
===================================================================
--- kernel/event.c (.../tags/0.4.15) (revision 147)
+++ kernel/event.c (.../trunk) (revision 147)
@@ -28,7 +28,7 @@
return 0;
}
-static int event_recv_skb(struct sk_buff *skb)
+static void event_recv_skb(struct sk_buff *skb)
{
int err;
struct nlmsghdr *nlh;
@@ -37,7 +37,7 @@
while (skb->len >= NLMSG_SPACE(0)) {
nlh = (struct nlmsghdr *)skb->data;
if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
- return 0;
+ break;
rlen = NLMSG_ALIGN(nlh->nlmsg_len);
if (rlen > skb->len)
rlen = skb->len;
@@ -47,21 +47,8 @@
netlink_ack(skb, nlh, 0);
skb_pull(skb, rlen);
}
- return 0;
}
-static void event_recv(struct sock *sk, int length)
-{
- struct sk_buff *skb;
-
- while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
- if (event_recv_skb(skb) && skb->len)
- skb_queue_head(&sk->sk_receive_queue, skb);
- else
- kfree_skb(skb);
- }
-}
-
static int notify(void *data, int len, int gfp_mask)
{
struct sk_buff *skb;
@@ -95,7 +82,8 @@
int event_init(void)
{
- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+ NULL, THIS_MODULE);
if (!nl)
return -ENOMEM;
else
Index: kernel/nthread.c
===================================================================
--- kernel/nthread.c (.../tags/0.4.15) (revision 147)
+++ kernel/nthread.c (.../trunk) (revision 147)
@@ -13,8 +13,6 @@
#include "iscsi_dbg.h"
#include "digest.h"
-DECLARE_WAIT_QUEUE_HEAD(iscsi_ctl_wait);
-
enum daemon_state_bit {
D_ACTIVE,
D_DATA_READY,
Index: kernel/target.c
===================================================================
--- kernel/target.c (.../tags/0.4.15) (revision 147)
+++ kernel/target.c (.../trunk) (revision 147)
@@ -148,7 +148,6 @@
INIT_LIST_HEAD(&target->session_list);
INIT_LIST_HEAD(&target->volumes);
- INIT_LIST_HEAD(&target->initiator_list);
atomic_set(&target->nr_volumes, 0);
Index: kernel/iscsi_dbg.h
===================================================================
--- kernel/iscsi_dbg.h (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi_dbg.h (.../trunk) (revision 147)
@@ -15,21 +15,25 @@
extern unsigned long debug_enable_flags;
-#define dprintk(debug, fmt, args...) \
-do { \
- if ((debug) & debug_enable_flags) { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
- } \
+#define PFX "iscsi_trgt: "
+
+#define dprintk(debug, fmt, args...) do { \
+ if ((debug) & debug_enable_flags) { \
+ printk(KERN_DEBUG PFX "%s(%d) " fmt, __FUNCTION__,\
+ __LINE__, args);\
+ } \
} while (0)
-#define eprintk(fmt, args...) \
-do { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
+#define eprintk(fmt, args...) do { \
+ printk(KERN_ERR PFX "%s(%d) " fmt, __FUNCTION__, \
+ __LINE__, args);\
} while (0)
+#define iprintk(X...) printk(KERN_INFO PFX X)
+
#define assert(p) do { \
if (!(p)) { \
- printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
+ printk(KERN_CRIT PFX "BUG at %s:%d assert(%s)\n",\
__FILE__, __LINE__, #p); \
dump_stack(); \
BUG(); \
@@ -40,9 +44,10 @@
static inline void iscsi_dump_iov(struct msghdr *msg)
{
int i;
- printk("%p, %d\n", msg->msg_iov, msg->msg_iovlen);
+ printk(PFX "%p, %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0; i < min_t(size_t, msg->msg_iovlen, ISCSI_CONN_IOV_MAX); i++)
- printk("%d: %p,%d\n", i, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
+ printk(PFX "%d: %p,%d\n", i, msg->msg_iov[i].iov_base,
+ msg->msg_iov[i].iov_len);
}
#else
#define iscsi_dump_iov(x) do {} while (0)
@@ -84,18 +89,18 @@
int i;
buf = (void *)&pdu->bhs;
- printk("BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
+ printk(PFX "BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
for (i = 0; i < sizeof(pdu->bhs); i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
buf = (void *)pdu->ahs;
- printk("AHS: (%p,%d)\n", buf, pdu->ahssize);
+ printk(PFX "AHS: (%p,%d)\n", buf, pdu->ahssize);
for (i = 0; i < pdu->ahssize; i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
- printk("Data: (%d)\n", pdu->datasize);
+ printk(PFX "Data: (%d)\n", pdu->datasize);
}
#else
Index: kernel/tio.c
===================================================================
--- kernel/tio.c (.../tags/0.4.15) (revision 147)
+++ kernel/tio.c (.../trunk) (revision 147)
@@ -110,8 +110,7 @@
int tio_init(void)
{
- tio_cache = kmem_cache_create("tio", sizeof(struct tio),
- 0, 0, NULL, NULL);
+ tio_cache = KMEM_CACHE(tio, 0);
return tio_cache ? 0 : -ENOMEM;
}
Index: patches/compat-2.6.19-2.6.21.patch
===================================================================
--- patches/compat-2.6.19-2.6.21.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.19-2.6.21.patch (.../trunk) (revision 147)
@@ -0,0 +1,41 @@
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 122)
+@@ -95,8 +95,7 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+- THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/iscsi.c
+===================================================================
+--- kernel/iscsi.c (working copy)
++++ kernel/iscsi.c (revision 137)
+@@ -1757,7 +1757,8 @@ static int iscsi_init(void)
+ if ((err = event_init()) < 0)
+ goto err;
+
+- iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
++ iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
++ 0, 0, NULL, NULL);
+ if (!iscsi_cmnd_cache)
+ goto err;
+
+Index: kernel/tio.c
+===================================================================
+--- kernel/tio.c (working copy)
++++ kernel/tio.c (revision 137)
+@@ -110,7 +110,8 @@ int tio_sync(struct iet_volume *lu, stru
+
+ int tio_init(void)
+ {
+- tio_cache = KMEM_CACHE(tio, 0);
++ tio_cache = kmem_cache_create("tio", sizeof(struct tio),
++ 0, 0, NULL, NULL);
+ return tio_cache ? 0 : -ENOMEM;
+ }
Index: patches/compat-2.6.14-2.6.18.patch
===================================================================
--- patches/compat-2.6.14-2.6.18.patch (.../tags/0.4.15) (revision 147)
+++ patches/compat-2.6.14-2.6.18.patch (.../trunk) (revision 147)
@@ -2,7 +2,7 @@
===================================================================
--- kernel/iscsi.h (revision 105)
+++ kernel/iscsi.h (working copy)
-@@ -238,8 +238,8 @@ struct iscsi_conn {
+@@ -233,8 +233,8 @@ struct iscsi_conn {
u32 write_offset;
int write_state;
@@ -134,7 +134,7 @@
idx = offset >> PAGE_CACHE_SHIFT;
@@ -220,7 +211,7 @@ static void digest_data(struct hash_desc
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
- crypto_hash_init(hash);
+ crypto_digest_init(tfm);
Index: patches/compat-2.6.22-2.6.23.patch
===================================================================
--- patches/compat-2.6.22-2.6.23.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.22-2.6.23.patch (.../trunk) (revision 147)
@@ -0,0 +1,592 @@
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 142)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 142)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 142)
+@@ -161,15 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -221,7 +228,9 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 142)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
Index: usr/isns.c
===================================================================
--- usr/isns.c (.../tags/0.4.15) (revision 147)
+++ usr/isns.c (.../trunk) (revision 147)
@@ -256,7 +256,8 @@
scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE |
ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED;
- scn_flags = htonl(set_scn_flag(scn_flags));
+ set_scn_flag(scn_flags);
+ scn_flags = htonl(scn_flags);
length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_SCN_BITMAP,
sizeof(scn_flags), &scn_flags);
Index: usr/iscsid.c
===================================================================
--- usr/iscsid.c (.../tags/0.4.15) (revision 147)
+++ usr/iscsid.c (.../trunk) (revision 147)
@@ -89,11 +89,16 @@
char *buffer;
if (!conn->rsp.datasize) {
- if (!conn->rsp_buffer)
+ if (!conn->rsp_buffer) {
conn->rsp_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->rsp_buffer) {
+ log_error("Failed to alloc send buffer");
+ return;
+ }
+ }
conn->rsp.data = conn->rsp_buffer;
}
- if (conn->rwsize + len > INCOMING_BUFSIZE) {
+ if (conn->rsp.datasize + len > INCOMING_BUFSIZE) {
log_warning("Dropping key (%s=%s)", key, value);
return;
}
@@ -385,7 +390,12 @@
/* return; */
/* } */
- ki->param_get(conn->tid, 0, key_session, conn->session_param);
+ if (ki->param_get(conn->tid, 0, key_session,
+ conn->session_param)) {
+ rsp->status_class = ISCSI_STATUS_TARGET_ERROR;
+ rsp->status_detail = ISCSI_STATUS_SVC_UNAVAILABLE;
+ conn->state = STATE_EXIT;
+ }
}
conn->exp_cmd_sn = be32_to_cpu(req->cmd_sn);
log_debug(1, "exp_cmd_sn: %d,%d", conn->exp_cmd_sn, req->cmd_sn);
Index: usr/ietd.c
===================================================================
--- usr/ietd.c (.../tags/0.4.15) (revision 147)
+++ usr/ietd.c (.../trunk) (revision 147)
@@ -307,9 +307,24 @@
(conn->req.bhs.datalength[1] << 8) +
conn->req.bhs.datalength[2]);
conn->rwsize = (conn->req.ahssize + conn->req.datasize + 3) & -4;
+ if (conn->rwsize > INCOMING_BUFSIZE) {
+ log_warning("Recv PDU with "
+ "invalid size %d "
+ "(max: %d)",
+ conn->rwsize,
+ INCOMING_BUFSIZE);
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
if (conn->rwsize) {
- if (!conn->req_buffer)
+ if (!conn->req_buffer) {
conn->req_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->req_buffer) {
+ log_error("Failed to alloc recv buffer");
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
+ }
conn->buffer = conn->req_buffer;
conn->req.ahs = conn->buffer;
conn->req.data = conn->buffer + conn->req.ahssize;
@@ -396,6 +411,7 @@
exit(1);
}
+ conn_close:
if (conn->state == STATE_CLOSE) {
log_debug(0, "connection closed");
conn_free_pdu(conn);
Index: etc/initd/initd.gentoo
===================================================================
--- etc/initd/initd.gentoo (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.gentoo (.../trunk) (revision 147)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
depend()
{
use net
}
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
Index: etc/initd/initd
===================================================================
--- etc/initd/initd (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd (.../trunk) (revision 147)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
}
-
+
stop_server()
{
ietadm --op delete
Index: etc/initd/initd.debian
===================================================================
--- etc/initd/initd.debian (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.debian (.../trunk) (revision 147)
@@ -10,65 +10,29 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# Don't touch this "memsize thingy" unless you are blessed
-# with knowledge about it.
-MEM_SIZE=1048576
-
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
ietd_start()
{
echo -n "Starting iSCSI enterprise target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
start-stop-daemon --start --exec $DAEMON --quiet
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
- fi
+ fi
}
-
+
ietd_stop()
{
echo -n "Removing iSCSI enterprise target devices: "
- # ugly, but ietadm does not allways provides correct exit values
+ # ugly, but ietadm does not always provide correct exit values
RETURN=`ietadm --op delete 2>&1`
RETVAL=$?
- if [ $RETVAL == "0" ] && [[ $RETURN != "something wrong" ]]; then
+ if [ $RETVAL -eq 0 ] && [ x$RETURN != x"something wrong" ]; then
echo "succeeded."
else
echo "failed with reason :$RETURN"
@@ -78,19 +42,19 @@
echo -n "Stopping iSCSI enterprise target service: "
start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
fi
- # ugly, but pid file is not removed ba ietd
+ # ugly, but pid file is not removed by ietd
rm -f $PID_FILE
echo -n "Removing iSCSI enterprise target modules: "
modprobe -r iscsi_trgt
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
@@ -117,18 +81,18 @@
else
echo "no iSCSI enterprise target found!"
exit 1
- fi
+ fi
;;
dump)
DUMP=`tempfile -p ietd`
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Failed to create dump file $DUMP"
exit 1
fi
ietadm --mode dump --all >$DUMP
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Error dumping config from daemon"
rm $DUMP
exit 1
Index: etc/initd/initd.redhat
===================================================================
--- etc/initd/initd.redhat (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.redhat (.../trunk) (revision 147)
@@ -16,45 +16,12 @@
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
start()
{
echo -n "Starting iSCSI target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
daemon /usr/sbin/ietd
@@ -62,7 +29,7 @@
echo
return $RETVAL
}
-
+
stop()
{
echo -n "Stopping iSCSI target service: "
@@ -71,7 +38,7 @@
modprobe -r iscsi_trgt 2>/dev/null
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
@@ -102,7 +69,7 @@
exit 1
else
echo "ietd (pid $PID) is running..."
- fi
+ fi
}
case "$1" in
Index: Makefile
===================================================================
--- Makefile (.../tags/0.4.15) (revision 147)
+++ Makefile (.../trunk) (revision 147)
@@ -51,6 +51,16 @@
# base first the earlier patch sets will not need to be modified.
#
+# Compatibility patch for kernels >= 2.6.22 and <= 2.6.23
+ifeq ($(call kver_le,2,6,23),1)
+ PATCHES := $(PATCHES) compat-2.6.22-2.6.23.patch
+endif
+
+# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
+ifeq ($(call kver_le,2,6,21),1)
+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
+endif
+
# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
ifeq ($(call kver_le,2,6,18),1)
PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
@@ -140,27 +150,34 @@
rm -f .patched.*; \
fi
-install: install-kernel install-usr install-etc install-doc
+depmod:
+ @echo "Running depmod"
+ @if [ x$(DISTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
+ depmod -aq -b $(DISTDIR)$(INSTALL_MOD_PATH) $(KVER); \
+ else \
+ depmod -aq $(KVER); \
+ fi
+install: install-usr install-etc install-doc install-kernel depmod
+
install-kernel: kernel/iscsi_trgt.ko
@install -vD kernel/iscsi_trgt.ko \
$(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
install-usr: usr/ietd usr/ietadm
@install -vD usr/ietd $(DISTDIR)/usr/sbin/ietd
@install -vD usr/ietadm $(DISTDIR)/usr/sbin/ietadm
install-etc: install-initd
- @if [ ! -e /etc/ietd.conf ]; then \
+ @if [ ! -e $(DISTDIR)/etc/ietd.conf ]; then \
install -vD -m 644 etc/ietd.conf \
$(DISTDIR)/etc/ietd.conf; \
fi
- @if [ ! -e /etc/initiators.allow ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.allow ]; then \
install -vD -m 644 etc/initiators.allow \
$(DISTDIR)/etc/initiators.allow; \
fi
- @if [ ! -e /etc/initiators.deny ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.deny ]; then \
install -vD -m 644 etc/initiators.deny \
$(DISTDIR)/etc/initiators.deny; \
fi
@@ -204,11 +221,10 @@
$(DISTDIR)$(MANDIR)/man$$s/$$f ; \
done
-uninstall: uninstall-kernel uninstall-usr uninstall-etc uninstall-doc
+uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
uninstall-kernel:
rm -f $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
uninstall-usr:
@rm -f $(DISTDIR)/usr/sbin/ietd
iscsitarget-0.4.15-types.h.patch:
--- NEW FILE iscsitarget-0.4.15-types.h.patch ---
diff -up iscsitarget-0.4.15/kernel/block-io.c~ iscsitarget-0.4.15/kernel/block-io.c
--- iscsitarget-0.4.15/kernel/block-io.c~ 2008-09-23 09:20:55.000000000 +0200
+++ iscsitarget-0.4.15/kernel/block-io.c 2008-09-23 09:20:55.000000000 +0200
@@ -9,6 +9,7 @@
* This code is licenced under the GPL.
*/
+#include <linux/types.h>
#include <linux/parser.h>
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
--- NEW FILE iscsitarget-kmod.spec ---
# buildforkernels macro hint: when you build a new version or a new release
# that contains bugfixes or other improvements then you must disable the
# "buildforkernels newest" macro for just that build; immediately after
# queuing that build enable the macro again for subsequent builds; that way
# a new akmod package will only get build when a new one is actually needed
%define buildforkernels newest
# Release code won't build for newer kernels
%define patchlevel svn147
Name: iscsitarget-kmod
Version: 0.4.15
Release: 41.%{patchlevel}%{?dist}.1
Epoch: 1
Summary: iscsitarget kernel modules
Group: System Environment/Kernel
License: GPLv2
URL: http://sourceforge.net/projects/iscsitarget/
Source0: http://dl.sf.net/iscsitarget/iscsitarget-%{version}.tar.gz
# This was created with:
# svn diff http://svn.berlios.de/svnroot/repos/iscsitarget/tags/0.4.15/ \
# http://svn.berlios.de/svnroot/repos/iscsitarget/trunk/@147
Patch0: iscsitarget-0.4.15-%{patchlevel}.patch
Patch1: iscsitarget-0.4.15-types.h.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: i586 i686 x86_64 ppc64
# ppc disabled by knurd on 20081003 as it is known to fail on 2.6.26:
# https://bugzilla.redhat.com/show_bug.cgi?id=464613
# get the needed BuildRequires (in parts depending on what we build for)
BuildRequires: %{_bindir}/kmodtool
%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} }
# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
Kernel module for a kernel-based open source iSCSI target.
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
# go
%setup -q -c -T -a 0
pushd iscsitarget-%{version}
%patch0 -p0
%patch1 -p1
#%patch0 -p0 -b .svn142
# -b creates empty mode 000 file that cannot be copied with cp -a
popd
for kernel_version in %{?kernel_versions}; do
cp -a iscsitarget-%{version} _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions}; do
make -C "_kmod_build_${kernel_version%%___*}" KSRC="${kernel_version##*___}" patch
make -C "${kernel_version##*___}" SUBDIRS="${PWD}/_kmod_build_${kernel_version%%___*}"/kernel modules
done
%install
rm -rf $RPM_BUILD_ROOT
for kernel_version in %{?kernel_versions}; do
install -D -m 755 _kmod_build_${kernel_version%%___*}/kernel/iscsi_trgt.ko \
$RPM_BUILD_ROOT%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/iscsi_trgt.ko
done
%{?akmod_install}
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Oct 03 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-41.svn147.1
- rebuild for rpm fusion
* Wed Oct 01 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-40.svn147
- rebuild for new kernels
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-39.svn147
- temporary disable ppc due to http://bugzilla.kernel.org/show_bug.cgi?id=11143
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-38.svn147
- rebuild for new kernels
- add patch iscsitarget-0.4.15-types.h.patch from hansg
* Sat Aug 16 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-37.svn147
- rebuild for new kernels
* Thu Jul 24 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-36
- rebuild for new Fedora kernels
* Tue Jul 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-35
- rebuild for new Fedora kernels
* Wed Jul 02 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-34
- rebuild for new Fedora kernels
* Fri Jun 13 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-33
- rebuild for new Fedora kernels
* Fri Jun 06 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-32
- rebuild for new Fedora kernels
* Thu May 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-31
- rebuild for new Fedora kernels
* Sun May 04 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-30.svn142
- build for f9
* Sat Feb 16 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-9.svn142
- fix typo
* Thu Feb 14 2008 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-8.svn147
- Fix compilation for 2.6.24
* Sat Jan 26 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-7.svn142
- rebuild for new kmodtools, akmod adjustments
* Mon Jan 21 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-6.svn142
- build akmods package
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-5.svn142
- Correct versioning, bump epoch
- Comment on how the svn142 patch was created
* Wed Dec 05 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-4
- Convert to kmod2
* Sun Nov 11 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-2
- Added make patch before building, to fix builds for 2.6.18 kernels and earlier
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-1
- Initial package
16 years, 1 month
rpms/iscsitarget-kmod/devel iscsitarget-0.4.15-svn147.patch, NONE, 1.1 iscsitarget-0.4.15-types.h.patch, NONE, 1.1 iscsitarget-kmod.spec, NONE, 1.1 iscsitarget-kmod.spec~, NONE, 1.1
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget-kmod/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv1764
Added Files:
iscsitarget-0.4.15-svn147.patch
iscsitarget-0.4.15-types.h.patch iscsitarget-kmod.spec
iscsitarget-kmod.spec~
Log Message:
import from livna
iscsitarget-0.4.15-svn147.patch:
--- NEW FILE iscsitarget-0.4.15-svn147.patch ---
Index: kernel/block-io.c
===================================================================
--- kernel/block-io.c (.../tags/0.4.15) (revision 147)
+++ kernel/block-io.c (.../trunk) (revision 147)
@@ -28,15 +28,10 @@
struct completion tio_complete;
};
-static int
-blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+static void blockio_bio_endio(struct bio *bio, int error)
{
struct tio_work *tio_work = bio->bi_private;
- /* Ignore partials */
- if (bio->bi_size)
- return 1;
-
error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
if (error)
@@ -47,8 +42,6 @@
complete(&tio_work->tio_complete);
bio_put(bio);
-
- return 0;
}
/*
@@ -169,8 +162,8 @@
bdev = open_bdev_excl(path, flags, THIS_MODULE);
if (IS_ERR(bdev)) {
- err = PTR_ERR (bdev);
- eprintk("Can't open device %s \n", path);
+ err = PTR_ERR(bdev);
+ eprintk("Can't open device %s, error %d\n", path, err);
bio_data->bdev = NULL;
} else {
bio_data->bdev = bdev;
@@ -217,7 +210,7 @@
p = (u32 *) (volume->scsi_id + VENDOR_ID_LEN);
*(p + 0) = volume->target->trgt_param.target_type;
*(p + 1) = volume->target->tid;
- *(p + 2) = (unsigned int) inode->i_ino;
+ *(p + 2) = volume->lun;
*(p + 3) = (unsigned int) inode->i_sb->s_dev;
}
@@ -319,6 +312,7 @@
if (bio_data->bdev)
close_bdev_excl(bio_data->bdev);
+ kfree(bio_data->path);
kfree(volume->private);
}
Index: kernel/target_disk.c
===================================================================
--- kernel/target_disk.c (.../tags/0.4.15) (revision 147)
+++ kernel/target_disk.c (.../trunk) (revision 147)
@@ -66,13 +66,15 @@
unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00};
- u32 ncyl, *p;
+ u32 ncyl;
+ u32 n;
/* assume 0xff heads, 15krpm. */
memcpy(ptr, geo_m_pg, sizeof(geo_m_pg));
ncyl = sec >> 14; /* 256 * 64 */
- p = (u32 *)(ptr + 1);
- *p = *p | cpu_to_be32(ncyl);
+ memcpy(&n, ptr+1, sizeof(u32));
+ n = n | cpu_to_be32(ncyl);
+ memcpy(ptr+1, &n, sizeof(u32));
return sizeof(geo_m_pg);
}
@@ -249,7 +251,8 @@
struct iet_volume *lun;
int rest, idx = 0;
- size = be32_to_cpu(*(u32 *)&req->scb[6]);
+ size = (u32)req->scb[6] << 24 | (u32)req->scb[7] << 16 |
+ (u32)req->scb[8] << 8 | (u32)req->scb[9];
if (size < 16)
return -1;
Index: kernel/config.c
===================================================================
--- kernel/config.c (.../tags/0.4.15) (revision 147)
+++ kernel/config.c (.../trunk) (revision 147)
@@ -40,7 +40,7 @@
int i;
struct proc_dir_entry *ent;
- if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
goto err;
proc_iet_dir->owner = THIS_MODULE;
Index: kernel/volume.c
===================================================================
--- kernel/volume.c (.../tags/0.4.15) (revision 147)
+++ kernel/volume.c (.../trunk) (revision 147)
@@ -132,6 +132,8 @@
list_add_tail(&volume->list, &target->volumes);
atomic_inc(&target->nr_volumes);
+ kfree(args);
+
return 0;
free_args:
kfree(args);
Index: kernel/iotype.c
===================================================================
--- kernel/iotype.c (.../tags/0.4.15) (revision 147)
+++ kernel/iotype.c (.../trunk) (revision 147)
@@ -89,9 +89,11 @@
for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
if (!(err = register_iotype(iotype_array[i])))
- eprintk("register %s\n", iotype_array[i]->name);
+ iprintk("Registered io type %s\n",
+ iotype_array[i]->name);
else {
- eprintk("failed to register %s\n", iotype_array[i]->name);
+ eprintk("Failed to register io type %s\n",
+ iotype_array[i]->name);
break;
}
}
Index: kernel/iscsi.c
===================================================================
--- kernel/iscsi.c (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi.c (.../trunk) (revision 147)
@@ -726,13 +726,18 @@
case READ_10:
case WRITE_10:
case WRITE_VERIFY:
- *off = be32_to_cpu(*(u32 *)&cmd[2]);
+ *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
+ (u32)cmd[4] << 8 | (u32)cmd[5];
*len = (cmd[7] << 8) + cmd[8];
break;
case READ_16:
case WRITE_16:
- *off = be64_to_cpu(*(u64 *)&cmd[2]);
- *len = be32_to_cpu(*(u32 *)&cmd[10]);
+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
+ (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
+ (u64)cmd[8] << 8 | (u64)cmd[9];
+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
+ (u32)cmd[12] << 8 | (u32)cmd[13];
break;
default:
BUG();
@@ -1191,10 +1196,56 @@
}
}
+static inline char *tmf_desc(int fun)
+{
+ static char *tmf_desc[] = {
+ "Unknown Function",
+ "Abort Task",
+ "Abort Task Set",
+ "Clear ACA",
+ "Clear Task Set",
+ "Logical Unit Reset",
+ "Target Warm Reset",
+ "Target Cold Reset",
+ "Task Reassign",
+ };
+
+ if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
+ (fun > ISCSI_FUNCTION_TASK_REASSIGN))
+ fun = 0;
+
+ return tmf_desc[fun];
+}
+
+static inline char *rsp_desc(int rsp)
+{
+ static char *rsp_desc[] = {
+ "Function Complete",
+ "Unknown Task",
+ "Unknown LUN",
+ "Task Allegiant",
+ "Failover Unsupported",
+ "Function Unsupported",
+ "No Authorization",
+ "Function Rejected",
+ "Unknown Response",
+ };
+
+ if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
+ (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
+ (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
+ rsp = 8;
+ else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
+ rsp = 7;
+
+ return rsp_desc[rsp];
+}
+
static void execute_task_management(struct iscsi_cmnd *req)
{
struct iscsi_conn *conn = req->conn;
- struct iscsi_target *target = conn->session->target;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_target *target = session->target;
struct iscsi_cmnd *rsp;
struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
struct iscsi_task_rsp_hdr *rsp_hdr;
@@ -1209,8 +1260,6 @@
rsp_hdr->itt = req_hdr->itt;
rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
- eprintk("%x %d %x\n", cmnd_itt(req), function, req_hdr->rtt);
-
switch (function) {
case ISCSI_FUNCTION_ABORT_TASK:
case ISCSI_FUNCTION_ABORT_TASK_SET:
@@ -1255,6 +1304,11 @@
break;
}
out:
+ iprintk("%s (%02x) issued on tid:%d lun:%d by sid:%llu (%s)\n",
+ tmf_desc(function), function, target->tid,
+ translate_lun(req_hdr->lun), session->sid,
+ rsp_desc(rsp_hdr->response));
+
iscsi_cmnd_init_write(rsp);
}
@@ -1708,8 +1762,7 @@
if ((err = event_init()) < 0)
goto err;
- iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
- 0, 0, NULL, NULL);
+ iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
if (!iscsi_cmnd_cache)
goto err;
Index: kernel/null-io.c
===================================================================
--- kernel/null-io.c (.../tags/0.4.15) (revision 147)
+++ kernel/null-io.c (.../trunk) (revision 147)
@@ -16,7 +16,7 @@
#include "iotype.h"
struct nullio_data {
- u32 sectors;
+ u64 sectors;
};
enum {
@@ -32,7 +32,7 @@
static int parse_nullio_params(struct iet_volume *volume, char *params)
{
int err = 0;
- char *p;
+ char *p, *q;
struct nullio_data *data = volume->private;
while ((p = strsep(¶ms, ",")) != NULL) {
@@ -43,7 +43,11 @@
token = match_token(p, tokens, args);
switch (token) {
case Opt_sectors:
- match_int(&args[0], &data->sectors);
+ q = match_strdup(&args[0]);
+ if (!q)
+ return -ENOMEM;
+ data->sectors = simple_strtoull(q, NULL, 10);
+ kfree(q);
break;
case Opt_ignore:
break;
@@ -97,7 +101,7 @@
void nullio_show(struct iet_volume *lu, struct seq_file *seq)
{
struct nullio_data *p = lu->private;
- seq_printf(seq, " sectors:%u\n", p->sectors);
+ seq_printf(seq, " sectors:%llu\n", p->sectors);
}
struct iotype nullio =
Index: kernel/iscsi.h
===================================================================
--- kernel/iscsi.h (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi.h (.../trunk) (revision 147)
@@ -116,9 +116,6 @@
struct worker_thread_info wthread_info;
struct semaphore target_sem;
-
- struct list_head initiator_list;
- u32 initiator_iid_count;
};
struct iscsi_queue {
@@ -189,8 +186,6 @@
struct list_head cmnd_hash[1 << IET_HASH_ORDER];
u32 next_ttt;
-
- struct iscsi_initiator *rinitiator;
};
enum connection_state_bit {
Index: kernel/digest.c
===================================================================
--- kernel/digest.c (.../tags/0.4.15) (revision 147)
+++ kernel/digest.c (.../trunk) (revision 147)
@@ -161,22 +161,17 @@
}
}
-/* Copied from linux-iscsi initiator and slightly adjusted */
-#define SETSG(sg, p, l) do { \
- (sg).page = virt_to_page((p)); \
- (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
- (sg).length = (l); \
-} while (0)
-
static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
u8 *crc)
{
struct scatterlist sg[2];
unsigned int nbytes = sizeof(struct iscsi_hdr);
- SETSG(sg[0], &pdu->bhs, nbytes);
+ sg_init_table(sg, pdu->ahssize ? 2 : 1);
+
+ sg_set_buf(&sg[0], &pdu->bhs, nbytes);
if (pdu->ahssize) {
- SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
nbytes += pdu->ahssize;
}
@@ -218,8 +213,9 @@
count = get_pgcnt(size, offset);
assert(idx + count <= tio->pg_cnt);
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
+ sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
crypto_hash_init(hash);
for (i = 0; size; i++) {
@@ -228,13 +224,13 @@
else
length = size;
- sg[i].page = tio->pvec[idx + i];
- sg[i].offset = offset;
- sg[i].length = length;
+ sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
size -= length;
offset = 0;
}
+ sg_mark_end(&sg[i - 1]);
+
crypto_hash_update(hash, sg, nbytes);
crypto_hash_final(hash, crc);
}
Index: kernel/event.c
===================================================================
--- kernel/event.c (.../tags/0.4.15) (revision 147)
+++ kernel/event.c (.../trunk) (revision 147)
@@ -28,7 +28,7 @@
return 0;
}
-static int event_recv_skb(struct sk_buff *skb)
+static void event_recv_skb(struct sk_buff *skb)
{
int err;
struct nlmsghdr *nlh;
@@ -37,7 +37,7 @@
while (skb->len >= NLMSG_SPACE(0)) {
nlh = (struct nlmsghdr *)skb->data;
if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
- return 0;
+ break;
rlen = NLMSG_ALIGN(nlh->nlmsg_len);
if (rlen > skb->len)
rlen = skb->len;
@@ -47,21 +47,8 @@
netlink_ack(skb, nlh, 0);
skb_pull(skb, rlen);
}
- return 0;
}
-static void event_recv(struct sock *sk, int length)
-{
- struct sk_buff *skb;
-
- while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
- if (event_recv_skb(skb) && skb->len)
- skb_queue_head(&sk->sk_receive_queue, skb);
- else
- kfree_skb(skb);
- }
-}
-
static int notify(void *data, int len, int gfp_mask)
{
struct sk_buff *skb;
@@ -95,7 +82,8 @@
int event_init(void)
{
- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+ NULL, THIS_MODULE);
if (!nl)
return -ENOMEM;
else
Index: kernel/nthread.c
===================================================================
--- kernel/nthread.c (.../tags/0.4.15) (revision 147)
+++ kernel/nthread.c (.../trunk) (revision 147)
@@ -13,8 +13,6 @@
#include "iscsi_dbg.h"
#include "digest.h"
-DECLARE_WAIT_QUEUE_HEAD(iscsi_ctl_wait);
-
enum daemon_state_bit {
D_ACTIVE,
D_DATA_READY,
Index: kernel/target.c
===================================================================
--- kernel/target.c (.../tags/0.4.15) (revision 147)
+++ kernel/target.c (.../trunk) (revision 147)
@@ -148,7 +148,6 @@
INIT_LIST_HEAD(&target->session_list);
INIT_LIST_HEAD(&target->volumes);
- INIT_LIST_HEAD(&target->initiator_list);
atomic_set(&target->nr_volumes, 0);
Index: kernel/iscsi_dbg.h
===================================================================
--- kernel/iscsi_dbg.h (.../tags/0.4.15) (revision 147)
+++ kernel/iscsi_dbg.h (.../trunk) (revision 147)
@@ -15,21 +15,25 @@
extern unsigned long debug_enable_flags;
-#define dprintk(debug, fmt, args...) \
-do { \
- if ((debug) & debug_enable_flags) { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
- } \
+#define PFX "iscsi_trgt: "
+
+#define dprintk(debug, fmt, args...) do { \
+ if ((debug) & debug_enable_flags) { \
+ printk(KERN_DEBUG PFX "%s(%d) " fmt, __FUNCTION__,\
+ __LINE__, args);\
+ } \
} while (0)
-#define eprintk(fmt, args...) \
-do { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
+#define eprintk(fmt, args...) do { \
+ printk(KERN_ERR PFX "%s(%d) " fmt, __FUNCTION__, \
+ __LINE__, args);\
} while (0)
+#define iprintk(X...) printk(KERN_INFO PFX X)
+
#define assert(p) do { \
if (!(p)) { \
- printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
+ printk(KERN_CRIT PFX "BUG at %s:%d assert(%s)\n",\
__FILE__, __LINE__, #p); \
dump_stack(); \
BUG(); \
@@ -40,9 +44,10 @@
static inline void iscsi_dump_iov(struct msghdr *msg)
{
int i;
- printk("%p, %d\n", msg->msg_iov, msg->msg_iovlen);
+ printk(PFX "%p, %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0; i < min_t(size_t, msg->msg_iovlen, ISCSI_CONN_IOV_MAX); i++)
- printk("%d: %p,%d\n", i, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
+ printk(PFX "%d: %p,%d\n", i, msg->msg_iov[i].iov_base,
+ msg->msg_iov[i].iov_len);
}
#else
#define iscsi_dump_iov(x) do {} while (0)
@@ -84,18 +89,18 @@
int i;
buf = (void *)&pdu->bhs;
- printk("BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
+ printk(PFX "BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
for (i = 0; i < sizeof(pdu->bhs); i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
buf = (void *)pdu->ahs;
- printk("AHS: (%p,%d)\n", buf, pdu->ahssize);
+ printk(PFX "AHS: (%p,%d)\n", buf, pdu->ahssize);
for (i = 0; i < pdu->ahssize; i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
- printk("Data: (%d)\n", pdu->datasize);
+ printk(PFX "Data: (%d)\n", pdu->datasize);
}
#else
Index: kernel/tio.c
===================================================================
--- kernel/tio.c (.../tags/0.4.15) (revision 147)
+++ kernel/tio.c (.../trunk) (revision 147)
@@ -110,8 +110,7 @@
int tio_init(void)
{
- tio_cache = kmem_cache_create("tio", sizeof(struct tio),
- 0, 0, NULL, NULL);
+ tio_cache = KMEM_CACHE(tio, 0);
return tio_cache ? 0 : -ENOMEM;
}
Index: patches/compat-2.6.19-2.6.21.patch
===================================================================
--- patches/compat-2.6.19-2.6.21.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.19-2.6.21.patch (.../trunk) (revision 147)
@@ -0,0 +1,41 @@
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 122)
+@@ -95,8 +95,7 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+- THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/iscsi.c
+===================================================================
+--- kernel/iscsi.c (working copy)
++++ kernel/iscsi.c (revision 137)
+@@ -1757,7 +1757,8 @@ static int iscsi_init(void)
+ if ((err = event_init()) < 0)
+ goto err;
+
+- iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
++ iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
++ 0, 0, NULL, NULL);
+ if (!iscsi_cmnd_cache)
+ goto err;
+
+Index: kernel/tio.c
+===================================================================
+--- kernel/tio.c (working copy)
++++ kernel/tio.c (revision 137)
+@@ -110,7 +110,8 @@ int tio_sync(struct iet_volume *lu, stru
+
+ int tio_init(void)
+ {
+- tio_cache = KMEM_CACHE(tio, 0);
++ tio_cache = kmem_cache_create("tio", sizeof(struct tio),
++ 0, 0, NULL, NULL);
+ return tio_cache ? 0 : -ENOMEM;
+ }
Index: patches/compat-2.6.14-2.6.18.patch
===================================================================
--- patches/compat-2.6.14-2.6.18.patch (.../tags/0.4.15) (revision 147)
+++ patches/compat-2.6.14-2.6.18.patch (.../trunk) (revision 147)
@@ -2,7 +2,7 @@
===================================================================
--- kernel/iscsi.h (revision 105)
+++ kernel/iscsi.h (working copy)
-@@ -238,8 +238,8 @@ struct iscsi_conn {
+@@ -233,8 +233,8 @@ struct iscsi_conn {
u32 write_offset;
int write_state;
@@ -134,7 +134,7 @@
idx = offset >> PAGE_CACHE_SHIFT;
@@ -220,7 +211,7 @@ static void digest_data(struct hash_desc
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
- crypto_hash_init(hash);
+ crypto_digest_init(tfm);
Index: patches/compat-2.6.22-2.6.23.patch
===================================================================
--- patches/compat-2.6.22-2.6.23.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.22-2.6.23.patch (.../trunk) (revision 147)
@@ -0,0 +1,592 @@
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 145)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 145)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 145)
+@@ -161,17 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_init_table(sg, pdu->ahssize ? 2 : 1);
+-
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -215,7 +220,6 @@ static void digest_data(struct hash_desc
+
+ assert(count <= ISCSI_CONN_IOV_MAX);
+
+- sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg));
+ crypto_hash_init(hash);
+
+ for (i = 0; size; i++) {
+@@ -224,13 +228,13 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+
+- sg_mark_end(&sg[i - 1]);
+-
+ crypto_hash_update(hash, sg, nbytes);
+ crypto_hash_final(hash, crc);
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 145)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/block-io.c
+===================================================================
+--- kernel/block-io.c (working copy)
++++ kernel/block-io.c (revision 142)
+@@ -28,10 +28,15 @@ struct tio_work {
+ struct completion tio_complete;
+ };
+
+-static void blockio_bio_endio(struct bio *bio, int error)
++static int
++blockio_bio_endio(struct bio *bio, unsigned int bytes_done, int error)
+ {
+ struct tio_work *tio_work = bio->bi_private;
+
++ /* Ignore partials */
++ if (bio->bi_size)
++ return 1;
++
+ error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO;
+
+ if (error)
+@@ -42,6 +47,8 @@ static void blockio_bio_endio(struct bio
+ complete(&tio_work->tio_complete);
+
+ bio_put(bio);
++
++ return 0;
+ }
+
+ /*
+Index: kernel/config.c
+===================================================================
+--- kernel/config.c (working copy)
++++ kernel/config.c (revision 142)
+@@ -40,7 +40,7 @@ int iet_procfs_init(void)
+ int i;
+ struct proc_dir_entry *ent;
+
+- if (!(proc_iet_dir = proc_mkdir("iet", init_net.proc_net)))
++ if (!(proc_iet_dir = proc_mkdir("net/iet", 0)))
+ goto err;
+
+ proc_iet_dir->owner = THIS_MODULE;
+Index: kernel/digest.c
+===================================================================
+--- kernel/digest.c (working copy)
++++ kernel/digest.c (revision 142)
+@@ -161,15 +161,22 @@ static inline void __dbg_simulate_data_d
+ }
+ }
+
++/* Copied from linux-iscsi initiator and slightly adjusted */
++#define SETSG(sg, p, l) do { \
++ (sg).page = virt_to_page((p)); \
++ (sg).offset = ((unsigned long)(p) & ~PAGE_CACHE_MASK); \
++ (sg).length = (l); \
++} while (0)
++
+ static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu,
+ u8 *crc)
+ {
+ struct scatterlist sg[2];
+ unsigned int nbytes = sizeof(struct iscsi_hdr);
+
+- sg_set_buf(&sg[0], &pdu->bhs, nbytes);
++ SETSG(sg[0], &pdu->bhs, nbytes);
+ if (pdu->ahssize) {
+- sg_set_buf(&sg[1], pdu->ahs, pdu->ahssize);
++ SETSG(sg[1], pdu->ahs, pdu->ahssize);
+ nbytes += pdu->ahssize;
+ }
+
+@@ -221,7 +228,9 @@ static void digest_data(struct hash_desc
+ else
+ length = size;
+
+- sg_set_page(&sg[i], tio->pvec[idx + i], length, offset);
++ sg[i].page = tio->pvec[idx + i];
++ sg[i].offset = offset;
++ sg[i].length = length;
+ size -= length;
+ offset = 0;
+ }
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 142)
+@@ -28,7 +28,7 @@ static int event_recv_msg(struct sk_buff
+ return 0;
+ }
+
+-static void event_recv_skb(struct sk_buff *skb)
++static int event_recv_skb(struct sk_buff *skb)
+ {
+ int err;
+ struct nlmsghdr *nlh;
+@@ -37,7 +37,7 @@ static void event_recv_skb(struct sk_buf
+ while (skb->len >= NLMSG_SPACE(0)) {
+ nlh = (struct nlmsghdr *)skb->data;
+ if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
+- break;
++ return 0;
+ rlen = NLMSG_ALIGN(nlh->nlmsg_len);
+ if (rlen > skb->len)
+ rlen = skb->len;
+@@ -47,6 +47,19 @@ static void event_recv_skb(struct sk_buf
+ netlink_ack(skb, nlh, 0);
+ skb_pull(skb, rlen);
+ }
++ return 0;
++}
++
++static void event_recv(struct sock *sk, int length)
++{
++ struct sk_buff *skb;
++
++ while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
++ if (event_recv_skb(skb) && skb->len)
++ skb_queue_head(&sk->sk_receive_queue, skb);
++ else
++ kfree_skb(skb);
++ }
+ }
+
+ static int notify(void *data, int len, int gfp_mask)
+@@ -82,8 +95,8 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(&init_net, NETLINK_IET, 1, event_recv_skb,
+- NULL, THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
++ THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
Index: usr/isns.c
===================================================================
--- usr/isns.c (.../tags/0.4.15) (revision 147)
+++ usr/isns.c (.../trunk) (revision 147)
@@ -256,7 +256,8 @@
scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE |
ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED;
- scn_flags = htonl(set_scn_flag(scn_flags));
+ set_scn_flag(scn_flags);
+ scn_flags = htonl(scn_flags);
length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_SCN_BITMAP,
sizeof(scn_flags), &scn_flags);
Index: usr/iscsid.c
===================================================================
--- usr/iscsid.c (.../tags/0.4.15) (revision 147)
+++ usr/iscsid.c (.../trunk) (revision 147)
@@ -89,11 +89,16 @@
char *buffer;
if (!conn->rsp.datasize) {
- if (!conn->rsp_buffer)
+ if (!conn->rsp_buffer) {
conn->rsp_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->rsp_buffer) {
+ log_error("Failed to alloc send buffer");
+ return;
+ }
+ }
conn->rsp.data = conn->rsp_buffer;
}
- if (conn->rwsize + len > INCOMING_BUFSIZE) {
+ if (conn->rsp.datasize + len > INCOMING_BUFSIZE) {
log_warning("Dropping key (%s=%s)", key, value);
return;
}
@@ -385,7 +390,12 @@
/* return; */
/* } */
- ki->param_get(conn->tid, 0, key_session, conn->session_param);
+ if (ki->param_get(conn->tid, 0, key_session,
+ conn->session_param)) {
+ rsp->status_class = ISCSI_STATUS_TARGET_ERROR;
+ rsp->status_detail = ISCSI_STATUS_SVC_UNAVAILABLE;
+ conn->state = STATE_EXIT;
+ }
}
conn->exp_cmd_sn = be32_to_cpu(req->cmd_sn);
log_debug(1, "exp_cmd_sn: %d,%d", conn->exp_cmd_sn, req->cmd_sn);
Index: usr/ietd.c
===================================================================
--- usr/ietd.c (.../tags/0.4.15) (revision 147)
+++ usr/ietd.c (.../trunk) (revision 147)
@@ -307,9 +307,24 @@
(conn->req.bhs.datalength[1] << 8) +
conn->req.bhs.datalength[2]);
conn->rwsize = (conn->req.ahssize + conn->req.datasize + 3) & -4;
+ if (conn->rwsize > INCOMING_BUFSIZE) {
+ log_warning("Recv PDU with "
+ "invalid size %d "
+ "(max: %d)",
+ conn->rwsize,
+ INCOMING_BUFSIZE);
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
if (conn->rwsize) {
- if (!conn->req_buffer)
+ if (!conn->req_buffer) {
conn->req_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->req_buffer) {
+ log_error("Failed to alloc recv buffer");
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
+ }
conn->buffer = conn->req_buffer;
conn->req.ahs = conn->buffer;
conn->req.data = conn->buffer + conn->req.ahssize;
@@ -396,6 +411,7 @@
exit(1);
}
+ conn_close:
if (conn->state == STATE_CLOSE) {
log_debug(0, "connection closed");
conn_free_pdu(conn);
Index: etc/initd/initd.gentoo
===================================================================
--- etc/initd/initd.gentoo (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.gentoo (.../trunk) (revision 147)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
depend()
{
use net
}
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
Index: etc/initd/initd
===================================================================
--- etc/initd/initd (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd (.../trunk) (revision 147)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
}
-
+
stop_server()
{
ietadm --op delete
Index: etc/initd/initd.debian
===================================================================
--- etc/initd/initd.debian (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.debian (.../trunk) (revision 147)
@@ -10,65 +10,29 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# Don't touch this "memsize thingy" unless you are blessed
-# with knowledge about it.
-MEM_SIZE=1048576
-
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
ietd_start()
{
echo -n "Starting iSCSI enterprise target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
start-stop-daemon --start --exec $DAEMON --quiet
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
- fi
+ fi
}
-
+
ietd_stop()
{
echo -n "Removing iSCSI enterprise target devices: "
- # ugly, but ietadm does not allways provides correct exit values
+ # ugly, but ietadm does not always provide correct exit values
RETURN=`ietadm --op delete 2>&1`
RETVAL=$?
- if [ $RETVAL == "0" ] && [[ $RETURN != "something wrong" ]]; then
+ if [ $RETVAL -eq 0 ] && [ x$RETURN != x"something wrong" ]; then
echo "succeeded."
else
echo "failed with reason :$RETURN"
@@ -78,19 +42,19 @@
echo -n "Stopping iSCSI enterprise target service: "
start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
fi
- # ugly, but pid file is not removed ba ietd
+ # ugly, but pid file is not removed by ietd
rm -f $PID_FILE
echo -n "Removing iSCSI enterprise target modules: "
modprobe -r iscsi_trgt
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
@@ -117,18 +81,18 @@
else
echo "no iSCSI enterprise target found!"
exit 1
- fi
+ fi
;;
dump)
DUMP=`tempfile -p ietd`
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Failed to create dump file $DUMP"
exit 1
fi
ietadm --mode dump --all >$DUMP
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Error dumping config from daemon"
rm $DUMP
exit 1
Index: etc/initd/initd.redhat
===================================================================
--- etc/initd/initd.redhat (.../tags/0.4.15) (revision 147)
+++ etc/initd/initd.redhat (.../trunk) (revision 147)
@@ -16,45 +16,12 @@
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
start()
{
echo -n "Starting iSCSI target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
daemon /usr/sbin/ietd
@@ -62,7 +29,7 @@
echo
return $RETVAL
}
-
+
stop()
{
echo -n "Stopping iSCSI target service: "
@@ -71,7 +38,7 @@
modprobe -r iscsi_trgt 2>/dev/null
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
@@ -102,7 +69,7 @@
exit 1
else
echo "ietd (pid $PID) is running..."
- fi
+ fi
}
case "$1" in
Index: Makefile
===================================================================
--- Makefile (.../tags/0.4.15) (revision 147)
+++ Makefile (.../trunk) (revision 147)
@@ -51,6 +51,16 @@
# base first the earlier patch sets will not need to be modified.
#
+# Compatibility patch for kernels >= 2.6.22 and <= 2.6.23
+ifeq ($(call kver_le,2,6,23),1)
+ PATCHES := $(PATCHES) compat-2.6.22-2.6.23.patch
+endif
+
+# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
+ifeq ($(call kver_le,2,6,21),1)
+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
+endif
+
# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
ifeq ($(call kver_le,2,6,18),1)
PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
@@ -140,27 +150,34 @@
rm -f .patched.*; \
fi
-install: install-kernel install-usr install-etc install-doc
+depmod:
+ @echo "Running depmod"
+ @if [ x$(DISTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
+ depmod -aq -b $(DISTDIR)$(INSTALL_MOD_PATH) $(KVER); \
+ else \
+ depmod -aq $(KVER); \
+ fi
+install: install-usr install-etc install-doc install-kernel depmod
+
install-kernel: kernel/iscsi_trgt.ko
@install -vD kernel/iscsi_trgt.ko \
$(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
install-usr: usr/ietd usr/ietadm
@install -vD usr/ietd $(DISTDIR)/usr/sbin/ietd
@install -vD usr/ietadm $(DISTDIR)/usr/sbin/ietadm
install-etc: install-initd
- @if [ ! -e /etc/ietd.conf ]; then \
+ @if [ ! -e $(DISTDIR)/etc/ietd.conf ]; then \
install -vD -m 644 etc/ietd.conf \
$(DISTDIR)/etc/ietd.conf; \
fi
- @if [ ! -e /etc/initiators.allow ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.allow ]; then \
install -vD -m 644 etc/initiators.allow \
$(DISTDIR)/etc/initiators.allow; \
fi
- @if [ ! -e /etc/initiators.deny ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.deny ]; then \
install -vD -m 644 etc/initiators.deny \
$(DISTDIR)/etc/initiators.deny; \
fi
@@ -204,11 +221,10 @@
$(DISTDIR)$(MANDIR)/man$$s/$$f ; \
done
-uninstall: uninstall-kernel uninstall-usr uninstall-etc uninstall-doc
+uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
uninstall-kernel:
rm -f $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
uninstall-usr:
@rm -f $(DISTDIR)/usr/sbin/ietd
iscsitarget-0.4.15-types.h.patch:
--- NEW FILE iscsitarget-0.4.15-types.h.patch ---
diff -up iscsitarget-0.4.15/kernel/block-io.c~ iscsitarget-0.4.15/kernel/block-io.c
--- iscsitarget-0.4.15/kernel/block-io.c~ 2008-09-23 09:20:55.000000000 +0200
+++ iscsitarget-0.4.15/kernel/block-io.c 2008-09-23 09:20:55.000000000 +0200
@@ -9,6 +9,7 @@
* This code is licenced under the GPL.
*/
+#include <linux/types.h>
#include <linux/parser.h>
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
--- NEW FILE iscsitarget-kmod.spec ---
# buildforkernels macro hint: when you build a new version or a new release
# that contains bugfixes or other improvements then you must disable the
# "buildforkernels newest" macro for just that build; immediately after
# queuing that build enable the macro again for subsequent builds; that way
# a new akmod package will only get build when a new one is actually needed
%define buildforkernels newest
# Release code won't build for newer kernels
%define patchlevel svn147
Name: iscsitarget-kmod
Version: 0.4.15
Release: 41.%{patchlevel}%{?dist}.1
Epoch: 1
Summary: iscsitarget kernel modules
Group: System Environment/Kernel
License: GPLv2
URL: http://sourceforge.net/projects/iscsitarget/
Source0: http://dl.sf.net/iscsitarget/iscsitarget-%{version}.tar.gz
# This was created with:
# svn diff http://svn.berlios.de/svnroot/repos/iscsitarget/tags/0.4.15/ \
# http://svn.berlios.de/svnroot/repos/iscsitarget/trunk/@147
Patch0: iscsitarget-0.4.15-%{patchlevel}.patch
Patch1: iscsitarget-0.4.15-types.h.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: i586 i686 x86_64 ppc64
# ppc disabled by knurd on 20081003 as it is known to fail on 2.6.26:
# https://bugzilla.redhat.com/show_bug.cgi?id=464613
# get the needed BuildRequires (in parts depending on what we build for)
BuildRequires: %{_bindir}/kmodtool
%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} }
# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
Kernel module for a kernel-based open source iSCSI target.
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
# go
%setup -q -c -T -a 0
pushd iscsitarget-%{version}
%patch0 -p0
%patch1 -p1
#%patch0 -p0 -b .svn142
# -b creates empty mode 000 file that cannot be copied with cp -a
popd
for kernel_version in %{?kernel_versions}; do
cp -a iscsitarget-%{version} _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions}; do
make -C "_kmod_build_${kernel_version%%___*}" KSRC="${kernel_version##*___}" patch
make -C "${kernel_version##*___}" SUBDIRS="${PWD}/_kmod_build_${kernel_version%%___*}"/kernel modules
done
%install
rm -rf $RPM_BUILD_ROOT
for kernel_version in %{?kernel_versions}; do
install -D -m 755 _kmod_build_${kernel_version%%___*}/kernel/iscsi_trgt.ko \
$RPM_BUILD_ROOT%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/iscsi_trgt.ko
done
%{?akmod_install}
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Oct 03 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-41.svn147.1
- rebuild for rpm fusion
* Wed Oct 01 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-40.svn147
- rebuild for new kernels
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-39.svn147
- temporary disable ppc due to http://bugzilla.kernel.org/show_bug.cgi?id=11143
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-38.svn147
- rebuild for new kernels
- add patch iscsitarget-0.4.15-types.h.patch from hansg
* Sat Aug 16 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-37.svn147
- rebuild for new kernels
* Thu Jul 24 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-36
- rebuild for new Fedora kernels
* Tue Jul 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-35
- rebuild for new Fedora kernels
* Wed Jul 02 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-34
- rebuild for new Fedora kernels
* Fri Jun 13 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-33
- rebuild for new Fedora kernels
* Fri Jun 06 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-32
- rebuild for new Fedora kernels
* Thu May 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-31
- rebuild for new Fedora kernels
* Sun May 04 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-30.svn142
- build for f9
* Sat Feb 16 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-9.svn142
- fix typo
* Thu Feb 14 2008 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-8.svn147
- Fix compilation for 2.6.24
* Sat Jan 26 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-7.svn142
- rebuild for new kmodtools, akmod adjustments
* Mon Jan 21 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-6.svn142
- build akmods package
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-5.svn142
- Correct versioning, bump epoch
- Comment on how the svn142 patch was created
* Wed Dec 05 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-4
- Convert to kmod2
* Sun Nov 11 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-2
- Added make patch before building, to fix builds for 2.6.18 kernels and earlier
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-1
- Initial package
--- NEW FILE iscsitarget-kmod.spec~ ---
# buildforkernels macro hint: when you build a new version or a new release
# that contains bugfixes or other improvements then you must disable the
# "buildforkernels newest" macro for just that build; immediately after
# queuing that build enable the macro again for subsequent builds; that way
# a new akmod package will only get build when a new one is actually needed
%define buildforkernels newest
# Release code won't build for newer kernels
%define patchlevel svn147
Name: iscsitarget-kmod
Version: 0.4.15
Release: 40.%{patchlevel}%{?dist}
Epoch: 1
Summary: iscsitarget kernel modules
Group: System Environment/Kernel
License: GPLv2
URL: http://sourceforge.net/projects/iscsitarget/
Source0: http://dl.sf.net/iscsitarget/iscsitarget-%{version}.tar.gz
# This was created with:
# svn diff http://svn.berlios.de/svnroot/repos/iscsitarget/tags/0.4.15/ \
# http://svn.berlios.de/svnroot/repos/iscsitarget/trunk/@147
Patch0: iscsitarget-0.4.15-%{patchlevel}.patch
Patch1: iscsitarget-0.4.15-types.h.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: i586 i686 x86_64 ppc64
# ppc disabled by knurd on 20081003 as it is known to fail on 2.6.26:
# https://bugzilla.redhat.com/show_bug.cgi?id=464613
# get the needed BuildRequires (in parts depending on what we build for)
BuildRequires: %{_bindir}/kmodtool
%{!?kernels:BuildRequires: buildsys-build-rpmfusion-kerneldevpkgs-%{?buildforkernels:%{buildforkernels}}%{!?buildforkernels:current}-%{_target_cpu} }
# kmodtool does its magic here
%{expand:%(kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null) }
%description
Kernel module for a kernel-based open source iSCSI target.
%prep
# error out if there was something wrong with kmodtool
%{?kmodtool_check}
# print kmodtool output for debugging purposes:
kmodtool --target %{_target_cpu} --repo rpmfusion --kmodname %{name} %{?buildforkernels:--%{buildforkernels}} %{?kernels:--for-kernels "%{?kernels}"} 2>/dev/null
# go
%setup -q -c -T -a 0
pushd iscsitarget-%{version}
%patch0 -p0
%patch1 -p1
#%patch0 -p0 -b .svn142
# -b creates empty mode 000 file that cannot be copied with cp -a
popd
for kernel_version in %{?kernel_versions}; do
cp -a iscsitarget-%{version} _kmod_build_${kernel_version%%___*}
done
%build
for kernel_version in %{?kernel_versions}; do
make -C "_kmod_build_${kernel_version%%___*}" KSRC="${kernel_version##*___}" patch
make -C "${kernel_version##*___}" SUBDIRS="${PWD}/_kmod_build_${kernel_version%%___*}"/kernel modules
done
%install
rm -rf $RPM_BUILD_ROOT
for kernel_version in %{?kernel_versions}; do
install -D -m 755 _kmod_build_${kernel_version%%___*}/kernel/iscsi_trgt.ko \
$RPM_BUILD_ROOT%{kmodinstdir_prefix}/${kernel_version%%___*}/%{kmodinstdir_postfix}/iscsi_trgt.ko
done
%{?akmod_install}
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Wed Oct 01 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-40.svn147
- rebuild for new kernels
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-39.svn147
- temporary disable ppc due to http://bugzilla.kernel.org/show_bug.cgi?id=11143
* Sun Sep 21 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-38.svn147
- rebuild for new kernels
- add patch iscsitarget-0.4.15-types.h.patch from hansg
* Sat Aug 16 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-37.svn147
- rebuild for new kernels
* Thu Jul 24 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-36
- rebuild for new Fedora kernels
* Tue Jul 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-35
- rebuild for new Fedora kernels
* Wed Jul 02 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-34
- rebuild for new Fedora kernels
* Fri Jun 13 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-33
- rebuild for new Fedora kernels
* Fri Jun 06 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-32
- rebuild for new Fedora kernels
* Thu May 15 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 0.4.15-31
- rebuild for new Fedora kernels
* Sun May 04 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-30.svn142
- build for f9
* Sat Feb 16 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-9.svn142
- fix typo
* Thu Feb 14 2008 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-8.svn147
- Fix compilation for 2.6.24
* Sat Jan 26 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-7.svn142
- rebuild for new kmodtools, akmod adjustments
* Mon Jan 21 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1:0.4.15-6.svn142
- build akmods package
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-5.svn142
- Correct versioning, bump epoch
- Comment on how the svn142 patch was created
* Wed Dec 05 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-4
- Convert to kmod2
* Sun Nov 11 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-2
- Added make patch before building, to fix builds for 2.6.18 kernels and earlier
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-1
- Initial package
16 years, 1 month
rpms/kdemultimedia-extras-freeworld/F-8 kdemultimedia-extras-freeworld.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
by Rex Dieter
Author: rdieter
Update of /cvs/free/rpms/kdemultimedia-extras-freeworld/F-8
In directory se02.es.rpmfusion.net:/tmp/cvs-serv1638
Modified Files:
.cvsignore sources
Added Files:
kdemultimedia-extras-freeworld.spec
Log Message:
* Fri Oct 03 2008 Rex Dieter <rdieter(a)fedoraproject.org> - 6:3.5.10-1
- kde-3.5.10
- for rpmfusion
--- NEW FILE kdemultimedia-extras-freeworld.spec ---
# For the files list and SELinux scriptlets.
%define libmpeg %{_libdir}/libmpeg-0.3.0.so
Epoch: 6
Version: 3.5.10
Release: 1%{?dist}
License: GPLv2+
Name: kdemultimedia-extras-freeworld
Summary: Freeworld extras for KDE multimedia applications
Group: Applications/Multimedia
Url: http://www.kde.org/
Source0: ftp://ftp.kde.org/pub/kde/stable/%{version}/src/kdemultimedia-%{version}....
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot-%(%{__id_u} -n)
%if 0%{?fedora} > 6
Requires: kdemultimedia3 >= %{version}
BuildRequires: kdelibs3-devel >= %{version}
%else
Requires: kdemultimedia-extras >= 6:%{version}
BuildRequires: kdelibs-devel >= 6:%{version}
%endif
Requires: akode-extras
Requires(hint): xine-lib-extras-freeworld
Obsoletes: kdemultimedia-extras < 6:3.5.0-0.lvn.2
Provides: kdemultimedia-mp3 = %{epoch}:%{version}-%{release}
# upgrade livna -> rpmfusion
Obsoletes: kdemultimedia-extras-nonfree < 6:3.5.9-2
Provides: kdemultimedia-extras-nonfree = %{epoch}:%{version}-%{release}
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%if 0%{?fedora} > 4 || 0%{?rhel} > 4
BuildRequires: libXxf86dga-devel libXxf86vm-devel
%endif
BuildRequires: akode-devel akode-extras
BuildRequires: taglib-devel libmad-devel lame-devel
%description
This package includes additional files which extend kdemultimedia
, e.g. with mp3/MPEG playback, including:
* akode_artsplugin (akode-extras)
* krec mp3 export (lame)
* mpeglib_artsplugin
* xine_artsplugin (xine-lib-extras-freeworld)
%prep
%setup -q -n kdemultimedia-%{version}
%build
unset QTDIR || : ; . /etc/profile.d/qt.sh
%configure \
--disable-debug --disable-warnings \
--disable-rpath \
--includedir=%{_includedir}/kde \
--enable-final \
--disable-cdparanoia \
--with-lame
for dir in \
arts krec krec/mp3_export \
akode_artsplugin \
mpeglib \
mpeglib_artsplug \
; do
make %{?_smp_mflags} -C $dir
done
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
%define mytmp1 __buildroot_ls-lR
for dir in \
krec/mp3_export \
akode_artsplugin \
mpeglib \
mpeglib_artsplug \
; do
find $RPM_BUILD_ROOT | sed -e "s!$RPM_BUILD_ROOT!!" > $(pwd)/%{mytmp1}.1
make -C $dir DESTDIR=$RPM_BUILD_ROOT install
find $RPM_BUILD_ROOT | sed -e "s!$RPM_BUILD_ROOT!!" > $(pwd)/%{mytmp1}.2
diff -Nu $(pwd)/%{mytmp1}.1 $(pwd)/%{mytmp1}.2 || :
done
## omit (conflicting) bits we don't want
# -devel(type) bits
rm -rf $RPM_BUILD_ROOT%{_includedir}/kde/{mpeglib,mpeglib_artsplug}
# -extras bits
rm -f $RPM_BUILD_ROOT%{_libdir}/mcop/akodearts.mcop{class,type}
rm -f $RPM_BUILD_ROOT%{_libdir}/mcop/akode{,MPC,SpeexStream,VorbisStream,Xiph}PlayObject.mcopclass
rm -f $RPM_BUILD_ROOT%{_libdir}/libarts_akode.*
%post
/sbin/ldconfig
/usr/sbin/semanage fcontext -f -- -a -t textrel_shlib_t '%{libmpeg}' 2>/dev/null || :
/usr/bin/chcon -t textrel_shlib_t %{libmpeg} 2>/dev/null || :
%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then # erase?
/usr/sbin/semanage fcontext -f -- -d -t textrel_shlib_t '%{libmpeg}' 2>/dev/null || :
fi
%check
# If this fails, the library name has changed, and the SELinux scripts
# need an update as we don't want to set the security context for files
# we don't own.
[ -f ${RPM_BUILD_ROOT}%{libmpeg} ]
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
%{_bindir}/yaf-cdda
%{_bindir}/yaf-mpgplay
%{_bindir}/yaf-splay
%{_bindir}/yaf-tplay
%{_bindir}/yaf-vorbis
%{_bindir}/yaf-yuv
%{_libdir}/libyafcore.[ls][ao]
%{_libdir}/libyafxplayer.[ls][ao]
%{_libdir}/kde3/libkrecexport_mp3.[ls][ao]
%{_datadir}/services/krec_exportmp3.desktop
## (akode|mpeglib|xine)_artsplugin (nonfree bits)
#files artsplugin
#defattr(-,root,root,-)
%{_bindir}/mpeglibartsplay
%{_libdir}/libarts_mpeglib-0.3.0.so.*
%{_libdir}/libarts_splay.so.*
%{libmpeg}
%{_libdir}/mcop/CDDAPlayObject.mcopclass
%{_libdir}/mcop/MP3PlayObject.mcopclass
%{_libdir}/mcop/NULLPlayObject.mcopclass
%{_libdir}/mcop/OGGPlayObject.mcopclass
%{_libdir}/mcop/SplayPlayObject.mcopclass
%{_libdir}/mcop/WAVPlayObject.mcopclass
%{_libdir}/mcop/akodeMPEGPlayObject.mcopclass
%if 0%{?fedora} > 4
%{_libdir}/mcop/akodeFFMPEGPlayObject.mcopclass
%endif
## FIXME: devel-type stuff?, omit from packaging? -- Rex
%{_libdir}/libarts_mpeglib.[ls][ao]
%{_libdir}/libarts_splay.[ls][ao]
%{_libdir}/libmpeg.[ls][ao]
%changelog
* Fri Oct 03 2008 Rex Dieter <rdieter(a)fedoraproject.org> - 6:3.5.10-1
- kde-3.5.10
- for rpmfusion
* Sat Feb 16 2008 Rex Dieter <rdieter(a)fedoraproject.org> - 6:3.5.9-1
- kde-3.5.9
* Wed Oct 31 2007 Rex Dieter <rdieter[AT]fedoraproject.org> - 6:3.5.8-1
- kde-3.5.8
* Mon Aug 13 2007 Rex Dieter <rdieter[AT]users.sf.net> - 6:3.5.7-3
- Requires: kdemultimedia3 (f7+)
- Requires(hint): xine-lib-extras-nonfree
* Mon Aug 13 2007 Rex Dieter <rdieter[AT]users.sf.net> - 6:3.5.7-2
- omit kfile_mpeg (moving to kdemultimedia/kdemultimedia-extras)
- License: GPLv2+
* Tue Jun 12 2007 Rex Dieter <rdieter[AT]users.sf.net> - 6:3.5.7-1
- kde-3.5.7
* Wed May 09 2007 Rex Dieter <rdieter[AT]users.sf.net> - 6:3.5.6-6
- fc7+: no longer Requires: kdemm-extras
* Fri Mar 9 2007 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.5.6-5
- Change security context of libmpeg-0.3.0* to textrel_shlib_t
as it contains lots of hand-written assembler code (#1435)
without relative addressing.
- Require the minimum version of kdemultimedia-extras which contains
files previously included in this package.
* Thu Mar 08 2007 Rex Dieter <rexdieter[AT]users.sf.net> - 6:3.5.6-4
- +Epoch:6, there's pkgs in the wild already *with* Epoch. Yes, Epoch's
suck, my bad, but at least no kittens were harmed.
- update %%description
* Mon Feb 12 2007 Rex Dieter <rexdieter[AT]users.sf.net> - 3.5.6-3
- 3.5.6
- drop xine_artsplugin, kfile_mp3 (moved to -extras pkg)
- omit juk bits
* Wed Jan 10 2007 Michael Schwendt <mschwendt[AT]users.sf.net> - 3.5.5-2
- Rebuild with %%make_cvs 0, else requires automake 1.6.1 or newer.
* Wed Nov 1 2006 Michael Schwendt <mschwendt[AT]users.sf.net> - 3.5.5-1
- Update to 3.5.5 (kfile_mpeg affected e.g.).
* Sun Oct 8 2006 Michael Schwendt <mschwendt[AT]users.sf.net> - 3.5.4-1
- Update to 3.5.4.
* Sun Apr 2 2006 Michael Schwendt <mschwendt[AT]users.sf.net> - 3.5.1-2
- Rebuild with updated akode-extras and R akode-extras kdemultimedia-extras
* Thu Mar 16 2006 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.5.1-1
- Update to 3.5.1.
- Rename package to kdemultimedia-extras-nonfree.
- Drop Epoch 6 and treat this as a completely new package.
- Define QTLIB/QTINC to be safe in multilib environments.
- BR lame-devel to please the configure check and for krec/mp3_export.
- BR akode-devel akode-extras to please the akode checks and
installation of extra files.
* Thu Mar 09 2006 Andreas Bierfert <andreas.bierfert[AT]lowlatency.de>
- switch to new release field
* Tue Feb 28 2006 Andreas Bierfert <andreas.bierfert[AT]lowlatency.de>
- add dist
* Sun Dec 18 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.5.0-0.lvn.1
- Update to 3.5.0.
* Mon Aug 1 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.4.2-0.lvn.1
- Update to 3.4.2.
- Add switch for building/including Juk.
* Thu Jul 14 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.4.1-0.lvn.1
- Update to 3.4.1.
- Copy admin.visibility (+ no gcc4 blacklisting) patch from FC4 update.
- BR xine-lib-devel and build/include more video stuff.
* Wed May 11 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.4.0-0.lvn.3
- Really drop obsolete -vorbis patch.
* Mon Apr 25 2005 Dams <anvil[AT]livna.org> - 6:3.4.0-0.lvn.2
- Fix url in Source tag
* Thu Mar 24 2005 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.4.0-0.lvn.1
- Update to 3.4.0 (stay in sync with Fedora Core development).
* Tue Dec 7 2004 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.3.1-0.lvn.3
- Don't build mpg123 plugin.
* Sun Dec 5 2004 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.3.1-0.lvn.2
- Include a few more files.
* Sat Dec 4 2004 Michael Schwendt <mschwendt[AT]users.sf.net> - 6:3.3.1-0.lvn.1
- Create initial version based on a heavily stripped and modified
kdemultimedia package from Fedora Core 3 (the previous changelog
entry just for reference).
* Wed Oct 13 2004 Than Ngo <than(a)redhat.com> 6:3.3.1-1
- update to 3.3.1
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/kdemultimedia-extras-freeworld/F-8/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 29 Jul 2008 18:13:51 -0000 1.1
+++ .cvsignore 3 Oct 2008 13:59:18 -0000 1.2
@@ -0,0 +1 @@
+kdemultimedia-3.5.10.tar.bz2
Index: sources
===================================================================
RCS file: /cvs/free/rpms/kdemultimedia-extras-freeworld/F-8/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 29 Jul 2008 18:13:51 -0000 1.1
+++ sources 3 Oct 2008 13:59:18 -0000 1.2
@@ -0,0 +1 @@
+8e8cd7f41d37f7da8bd239048abf3516 kdemultimedia-3.5.10.tar.bz2
16 years, 1 month
rpms/iscsitarget/F-8 iscsitarget-0.4.15-initscript.patch, NONE, 1.1 iscsitarget-0.4.15-svn142.patch, NONE, 1.1 iscsitarget.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget/F-8
In directory se02.es.rpmfusion.net:/tmp/cvs-serv1499
Modified Files:
.cvsignore sources
Added Files:
iscsitarget-0.4.15-initscript.patch
iscsitarget-0.4.15-svn142.patch iscsitarget.spec
Log Message:
import from livna
iscsitarget-0.4.15-initscript.patch:
--- NEW FILE iscsitarget-0.4.15-initscript.patch ---
diff -ur iscsitarget-0.4.15.orig/etc/initd/initd.redhat iscsitarget-0.4.15/etc/initd/initd.redhat
--- iscsitarget-0.4.15.orig/etc/initd/initd.redhat 2008-01-25 19:54:08.000000000 +0100
+++ iscsitarget-0.4.15/etc/initd/initd.redhat 2008-01-25 19:54:29.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# chkconfig: - 39 35
# description: Starts and stops the iSCSI target
@@ -6,6 +6,14 @@
# pidfile: /var/run/ietd.pid
# config: /etc/ietd.conf
+### BEGIN INIT INFO
+# Provides: iscsi-target
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Short-Description: start and stop ietd
+# Description: Starts and stops the iSCSI target
+### END INIT INFO
+
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
@@ -26,6 +34,7 @@
modprobe iscsi_trgt
daemon /usr/sbin/ietd
RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/iscsi-target
echo
return $RETVAL
}
@@ -40,6 +49,7 @@
modprobe -r crc32c 2>/dev/null
if [ $RETVAL -eq 0 ]; then
echo_success
+ rm -f /var/lock/subsys/iscsi-target
else
echo_failure
fi
@@ -61,6 +71,16 @@
fi
}
+try-restart()
+{
+ condrestart
+}
+
+force-reload()
+{
+ try-restart
+}
+
status()
{
PID=`pidofproc ietd`
@@ -89,7 +109,7 @@
status
;;
*)
- echo $"Usage: $0 {start|stop|restart|status}"
+ echo $"Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 1
esac
iscsitarget-0.4.15-svn142.patch:
--- NEW FILE iscsitarget-0.4.15-svn142.patch ---
Index: kernel/block-io.c
===================================================================
--- kernel/block-io.c (.../tags/0.4.15) (revision 145)
+++ kernel/block-io.c (.../trunk) (revision 142)
@@ -169,8 +169,8 @@
bdev = open_bdev_excl(path, flags, THIS_MODULE);
if (IS_ERR(bdev)) {
- err = PTR_ERR (bdev);
- eprintk("Can't open device %s \n", path);
+ err = PTR_ERR(bdev);
+ eprintk("Can't open device %s, error %d\n", path, err);
bio_data->bdev = NULL;
} else {
bio_data->bdev = bdev;
@@ -217,7 +217,7 @@
p = (u32 *) (volume->scsi_id + VENDOR_ID_LEN);
*(p + 0) = volume->target->trgt_param.target_type;
*(p + 1) = volume->target->tid;
- *(p + 2) = (unsigned int) inode->i_ino;
+ *(p + 2) = volume->lun;
*(p + 3) = (unsigned int) inode->i_sb->s_dev;
}
Index: kernel/target_disk.c
===================================================================
--- kernel/target_disk.c (.../tags/0.4.15) (revision 145)
+++ kernel/target_disk.c (.../trunk) (revision 142)
@@ -66,13 +66,15 @@
unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00};
- u32 ncyl, *p;
+ u32 ncyl;
+ u32 n;
/* assume 0xff heads, 15krpm. */
memcpy(ptr, geo_m_pg, sizeof(geo_m_pg));
ncyl = sec >> 14; /* 256 * 64 */
- p = (u32 *)(ptr + 1);
- *p = *p | cpu_to_be32(ncyl);
+ memcpy(&n, ptr+1, sizeof(u32));
+ n = n | cpu_to_be32(ncyl);
+ memcpy(ptr+1, &n, sizeof(u32));
return sizeof(geo_m_pg);
}
@@ -249,7 +251,8 @@
struct iet_volume *lun;
int rest, idx = 0;
- size = be32_to_cpu(*(u32 *)&req->scb[6]);
+ size = (u32)req->scb[6] << 24 | (u32)req->scb[7] << 16 |
+ (u32)req->scb[8] << 8 | (u32)req->scb[9];
if (size < 16)
return -1;
Index: kernel/iotype.c
===================================================================
--- kernel/iotype.c (.../tags/0.4.15) (revision 145)
+++ kernel/iotype.c (.../trunk) (revision 142)
@@ -89,9 +89,11 @@
for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
if (!(err = register_iotype(iotype_array[i])))
- eprintk("register %s\n", iotype_array[i]->name);
+ iprintk("Registered io type %s\n",
+ iotype_array[i]->name);
else {
- eprintk("failed to register %s\n", iotype_array[i]->name);
+ eprintk("Failed to register io type %s\n",
+ iotype_array[i]->name);
break;
}
}
Index: kernel/iscsi.c
===================================================================
--- kernel/iscsi.c (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi.c (.../trunk) (revision 142)
@@ -726,13 +726,18 @@
case READ_10:
case WRITE_10:
case WRITE_VERIFY:
- *off = be32_to_cpu(*(u32 *)&cmd[2]);
+ *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
+ (u32)cmd[4] << 8 | (u32)cmd[5];
*len = (cmd[7] << 8) + cmd[8];
break;
case READ_16:
case WRITE_16:
- *off = be64_to_cpu(*(u64 *)&cmd[2]);
- *len = be32_to_cpu(*(u32 *)&cmd[10]);
+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
+ (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
+ (u64)cmd[8] << 8 | (u64)cmd[9];
+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
+ (u32)cmd[12] << 8 | (u32)cmd[13];
break;
default:
BUG();
@@ -1191,10 +1196,56 @@
}
}
+static inline char *tmf_desc(int fun)
+{
+ static char *tmf_desc[] = {
+ "Unknown Function",
+ "Abort Task",
+ "Abort Task Set",
+ "Clear ACA",
+ "Clear Task Set",
+ "Logical Unit Reset",
+ "Target Warm Reset",
+ "Target Cold Reset",
+ "Task Reassign",
+ };
+
+ if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
+ (fun > ISCSI_FUNCTION_TASK_REASSIGN))
+ fun = 0;
+
+ return tmf_desc[fun];
+}
+
+static inline char *rsp_desc(int rsp)
+{
+ static char *rsp_desc[] = {
+ "Function Complete",
+ "Unknown Task",
+ "Unknown LUN",
+ "Task Allegiant",
+ "Failover Unsupported",
+ "Function Unsupported",
+ "No Authorization",
+ "Function Rejected",
+ "Unknown Response",
+ };
+
+ if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
+ (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
+ (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
+ rsp = 8;
+ else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
+ rsp = 7;
+
+ return rsp_desc[rsp];
+}
+
static void execute_task_management(struct iscsi_cmnd *req)
{
struct iscsi_conn *conn = req->conn;
- struct iscsi_target *target = conn->session->target;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_target *target = session->target;
struct iscsi_cmnd *rsp;
struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
struct iscsi_task_rsp_hdr *rsp_hdr;
@@ -1209,8 +1260,6 @@
rsp_hdr->itt = req_hdr->itt;
rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
- eprintk("%x %d %x\n", cmnd_itt(req), function, req_hdr->rtt);
-
switch (function) {
case ISCSI_FUNCTION_ABORT_TASK:
case ISCSI_FUNCTION_ABORT_TASK_SET:
@@ -1255,6 +1304,11 @@
break;
}
out:
+ iprintk("%s (%02x) issued on tid:%d lun:%d by sid:%llu (%s)\n",
+ tmf_desc(function), function, target->tid,
+ translate_lun(req_hdr->lun), session->sid,
+ rsp_desc(rsp_hdr->response));
+
iscsi_cmnd_init_write(rsp);
}
@@ -1708,8 +1762,7 @@
if ((err = event_init()) < 0)
goto err;
- iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
- 0, 0, NULL, NULL);
+ iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
if (!iscsi_cmnd_cache)
goto err;
Index: kernel/null-io.c
===================================================================
--- kernel/null-io.c (.../tags/0.4.15) (revision 145)
+++ kernel/null-io.c (.../trunk) (revision 142)
@@ -16,7 +16,7 @@
#include "iotype.h"
struct nullio_data {
- u32 sectors;
+ u64 sectors;
};
enum {
@@ -32,7 +32,7 @@
static int parse_nullio_params(struct iet_volume *volume, char *params)
{
int err = 0;
- char *p;
+ char *p, *q;
struct nullio_data *data = volume->private;
while ((p = strsep(¶ms, ",")) != NULL) {
@@ -43,7 +43,11 @@
token = match_token(p, tokens, args);
switch (token) {
case Opt_sectors:
- match_int(&args[0], &data->sectors);
+ q = match_strdup(&args[0]);
+ if (!q)
+ return -ENOMEM;
+ data->sectors = simple_strtoull(q, NULL, 10);
+ kfree(q);
break;
case Opt_ignore:
break;
@@ -97,7 +101,7 @@
void nullio_show(struct iet_volume *lu, struct seq_file *seq)
{
struct nullio_data *p = lu->private;
- seq_printf(seq, " sectors:%u\n", p->sectors);
+ seq_printf(seq, " sectors:%llu\n", p->sectors);
}
struct iotype nullio =
Index: kernel/iscsi.h
===================================================================
--- kernel/iscsi.h (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi.h (.../trunk) (revision 142)
@@ -116,9 +116,6 @@
struct worker_thread_info wthread_info;
struct semaphore target_sem;
-
- struct list_head initiator_list;
- u32 initiator_iid_count;
};
struct iscsi_queue {
@@ -189,8 +186,6 @@
struct list_head cmnd_hash[1 << IET_HASH_ORDER];
u32 next_ttt;
-
- struct iscsi_initiator *rinitiator;
};
enum connection_state_bit {
Index: kernel/digest.c
===================================================================
--- kernel/digest.c (.../tags/0.4.15) (revision 145)
+++ kernel/digest.c (.../trunk) (revision 142)
@@ -218,7 +218,7 @@
count = get_pgcnt(size, offset);
assert(idx + count <= tio->pg_cnt);
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
crypto_hash_init(hash);
Index: kernel/event.c
===================================================================
--- kernel/event.c (.../tags/0.4.15) (revision 145)
+++ kernel/event.c (.../trunk) (revision 142)
@@ -95,7 +95,8 @@
int event_init(void)
{
- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+ THIS_MODULE);
if (!nl)
return -ENOMEM;
else
Index: kernel/nthread.c
===================================================================
--- kernel/nthread.c (.../tags/0.4.15) (revision 145)
+++ kernel/nthread.c (.../trunk) (revision 142)
@@ -13,8 +13,6 @@
#include "iscsi_dbg.h"
#include "digest.h"
-DECLARE_WAIT_QUEUE_HEAD(iscsi_ctl_wait);
-
enum daemon_state_bit {
D_ACTIVE,
D_DATA_READY,
Index: kernel/target.c
===================================================================
--- kernel/target.c (.../tags/0.4.15) (revision 145)
+++ kernel/target.c (.../trunk) (revision 142)
@@ -148,7 +148,6 @@
INIT_LIST_HEAD(&target->session_list);
INIT_LIST_HEAD(&target->volumes);
- INIT_LIST_HEAD(&target->initiator_list);
atomic_set(&target->nr_volumes, 0);
Index: kernel/iscsi_dbg.h
===================================================================
--- kernel/iscsi_dbg.h (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi_dbg.h (.../trunk) (revision 142)
@@ -15,21 +15,25 @@
extern unsigned long debug_enable_flags;
-#define dprintk(debug, fmt, args...) \
-do { \
- if ((debug) & debug_enable_flags) { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
- } \
+#define PFX "iscsi_trgt: "
+
+#define dprintk(debug, fmt, args...) do { \
+ if ((debug) & debug_enable_flags) { \
+ printk(KERN_DEBUG PFX "%s(%d) " fmt, __FUNCTION__,\
+ __LINE__, args);\
+ } \
} while (0)
-#define eprintk(fmt, args...) \
-do { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
+#define eprintk(fmt, args...) do { \
+ printk(KERN_ERR PFX "%s(%d) " fmt, __FUNCTION__, \
+ __LINE__, args);\
} while (0)
+#define iprintk(X...) printk(KERN_INFO PFX X)
+
#define assert(p) do { \
if (!(p)) { \
- printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
+ printk(KERN_CRIT PFX "BUG at %s:%d assert(%s)\n",\
__FILE__, __LINE__, #p); \
dump_stack(); \
BUG(); \
@@ -40,9 +44,10 @@
static inline void iscsi_dump_iov(struct msghdr *msg)
{
int i;
- printk("%p, %d\n", msg->msg_iov, msg->msg_iovlen);
+ printk(PFX "%p, %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0; i < min_t(size_t, msg->msg_iovlen, ISCSI_CONN_IOV_MAX); i++)
- printk("%d: %p,%d\n", i, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
+ printk(PFX "%d: %p,%d\n", i, msg->msg_iov[i].iov_base,
+ msg->msg_iov[i].iov_len);
}
#else
#define iscsi_dump_iov(x) do {} while (0)
@@ -84,18 +89,18 @@
int i;
buf = (void *)&pdu->bhs;
- printk("BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
+ printk(PFX "BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
for (i = 0; i < sizeof(pdu->bhs); i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
buf = (void *)pdu->ahs;
- printk("AHS: (%p,%d)\n", buf, pdu->ahssize);
+ printk(PFX "AHS: (%p,%d)\n", buf, pdu->ahssize);
for (i = 0; i < pdu->ahssize; i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
- printk("Data: (%d)\n", pdu->datasize);
+ printk(PFX "Data: (%d)\n", pdu->datasize);
}
#else
Index: kernel/tio.c
===================================================================
--- kernel/tio.c (.../tags/0.4.15) (revision 145)
+++ kernel/tio.c (.../trunk) (revision 142)
@@ -110,8 +110,7 @@
int tio_init(void)
{
- tio_cache = kmem_cache_create("tio", sizeof(struct tio),
- 0, 0, NULL, NULL);
+ tio_cache = KMEM_CACHE(tio, 0);
return tio_cache ? 0 : -ENOMEM;
}
Index: patches/compat-2.6.19-2.6.21.patch
===================================================================
--- patches/compat-2.6.19-2.6.21.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.19-2.6.21.patch (.../trunk) (revision 142)
@@ -0,0 +1,41 @@
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 122)
+@@ -95,8 +95,7 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+- THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/iscsi.c
+===================================================================
+--- kernel/iscsi.c (working copy)
++++ kernel/iscsi.c (revision 137)
+@@ -1757,7 +1757,8 @@ static int iscsi_init(void)
+ if ((err = event_init()) < 0)
+ goto err;
+
+- iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
++ iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
++ 0, 0, NULL, NULL);
+ if (!iscsi_cmnd_cache)
+ goto err;
+
+Index: kernel/tio.c
+===================================================================
+--- kernel/tio.c (working copy)
++++ kernel/tio.c (revision 137)
+@@ -110,7 +110,8 @@ int tio_sync(struct iet_volume *lu, stru
+
+ int tio_init(void)
+ {
+- tio_cache = KMEM_CACHE(tio, 0);
++ tio_cache = kmem_cache_create("tio", sizeof(struct tio),
++ 0, 0, NULL, NULL);
+ return tio_cache ? 0 : -ENOMEM;
+ }
Index: patches/compat-2.6.14-2.6.18.patch
===================================================================
--- patches/compat-2.6.14-2.6.18.patch (.../tags/0.4.15) (revision 145)
+++ patches/compat-2.6.14-2.6.18.patch (.../trunk) (revision 142)
@@ -2,7 +2,7 @@
===================================================================
--- kernel/iscsi.h (revision 105)
+++ kernel/iscsi.h (working copy)
-@@ -238,8 +238,8 @@ struct iscsi_conn {
+@@ -233,8 +233,8 @@ struct iscsi_conn {
u32 write_offset;
int write_state;
@@ -134,7 +134,7 @@
idx = offset >> PAGE_CACHE_SHIFT;
@@ -220,7 +211,7 @@ static void digest_data(struct hash_desc
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
- crypto_hash_init(hash);
+ crypto_digest_init(tfm);
Index: usr/isns.c
===================================================================
--- usr/isns.c (.../tags/0.4.15) (revision 145)
+++ usr/isns.c (.../trunk) (revision 142)
@@ -256,7 +256,8 @@
scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE |
ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED;
- scn_flags = htonl(set_scn_flag(scn_flags));
+ set_scn_flag(scn_flags);
+ scn_flags = htonl(scn_flags);
length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_SCN_BITMAP,
sizeof(scn_flags), &scn_flags);
Index: usr/iscsid.c
===================================================================
--- usr/iscsid.c (.../tags/0.4.15) (revision 145)
+++ usr/iscsid.c (.../trunk) (revision 142)
@@ -89,8 +89,13 @@
char *buffer;
if (!conn->rsp.datasize) {
- if (!conn->rsp_buffer)
+ if (!conn->rsp_buffer) {
conn->rsp_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->rsp_buffer) {
+ log_error("Failed to alloc send buffer");
+ return;
+ }
+ }
conn->rsp.data = conn->rsp_buffer;
}
if (conn->rwsize + len > INCOMING_BUFSIZE) {
@@ -385,7 +390,12 @@
/* return; */
/* } */
- ki->param_get(conn->tid, 0, key_session, conn->session_param);
+ if (ki->param_get(conn->tid, 0, key_session,
+ conn->session_param)) {
+ rsp->status_class = ISCSI_STATUS_TARGET_ERROR;
+ rsp->status_detail = ISCSI_STATUS_SVC_UNAVAILABLE;
+ conn->state = STATE_EXIT;
+ }
}
conn->exp_cmd_sn = be32_to_cpu(req->cmd_sn);
log_debug(1, "exp_cmd_sn: %d,%d", conn->exp_cmd_sn, req->cmd_sn);
Index: usr/ietd.c
===================================================================
--- usr/ietd.c (.../tags/0.4.15) (revision 145)
+++ usr/ietd.c (.../trunk) (revision 142)
@@ -307,9 +307,24 @@
(conn->req.bhs.datalength[1] << 8) +
conn->req.bhs.datalength[2]);
conn->rwsize = (conn->req.ahssize + conn->req.datasize + 3) & -4;
+ if (conn->rwsize > INCOMING_BUFSIZE) {
+ log_warning("Recv PDU with "
+ "invalid size %d "
+ "(max: %d)",
+ conn->rwsize,
+ INCOMING_BUFSIZE);
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
if (conn->rwsize) {
- if (!conn->req_buffer)
+ if (!conn->req_buffer) {
conn->req_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->req_buffer) {
+ log_error("Failed to alloc recv buffer");
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
+ }
conn->buffer = conn->req_buffer;
conn->req.ahs = conn->buffer;
conn->req.data = conn->buffer + conn->req.ahssize;
@@ -396,6 +411,7 @@
exit(1);
}
+ conn_close:
if (conn->state == STATE_CLOSE) {
log_debug(0, "connection closed");
conn_free_pdu(conn);
Index: etc/initd/initd.gentoo
===================================================================
--- etc/initd/initd.gentoo (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.gentoo (.../trunk) (revision 142)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
depend()
{
use net
}
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
Index: etc/initd/initd
===================================================================
--- etc/initd/initd (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd (.../trunk) (revision 142)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
}
-
+
stop_server()
{
ietadm --op delete
Index: etc/initd/initd.debian
===================================================================
--- etc/initd/initd.debian (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.debian (.../trunk) (revision 142)
@@ -10,65 +10,29 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# Don't touch this "memsize thingy" unless you are blessed
-# with knowledge about it.
-MEM_SIZE=1048576
-
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
ietd_start()
{
echo -n "Starting iSCSI enterprise target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
start-stop-daemon --start --exec $DAEMON --quiet
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
- fi
+ fi
}
-
+
ietd_stop()
{
echo -n "Removing iSCSI enterprise target devices: "
- # ugly, but ietadm does not allways provides correct exit values
+ # ugly, but ietadm does not always provide correct exit values
RETURN=`ietadm --op delete 2>&1`
RETVAL=$?
- if [ $RETVAL == "0" ] && [[ $RETURN != "something wrong" ]]; then
+ if [ $RETVAL -eq 0 ] && [ x$RETURN != x"something wrong" ]; then
echo "succeeded."
else
echo "failed with reason :$RETURN"
@@ -78,19 +42,19 @@
echo -n "Stopping iSCSI enterprise target service: "
start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
fi
- # ugly, but pid file is not removed ba ietd
+ # ugly, but pid file is not removed by ietd
rm -f $PID_FILE
echo -n "Removing iSCSI enterprise target modules: "
modprobe -r iscsi_trgt
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
@@ -117,18 +81,18 @@
else
echo "no iSCSI enterprise target found!"
exit 1
- fi
+ fi
;;
dump)
DUMP=`tempfile -p ietd`
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Failed to create dump file $DUMP"
exit 1
fi
ietadm --mode dump --all >$DUMP
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Error dumping config from daemon"
rm $DUMP
exit 1
Index: etc/initd/initd.redhat
===================================================================
--- etc/initd/initd.redhat (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.redhat (.../trunk) (revision 142)
@@ -16,45 +16,12 @@
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
start()
{
echo -n "Starting iSCSI target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
daemon /usr/sbin/ietd
@@ -62,7 +29,7 @@
echo
return $RETVAL
}
-
+
stop()
{
echo -n "Stopping iSCSI target service: "
@@ -71,7 +38,7 @@
modprobe -r iscsi_trgt 2>/dev/null
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
@@ -102,7 +69,7 @@
exit 1
else
echo "ietd (pid $PID) is running..."
- fi
+ fi
}
case "$1" in
Index: Makefile
===================================================================
--- Makefile (.../tags/0.4.15) (revision 145)
+++ Makefile (.../trunk) (revision 142)
@@ -51,6 +51,11 @@
# base first the earlier patch sets will not need to be modified.
#
+# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
+ifeq ($(call kver_le,2,6,21),1)
+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
+endif
+
# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
ifeq ($(call kver_le,2,6,18),1)
PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
@@ -140,27 +145,34 @@
rm -f .patched.*; \
fi
-install: install-kernel install-usr install-etc install-doc
+depmod:
+ @echo "Running depmod"
+ @if [ x$(DISTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
+ depmod -aq -b $(DISTDIR)$(INSTALL_MOD_PATH) $(KVER); \
+ else \
+ depmod -aq $(KVER); \
+ fi
+install: install-usr install-etc install-doc install-kernel depmod
+
install-kernel: kernel/iscsi_trgt.ko
@install -vD kernel/iscsi_trgt.ko \
$(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
install-usr: usr/ietd usr/ietadm
@install -vD usr/ietd $(DISTDIR)/usr/sbin/ietd
@install -vD usr/ietadm $(DISTDIR)/usr/sbin/ietadm
install-etc: install-initd
- @if [ ! -e /etc/ietd.conf ]; then \
+ @if [ ! -e $(DISTDIR)/etc/ietd.conf ]; then \
install -vD -m 644 etc/ietd.conf \
$(DISTDIR)/etc/ietd.conf; \
fi
- @if [ ! -e /etc/initiators.allow ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.allow ]; then \
install -vD -m 644 etc/initiators.allow \
$(DISTDIR)/etc/initiators.allow; \
fi
- @if [ ! -e /etc/initiators.deny ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.deny ]; then \
install -vD -m 644 etc/initiators.deny \
$(DISTDIR)/etc/initiators.deny; \
fi
@@ -204,11 +216,10 @@
$(DISTDIR)$(MANDIR)/man$$s/$$f ; \
done
-uninstall: uninstall-kernel uninstall-usr uninstall-etc uninstall-doc
+uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
uninstall-kernel:
rm -f $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
uninstall-usr:
@rm -f $(DISTDIR)/usr/sbin/ietd
--- NEW FILE iscsitarget.spec ---
%define patchlevel svn142
Name: iscsitarget
Version: 0.4.15
Release: 10.%{patchlevel}%{?dist}
Epoch: 1
Summary: Utilities for iSCSI Enterprise Target
Group: System Environment/Daemons
License: GPLv2
URL: http://sourceforge.net/projects/iscsitarget/
Source0: http://dl.sf.net/iscsitarget/%{name}-%{version}.tar.gz
# This was created with:
# svn diff http://svn.berlios.de/svnroot/repos/iscsitarget/tags/0.4.15/ \
# http://svn.berlios.de/svnroot/repos/iscsitarget/trunk/@142
Patch0: iscsitarget-0.4.15-%{patchlevel}.patch
Patch1: iscsitarget-0.4.15-initscript.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: %{name}-kmod >= %{epoch}:%{version}
Provides: %{name}-kmod-common = %{epoch}:%{version}
BuildRequires: openssl-devel
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%description
An open source iSCSI target with professional features,
works well in enterprise environment under real workload,
and is scalable and versatile enough to meet the challenge
of future storage needs.
%prep
%setup -q
%patch0 -p0 -b .%{patchlevel}
%patch1 -p1 -b .initscript
%build
make CFLAGS="%{optflags} -I../include" -C usr %{?_smp_flags}
%install
rm -rf $RPM_BUILD_ROOT
make DISTDIR=$RPM_BUILD_ROOT install-usr install-etc install-man
install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d
mv $RPM_BUILD_ROOT%{_sysconfdir}/init.d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d
%clean
rm -rf $RPM_BUILD_ROOT
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add iscsi-target
%preun
if [ $1 = 0 ]; then
/sbin/service iscsi-target stop >/dev/null 2>&1
/sbin/chkconfig --del iscsi-target
fi
%files
%defattr(-,root,root,-)
%doc COPYING README README.vmware ChangeLog
%{_sbindir}/ietd
%{_sbindir}/ietadm
%config(noreplace) %{_sysconfdir}/ietd.conf
%config(noreplace) %{_sysconfdir}/initiators.allow
%config(noreplace) %{_sysconfdir}/initiators.deny
%{_initrddir}/iscsi-target
%{_mandir}/man5/ietd.conf.5*
%{_mandir}/man8/ietadm.8*
%{_mandir}/man8/ietd.8*
%changelog
* Fri Oct 03 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-10.svn142
- rebuild for rpm fusion
* Fri Jan 25 2008 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-9.svn142
- Init script needs bash to run (Thanks to Rolf Fokkens)
* Sun Dec 23 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-8.svn142
- Corrected dependencies to take Epoch into account (Thanks Ville Skyttä)
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-7.svn142
- No need to try to patch the kernel module, we build userland
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-6.svn142
- Require the proper name of the kernel module
- Correct the versioning
- Stop the daemon upon package removal
- Describe how the patch was generated
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-5
- Fixed the init script to comply with Fedora guidelines
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-4
- Adjusted for kmodtool
* Thu Oct 18 2007 Tom G. Christensen <swpkg(a)statsbiblioteket.dk> - 0.4.15-3
- Build for kernel pointed to by kmdl_kernelsrcdir instead
of running kernel
* Fri Oct 5 2007 Tom G. Christensen <swpkg(a)statsbiblioteket.dk> - 0.4.15-2
- Initial build.
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/iscsitarget/F-8/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 3 Oct 2008 11:59:38 -0000 1.1
+++ .cvsignore 3 Oct 2008 13:57:23 -0000 1.2
@@ -0,0 +1 @@
+iscsitarget-0.4.15.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/iscsitarget/F-8/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 3 Oct 2008 11:59:38 -0000 1.1
+++ sources 3 Oct 2008 13:57:23 -0000 1.2
@@ -0,0 +1 @@
+81390e388d87e3cc17383ef5f4322c28 iscsitarget-0.4.15.tar.gz
16 years, 1 month
rpms/iscsitarget/F-9 iscsitarget-0.4.15-initscript.patch, NONE, 1.1 iscsitarget-0.4.15-svn142.patch, NONE, 1.1 iscsitarget.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget/F-9
In directory se02.es.rpmfusion.net:/tmp/cvs-serv1365
Modified Files:
.cvsignore sources
Added Files:
iscsitarget-0.4.15-initscript.patch
iscsitarget-0.4.15-svn142.patch iscsitarget.spec
Log Message:
import from livna
iscsitarget-0.4.15-initscript.patch:
--- NEW FILE iscsitarget-0.4.15-initscript.patch ---
diff -ur iscsitarget-0.4.15.orig/etc/initd/initd.redhat iscsitarget-0.4.15/etc/initd/initd.redhat
--- iscsitarget-0.4.15.orig/etc/initd/initd.redhat 2008-01-25 19:54:08.000000000 +0100
+++ iscsitarget-0.4.15/etc/initd/initd.redhat 2008-01-25 19:54:29.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# chkconfig: - 39 35
# description: Starts and stops the iSCSI target
@@ -6,6 +6,14 @@
# pidfile: /var/run/ietd.pid
# config: /etc/ietd.conf
+### BEGIN INIT INFO
+# Provides: iscsi-target
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Short-Description: start and stop ietd
+# Description: Starts and stops the iSCSI target
+### END INIT INFO
+
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
@@ -26,6 +34,7 @@
modprobe iscsi_trgt
daemon /usr/sbin/ietd
RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/iscsi-target
echo
return $RETVAL
}
@@ -40,6 +49,7 @@
modprobe -r crc32c 2>/dev/null
if [ $RETVAL -eq 0 ]; then
echo_success
+ rm -f /var/lock/subsys/iscsi-target
else
echo_failure
fi
@@ -61,6 +71,16 @@
fi
}
+try-restart()
+{
+ condrestart
+}
+
+force-reload()
+{
+ try-restart
+}
+
status()
{
PID=`pidofproc ietd`
@@ -89,7 +109,7 @@
status
;;
*)
- echo $"Usage: $0 {start|stop|restart|status}"
+ echo $"Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 1
esac
iscsitarget-0.4.15-svn142.patch:
--- NEW FILE iscsitarget-0.4.15-svn142.patch ---
Index: kernel/block-io.c
===================================================================
--- kernel/block-io.c (.../tags/0.4.15) (revision 145)
+++ kernel/block-io.c (.../trunk) (revision 142)
@@ -169,8 +169,8 @@
bdev = open_bdev_excl(path, flags, THIS_MODULE);
if (IS_ERR(bdev)) {
- err = PTR_ERR (bdev);
- eprintk("Can't open device %s \n", path);
+ err = PTR_ERR(bdev);
+ eprintk("Can't open device %s, error %d\n", path, err);
bio_data->bdev = NULL;
} else {
bio_data->bdev = bdev;
@@ -217,7 +217,7 @@
p = (u32 *) (volume->scsi_id + VENDOR_ID_LEN);
*(p + 0) = volume->target->trgt_param.target_type;
*(p + 1) = volume->target->tid;
- *(p + 2) = (unsigned int) inode->i_ino;
+ *(p + 2) = volume->lun;
*(p + 3) = (unsigned int) inode->i_sb->s_dev;
}
Index: kernel/target_disk.c
===================================================================
--- kernel/target_disk.c (.../tags/0.4.15) (revision 145)
+++ kernel/target_disk.c (.../trunk) (revision 142)
@@ -66,13 +66,15 @@
unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00};
- u32 ncyl, *p;
+ u32 ncyl;
+ u32 n;
/* assume 0xff heads, 15krpm. */
memcpy(ptr, geo_m_pg, sizeof(geo_m_pg));
ncyl = sec >> 14; /* 256 * 64 */
- p = (u32 *)(ptr + 1);
- *p = *p | cpu_to_be32(ncyl);
+ memcpy(&n, ptr+1, sizeof(u32));
+ n = n | cpu_to_be32(ncyl);
+ memcpy(ptr+1, &n, sizeof(u32));
return sizeof(geo_m_pg);
}
@@ -249,7 +251,8 @@
struct iet_volume *lun;
int rest, idx = 0;
- size = be32_to_cpu(*(u32 *)&req->scb[6]);
+ size = (u32)req->scb[6] << 24 | (u32)req->scb[7] << 16 |
+ (u32)req->scb[8] << 8 | (u32)req->scb[9];
if (size < 16)
return -1;
Index: kernel/iotype.c
===================================================================
--- kernel/iotype.c (.../tags/0.4.15) (revision 145)
+++ kernel/iotype.c (.../trunk) (revision 142)
@@ -89,9 +89,11 @@
for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
if (!(err = register_iotype(iotype_array[i])))
- eprintk("register %s\n", iotype_array[i]->name);
+ iprintk("Registered io type %s\n",
+ iotype_array[i]->name);
else {
- eprintk("failed to register %s\n", iotype_array[i]->name);
+ eprintk("Failed to register io type %s\n",
+ iotype_array[i]->name);
break;
}
}
Index: kernel/iscsi.c
===================================================================
--- kernel/iscsi.c (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi.c (.../trunk) (revision 142)
@@ -726,13 +726,18 @@
case READ_10:
case WRITE_10:
case WRITE_VERIFY:
- *off = be32_to_cpu(*(u32 *)&cmd[2]);
+ *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
+ (u32)cmd[4] << 8 | (u32)cmd[5];
*len = (cmd[7] << 8) + cmd[8];
break;
case READ_16:
case WRITE_16:
- *off = be64_to_cpu(*(u64 *)&cmd[2]);
- *len = be32_to_cpu(*(u32 *)&cmd[10]);
+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
+ (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
+ (u64)cmd[8] << 8 | (u64)cmd[9];
+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
+ (u32)cmd[12] << 8 | (u32)cmd[13];
break;
default:
BUG();
@@ -1191,10 +1196,56 @@
}
}
+static inline char *tmf_desc(int fun)
+{
+ static char *tmf_desc[] = {
+ "Unknown Function",
+ "Abort Task",
+ "Abort Task Set",
+ "Clear ACA",
+ "Clear Task Set",
+ "Logical Unit Reset",
+ "Target Warm Reset",
+ "Target Cold Reset",
+ "Task Reassign",
+ };
+
+ if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
+ (fun > ISCSI_FUNCTION_TASK_REASSIGN))
+ fun = 0;
+
+ return tmf_desc[fun];
+}
+
+static inline char *rsp_desc(int rsp)
+{
+ static char *rsp_desc[] = {
+ "Function Complete",
+ "Unknown Task",
+ "Unknown LUN",
+ "Task Allegiant",
+ "Failover Unsupported",
+ "Function Unsupported",
+ "No Authorization",
+ "Function Rejected",
+ "Unknown Response",
+ };
+
+ if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
+ (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
+ (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
+ rsp = 8;
+ else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
+ rsp = 7;
+
+ return rsp_desc[rsp];
+}
+
static void execute_task_management(struct iscsi_cmnd *req)
{
struct iscsi_conn *conn = req->conn;
- struct iscsi_target *target = conn->session->target;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_target *target = session->target;
struct iscsi_cmnd *rsp;
struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
struct iscsi_task_rsp_hdr *rsp_hdr;
@@ -1209,8 +1260,6 @@
rsp_hdr->itt = req_hdr->itt;
rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
- eprintk("%x %d %x\n", cmnd_itt(req), function, req_hdr->rtt);
-
switch (function) {
case ISCSI_FUNCTION_ABORT_TASK:
case ISCSI_FUNCTION_ABORT_TASK_SET:
@@ -1255,6 +1304,11 @@
break;
}
out:
+ iprintk("%s (%02x) issued on tid:%d lun:%d by sid:%llu (%s)\n",
+ tmf_desc(function), function, target->tid,
+ translate_lun(req_hdr->lun), session->sid,
+ rsp_desc(rsp_hdr->response));
+
iscsi_cmnd_init_write(rsp);
}
@@ -1708,8 +1762,7 @@
if ((err = event_init()) < 0)
goto err;
- iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
- 0, 0, NULL, NULL);
+ iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
if (!iscsi_cmnd_cache)
goto err;
Index: kernel/null-io.c
===================================================================
--- kernel/null-io.c (.../tags/0.4.15) (revision 145)
+++ kernel/null-io.c (.../trunk) (revision 142)
@@ -16,7 +16,7 @@
#include "iotype.h"
struct nullio_data {
- u32 sectors;
+ u64 sectors;
};
enum {
@@ -32,7 +32,7 @@
static int parse_nullio_params(struct iet_volume *volume, char *params)
{
int err = 0;
- char *p;
+ char *p, *q;
struct nullio_data *data = volume->private;
while ((p = strsep(¶ms, ",")) != NULL) {
@@ -43,7 +43,11 @@
token = match_token(p, tokens, args);
switch (token) {
case Opt_sectors:
- match_int(&args[0], &data->sectors);
+ q = match_strdup(&args[0]);
+ if (!q)
+ return -ENOMEM;
+ data->sectors = simple_strtoull(q, NULL, 10);
+ kfree(q);
break;
case Opt_ignore:
break;
@@ -97,7 +101,7 @@
void nullio_show(struct iet_volume *lu, struct seq_file *seq)
{
struct nullio_data *p = lu->private;
- seq_printf(seq, " sectors:%u\n", p->sectors);
+ seq_printf(seq, " sectors:%llu\n", p->sectors);
}
struct iotype nullio =
Index: kernel/iscsi.h
===================================================================
--- kernel/iscsi.h (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi.h (.../trunk) (revision 142)
@@ -116,9 +116,6 @@
struct worker_thread_info wthread_info;
struct semaphore target_sem;
-
- struct list_head initiator_list;
- u32 initiator_iid_count;
};
struct iscsi_queue {
@@ -189,8 +186,6 @@
struct list_head cmnd_hash[1 << IET_HASH_ORDER];
u32 next_ttt;
-
- struct iscsi_initiator *rinitiator;
};
enum connection_state_bit {
Index: kernel/digest.c
===================================================================
--- kernel/digest.c (.../tags/0.4.15) (revision 145)
+++ kernel/digest.c (.../trunk) (revision 142)
@@ -218,7 +218,7 @@
count = get_pgcnt(size, offset);
assert(idx + count <= tio->pg_cnt);
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
crypto_hash_init(hash);
Index: kernel/event.c
===================================================================
--- kernel/event.c (.../tags/0.4.15) (revision 145)
+++ kernel/event.c (.../trunk) (revision 142)
@@ -95,7 +95,8 @@
int event_init(void)
{
- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+ THIS_MODULE);
if (!nl)
return -ENOMEM;
else
Index: kernel/nthread.c
===================================================================
--- kernel/nthread.c (.../tags/0.4.15) (revision 145)
+++ kernel/nthread.c (.../trunk) (revision 142)
@@ -13,8 +13,6 @@
#include "iscsi_dbg.h"
#include "digest.h"
-DECLARE_WAIT_QUEUE_HEAD(iscsi_ctl_wait);
-
enum daemon_state_bit {
D_ACTIVE,
D_DATA_READY,
Index: kernel/target.c
===================================================================
--- kernel/target.c (.../tags/0.4.15) (revision 145)
+++ kernel/target.c (.../trunk) (revision 142)
@@ -148,7 +148,6 @@
INIT_LIST_HEAD(&target->session_list);
INIT_LIST_HEAD(&target->volumes);
- INIT_LIST_HEAD(&target->initiator_list);
atomic_set(&target->nr_volumes, 0);
Index: kernel/iscsi_dbg.h
===================================================================
--- kernel/iscsi_dbg.h (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi_dbg.h (.../trunk) (revision 142)
@@ -15,21 +15,25 @@
extern unsigned long debug_enable_flags;
-#define dprintk(debug, fmt, args...) \
-do { \
- if ((debug) & debug_enable_flags) { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
- } \
+#define PFX "iscsi_trgt: "
+
+#define dprintk(debug, fmt, args...) do { \
+ if ((debug) & debug_enable_flags) { \
+ printk(KERN_DEBUG PFX "%s(%d) " fmt, __FUNCTION__,\
+ __LINE__, args);\
+ } \
} while (0)
-#define eprintk(fmt, args...) \
-do { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
+#define eprintk(fmt, args...) do { \
+ printk(KERN_ERR PFX "%s(%d) " fmt, __FUNCTION__, \
+ __LINE__, args);\
} while (0)
+#define iprintk(X...) printk(KERN_INFO PFX X)
+
#define assert(p) do { \
if (!(p)) { \
- printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
+ printk(KERN_CRIT PFX "BUG at %s:%d assert(%s)\n",\
__FILE__, __LINE__, #p); \
dump_stack(); \
BUG(); \
@@ -40,9 +44,10 @@
static inline void iscsi_dump_iov(struct msghdr *msg)
{
int i;
- printk("%p, %d\n", msg->msg_iov, msg->msg_iovlen);
+ printk(PFX "%p, %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0; i < min_t(size_t, msg->msg_iovlen, ISCSI_CONN_IOV_MAX); i++)
- printk("%d: %p,%d\n", i, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
+ printk(PFX "%d: %p,%d\n", i, msg->msg_iov[i].iov_base,
+ msg->msg_iov[i].iov_len);
}
#else
#define iscsi_dump_iov(x) do {} while (0)
@@ -84,18 +89,18 @@
int i;
buf = (void *)&pdu->bhs;
- printk("BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
+ printk(PFX "BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
for (i = 0; i < sizeof(pdu->bhs); i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
buf = (void *)pdu->ahs;
- printk("AHS: (%p,%d)\n", buf, pdu->ahssize);
+ printk(PFX "AHS: (%p,%d)\n", buf, pdu->ahssize);
for (i = 0; i < pdu->ahssize; i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
- printk("Data: (%d)\n", pdu->datasize);
+ printk(PFX "Data: (%d)\n", pdu->datasize);
}
#else
Index: kernel/tio.c
===================================================================
--- kernel/tio.c (.../tags/0.4.15) (revision 145)
+++ kernel/tio.c (.../trunk) (revision 142)
@@ -110,8 +110,7 @@
int tio_init(void)
{
- tio_cache = kmem_cache_create("tio", sizeof(struct tio),
- 0, 0, NULL, NULL);
+ tio_cache = KMEM_CACHE(tio, 0);
return tio_cache ? 0 : -ENOMEM;
}
Index: patches/compat-2.6.19-2.6.21.patch
===================================================================
--- patches/compat-2.6.19-2.6.21.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.19-2.6.21.patch (.../trunk) (revision 142)
@@ -0,0 +1,41 @@
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 122)
+@@ -95,8 +95,7 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+- THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/iscsi.c
+===================================================================
+--- kernel/iscsi.c (working copy)
++++ kernel/iscsi.c (revision 137)
+@@ -1757,7 +1757,8 @@ static int iscsi_init(void)
+ if ((err = event_init()) < 0)
+ goto err;
+
+- iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
++ iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
++ 0, 0, NULL, NULL);
+ if (!iscsi_cmnd_cache)
+ goto err;
+
+Index: kernel/tio.c
+===================================================================
+--- kernel/tio.c (working copy)
++++ kernel/tio.c (revision 137)
+@@ -110,7 +110,8 @@ int tio_sync(struct iet_volume *lu, stru
+
+ int tio_init(void)
+ {
+- tio_cache = KMEM_CACHE(tio, 0);
++ tio_cache = kmem_cache_create("tio", sizeof(struct tio),
++ 0, 0, NULL, NULL);
+ return tio_cache ? 0 : -ENOMEM;
+ }
Index: patches/compat-2.6.14-2.6.18.patch
===================================================================
--- patches/compat-2.6.14-2.6.18.patch (.../tags/0.4.15) (revision 145)
+++ patches/compat-2.6.14-2.6.18.patch (.../trunk) (revision 142)
@@ -2,7 +2,7 @@
===================================================================
--- kernel/iscsi.h (revision 105)
+++ kernel/iscsi.h (working copy)
-@@ -238,8 +238,8 @@ struct iscsi_conn {
+@@ -233,8 +233,8 @@ struct iscsi_conn {
u32 write_offset;
int write_state;
@@ -134,7 +134,7 @@
idx = offset >> PAGE_CACHE_SHIFT;
@@ -220,7 +211,7 @@ static void digest_data(struct hash_desc
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
- crypto_hash_init(hash);
+ crypto_digest_init(tfm);
Index: usr/isns.c
===================================================================
--- usr/isns.c (.../tags/0.4.15) (revision 145)
+++ usr/isns.c (.../trunk) (revision 142)
@@ -256,7 +256,8 @@
scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE |
ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED;
- scn_flags = htonl(set_scn_flag(scn_flags));
+ set_scn_flag(scn_flags);
+ scn_flags = htonl(scn_flags);
length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_SCN_BITMAP,
sizeof(scn_flags), &scn_flags);
Index: usr/iscsid.c
===================================================================
--- usr/iscsid.c (.../tags/0.4.15) (revision 145)
+++ usr/iscsid.c (.../trunk) (revision 142)
@@ -89,8 +89,13 @@
char *buffer;
if (!conn->rsp.datasize) {
- if (!conn->rsp_buffer)
+ if (!conn->rsp_buffer) {
conn->rsp_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->rsp_buffer) {
+ log_error("Failed to alloc send buffer");
+ return;
+ }
+ }
conn->rsp.data = conn->rsp_buffer;
}
if (conn->rwsize + len > INCOMING_BUFSIZE) {
@@ -385,7 +390,12 @@
/* return; */
/* } */
- ki->param_get(conn->tid, 0, key_session, conn->session_param);
+ if (ki->param_get(conn->tid, 0, key_session,
+ conn->session_param)) {
+ rsp->status_class = ISCSI_STATUS_TARGET_ERROR;
+ rsp->status_detail = ISCSI_STATUS_SVC_UNAVAILABLE;
+ conn->state = STATE_EXIT;
+ }
}
conn->exp_cmd_sn = be32_to_cpu(req->cmd_sn);
log_debug(1, "exp_cmd_sn: %d,%d", conn->exp_cmd_sn, req->cmd_sn);
Index: usr/ietd.c
===================================================================
--- usr/ietd.c (.../tags/0.4.15) (revision 145)
+++ usr/ietd.c (.../trunk) (revision 142)
@@ -307,9 +307,24 @@
(conn->req.bhs.datalength[1] << 8) +
conn->req.bhs.datalength[2]);
conn->rwsize = (conn->req.ahssize + conn->req.datasize + 3) & -4;
+ if (conn->rwsize > INCOMING_BUFSIZE) {
+ log_warning("Recv PDU with "
+ "invalid size %d "
+ "(max: %d)",
+ conn->rwsize,
+ INCOMING_BUFSIZE);
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
if (conn->rwsize) {
- if (!conn->req_buffer)
+ if (!conn->req_buffer) {
conn->req_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->req_buffer) {
+ log_error("Failed to alloc recv buffer");
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
+ }
conn->buffer = conn->req_buffer;
conn->req.ahs = conn->buffer;
conn->req.data = conn->buffer + conn->req.ahssize;
@@ -396,6 +411,7 @@
exit(1);
}
+ conn_close:
if (conn->state == STATE_CLOSE) {
log_debug(0, "connection closed");
conn_free_pdu(conn);
Index: etc/initd/initd.gentoo
===================================================================
--- etc/initd/initd.gentoo (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.gentoo (.../trunk) (revision 142)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
depend()
{
use net
}
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
Index: etc/initd/initd
===================================================================
--- etc/initd/initd (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd (.../trunk) (revision 142)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
}
-
+
stop_server()
{
ietadm --op delete
Index: etc/initd/initd.debian
===================================================================
--- etc/initd/initd.debian (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.debian (.../trunk) (revision 142)
@@ -10,65 +10,29 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# Don't touch this "memsize thingy" unless you are blessed
-# with knowledge about it.
-MEM_SIZE=1048576
-
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
ietd_start()
{
echo -n "Starting iSCSI enterprise target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
start-stop-daemon --start --exec $DAEMON --quiet
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
- fi
+ fi
}
-
+
ietd_stop()
{
echo -n "Removing iSCSI enterprise target devices: "
- # ugly, but ietadm does not allways provides correct exit values
+ # ugly, but ietadm does not always provide correct exit values
RETURN=`ietadm --op delete 2>&1`
RETVAL=$?
- if [ $RETVAL == "0" ] && [[ $RETURN != "something wrong" ]]; then
+ if [ $RETVAL -eq 0 ] && [ x$RETURN != x"something wrong" ]; then
echo "succeeded."
else
echo "failed with reason :$RETURN"
@@ -78,19 +42,19 @@
echo -n "Stopping iSCSI enterprise target service: "
start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
fi
- # ugly, but pid file is not removed ba ietd
+ # ugly, but pid file is not removed by ietd
rm -f $PID_FILE
echo -n "Removing iSCSI enterprise target modules: "
modprobe -r iscsi_trgt
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
@@ -117,18 +81,18 @@
else
echo "no iSCSI enterprise target found!"
exit 1
- fi
+ fi
;;
dump)
DUMP=`tempfile -p ietd`
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Failed to create dump file $DUMP"
exit 1
fi
ietadm --mode dump --all >$DUMP
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Error dumping config from daemon"
rm $DUMP
exit 1
Index: etc/initd/initd.redhat
===================================================================
--- etc/initd/initd.redhat (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.redhat (.../trunk) (revision 142)
@@ -16,45 +16,12 @@
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
start()
{
echo -n "Starting iSCSI target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
daemon /usr/sbin/ietd
@@ -62,7 +29,7 @@
echo
return $RETVAL
}
-
+
stop()
{
echo -n "Stopping iSCSI target service: "
@@ -71,7 +38,7 @@
modprobe -r iscsi_trgt 2>/dev/null
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
@@ -102,7 +69,7 @@
exit 1
else
echo "ietd (pid $PID) is running..."
- fi
+ fi
}
case "$1" in
Index: Makefile
===================================================================
--- Makefile (.../tags/0.4.15) (revision 145)
+++ Makefile (.../trunk) (revision 142)
@@ -51,6 +51,11 @@
# base first the earlier patch sets will not need to be modified.
#
+# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
+ifeq ($(call kver_le,2,6,21),1)
+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
+endif
+
# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
ifeq ($(call kver_le,2,6,18),1)
PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
@@ -140,27 +145,34 @@
rm -f .patched.*; \
fi
-install: install-kernel install-usr install-etc install-doc
+depmod:
+ @echo "Running depmod"
+ @if [ x$(DISTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
+ depmod -aq -b $(DISTDIR)$(INSTALL_MOD_PATH) $(KVER); \
+ else \
+ depmod -aq $(KVER); \
+ fi
+install: install-usr install-etc install-doc install-kernel depmod
+
install-kernel: kernel/iscsi_trgt.ko
@install -vD kernel/iscsi_trgt.ko \
$(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
install-usr: usr/ietd usr/ietadm
@install -vD usr/ietd $(DISTDIR)/usr/sbin/ietd
@install -vD usr/ietadm $(DISTDIR)/usr/sbin/ietadm
install-etc: install-initd
- @if [ ! -e /etc/ietd.conf ]; then \
+ @if [ ! -e $(DISTDIR)/etc/ietd.conf ]; then \
install -vD -m 644 etc/ietd.conf \
$(DISTDIR)/etc/ietd.conf; \
fi
- @if [ ! -e /etc/initiators.allow ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.allow ]; then \
install -vD -m 644 etc/initiators.allow \
$(DISTDIR)/etc/initiators.allow; \
fi
- @if [ ! -e /etc/initiators.deny ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.deny ]; then \
install -vD -m 644 etc/initiators.deny \
$(DISTDIR)/etc/initiators.deny; \
fi
@@ -204,11 +216,10 @@
$(DISTDIR)$(MANDIR)/man$$s/$$f ; \
done
-uninstall: uninstall-kernel uninstall-usr uninstall-etc uninstall-doc
+uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
uninstall-kernel:
rm -f $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
uninstall-usr:
@rm -f $(DISTDIR)/usr/sbin/ietd
--- NEW FILE iscsitarget.spec ---
%define patchlevel svn142
Name: iscsitarget
Version: 0.4.15
Release: 10.%{patchlevel}%{?dist}
Epoch: 1
Summary: Utilities for iSCSI Enterprise Target
Group: System Environment/Daemons
License: GPLv2
URL: http://sourceforge.net/projects/iscsitarget/
Source0: http://dl.sf.net/iscsitarget/%{name}-%{version}.tar.gz
# This was created with:
# svn diff http://svn.berlios.de/svnroot/repos/iscsitarget/tags/0.4.15/ \
# http://svn.berlios.de/svnroot/repos/iscsitarget/trunk/@142
Patch0: iscsitarget-0.4.15-%{patchlevel}.patch
Patch1: iscsitarget-0.4.15-initscript.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: %{name}-kmod >= %{epoch}:%{version}
Provides: %{name}-kmod-common = %{epoch}:%{version}
BuildRequires: openssl-devel
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%description
An open source iSCSI target with professional features,
works well in enterprise environment under real workload,
and is scalable and versatile enough to meet the challenge
of future storage needs.
%prep
%setup -q
%patch0 -p0 -b .%{patchlevel}
%patch1 -p1 -b .initscript
%build
make CFLAGS="%{optflags} -I../include" -C usr %{?_smp_flags}
%install
rm -rf $RPM_BUILD_ROOT
make DISTDIR=$RPM_BUILD_ROOT install-usr install-etc install-man
install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d
mv $RPM_BUILD_ROOT%{_sysconfdir}/init.d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d
%clean
rm -rf $RPM_BUILD_ROOT
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add iscsi-target
%preun
if [ $1 = 0 ]; then
/sbin/service iscsi-target stop >/dev/null 2>&1
/sbin/chkconfig --del iscsi-target
fi
%files
%defattr(-,root,root,-)
%doc COPYING README README.vmware ChangeLog
%{_sbindir}/ietd
%{_sbindir}/ietadm
%config(noreplace) %{_sysconfdir}/ietd.conf
%config(noreplace) %{_sysconfdir}/initiators.allow
%config(noreplace) %{_sysconfdir}/initiators.deny
%{_initrddir}/iscsi-target
%{_mandir}/man5/ietd.conf.5*
%{_mandir}/man8/ietadm.8*
%{_mandir}/man8/ietd.8*
%changelog
* Fri Oct 03 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-10.svn142
- rebuild for rpm fusion
* Fri Jan 25 2008 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-9.svn142
- Init script needs bash to run (Thanks to Rolf Fokkens)
* Sun Dec 23 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-8.svn142
- Corrected dependencies to take Epoch into account (Thanks Ville Skyttä)
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-7.svn142
- No need to try to patch the kernel module, we build userland
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-6.svn142
- Require the proper name of the kernel module
- Correct the versioning
- Stop the daemon upon package removal
- Describe how the patch was generated
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-5
- Fixed the init script to comply with Fedora guidelines
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-4
- Adjusted for kmodtool
* Thu Oct 18 2007 Tom G. Christensen <swpkg(a)statsbiblioteket.dk> - 0.4.15-3
- Build for kernel pointed to by kmdl_kernelsrcdir instead
of running kernel
* Fri Oct 5 2007 Tom G. Christensen <swpkg(a)statsbiblioteket.dk> - 0.4.15-2
- Initial build.
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/iscsitarget/F-9/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 3 Oct 2008 11:59:38 -0000 1.1
+++ .cvsignore 3 Oct 2008 13:57:10 -0000 1.2
@@ -0,0 +1 @@
+iscsitarget-0.4.15.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/iscsitarget/F-9/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 3 Oct 2008 11:59:38 -0000 1.1
+++ sources 3 Oct 2008 13:57:10 -0000 1.2
@@ -0,0 +1 @@
+81390e388d87e3cc17383ef5f4322c28 iscsitarget-0.4.15.tar.gz
16 years, 1 month
rpms/iscsitarget/devel iscsitarget-0.4.15-initscript.patch, NONE, 1.1 iscsitarget-0.4.15-svn142.patch, NONE, 1.1 iscsitarget.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
by Thorsten Leemhuis
Author: thl
Update of /cvs/free/rpms/iscsitarget/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv955
Modified Files:
.cvsignore sources
Added Files:
iscsitarget-0.4.15-initscript.patch
iscsitarget-0.4.15-svn142.patch iscsitarget.spec
Log Message:
import from livna
iscsitarget-0.4.15-initscript.patch:
--- NEW FILE iscsitarget-0.4.15-initscript.patch ---
diff -ur iscsitarget-0.4.15.orig/etc/initd/initd.redhat iscsitarget-0.4.15/etc/initd/initd.redhat
--- iscsitarget-0.4.15.orig/etc/initd/initd.redhat 2008-01-25 19:54:08.000000000 +0100
+++ iscsitarget-0.4.15/etc/initd/initd.redhat 2008-01-25 19:54:29.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# chkconfig: - 39 35
# description: Starts and stops the iSCSI target
@@ -6,6 +6,14 @@
# pidfile: /var/run/ietd.pid
# config: /etc/ietd.conf
+### BEGIN INIT INFO
+# Provides: iscsi-target
+# Required-Start: $local_fs $network $remote_fs $syslog
+# Required-Stop: $local_fs $network $remote_fs $syslog
+# Short-Description: start and stop ietd
+# Description: Starts and stops the iSCSI target
+### END INIT INFO
+
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
@@ -26,6 +34,7 @@
modprobe iscsi_trgt
daemon /usr/sbin/ietd
RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/iscsi-target
echo
return $RETVAL
}
@@ -40,6 +49,7 @@
modprobe -r crc32c 2>/dev/null
if [ $RETVAL -eq 0 ]; then
echo_success
+ rm -f /var/lock/subsys/iscsi-target
else
echo_failure
fi
@@ -61,6 +71,16 @@
fi
}
+try-restart()
+{
+ condrestart
+}
+
+force-reload()
+{
+ try-restart
+}
+
status()
{
PID=`pidofproc ietd`
@@ -89,7 +109,7 @@
status
;;
*)
- echo $"Usage: $0 {start|stop|restart|status}"
+ echo $"Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 1
esac
iscsitarget-0.4.15-svn142.patch:
--- NEW FILE iscsitarget-0.4.15-svn142.patch ---
Index: kernel/block-io.c
===================================================================
--- kernel/block-io.c (.../tags/0.4.15) (revision 145)
+++ kernel/block-io.c (.../trunk) (revision 142)
@@ -169,8 +169,8 @@
bdev = open_bdev_excl(path, flags, THIS_MODULE);
if (IS_ERR(bdev)) {
- err = PTR_ERR (bdev);
- eprintk("Can't open device %s \n", path);
+ err = PTR_ERR(bdev);
+ eprintk("Can't open device %s, error %d\n", path, err);
bio_data->bdev = NULL;
} else {
bio_data->bdev = bdev;
@@ -217,7 +217,7 @@
p = (u32 *) (volume->scsi_id + VENDOR_ID_LEN);
*(p + 0) = volume->target->trgt_param.target_type;
*(p + 1) = volume->target->tid;
- *(p + 2) = (unsigned int) inode->i_ino;
+ *(p + 2) = volume->lun;
*(p + 3) = (unsigned int) inode->i_sb->s_dev;
}
Index: kernel/target_disk.c
===================================================================
--- kernel/target_disk.c (.../tags/0.4.15) (revision 145)
+++ kernel/target_disk.c (.../trunk) (revision 142)
@@ -66,13 +66,15 @@
unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 0x00, 0x00};
- u32 ncyl, *p;
+ u32 ncyl;
+ u32 n;
/* assume 0xff heads, 15krpm. */
memcpy(ptr, geo_m_pg, sizeof(geo_m_pg));
ncyl = sec >> 14; /* 256 * 64 */
- p = (u32 *)(ptr + 1);
- *p = *p | cpu_to_be32(ncyl);
+ memcpy(&n, ptr+1, sizeof(u32));
+ n = n | cpu_to_be32(ncyl);
+ memcpy(ptr+1, &n, sizeof(u32));
return sizeof(geo_m_pg);
}
@@ -249,7 +251,8 @@
struct iet_volume *lun;
int rest, idx = 0;
- size = be32_to_cpu(*(u32 *)&req->scb[6]);
+ size = (u32)req->scb[6] << 24 | (u32)req->scb[7] << 16 |
+ (u32)req->scb[8] << 8 | (u32)req->scb[9];
if (size < 16)
return -1;
Index: kernel/iotype.c
===================================================================
--- kernel/iotype.c (.../tags/0.4.15) (revision 145)
+++ kernel/iotype.c (.../trunk) (revision 142)
@@ -89,9 +89,11 @@
for (i = 0; i < ARRAY_SIZE(iotype_array); i++) {
if (!(err = register_iotype(iotype_array[i])))
- eprintk("register %s\n", iotype_array[i]->name);
+ iprintk("Registered io type %s\n",
+ iotype_array[i]->name);
else {
- eprintk("failed to register %s\n", iotype_array[i]->name);
+ eprintk("Failed to register io type %s\n",
+ iotype_array[i]->name);
break;
}
}
Index: kernel/iscsi.c
===================================================================
--- kernel/iscsi.c (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi.c (.../trunk) (revision 142)
@@ -726,13 +726,18 @@
case READ_10:
case WRITE_10:
case WRITE_VERIFY:
- *off = be32_to_cpu(*(u32 *)&cmd[2]);
+ *off = (u32)cmd[2] << 24 | (u32)cmd[3] << 16 |
+ (u32)cmd[4] << 8 | (u32)cmd[5];
*len = (cmd[7] << 8) + cmd[8];
break;
case READ_16:
case WRITE_16:
- *off = be64_to_cpu(*(u64 *)&cmd[2]);
- *len = be32_to_cpu(*(u32 *)&cmd[10]);
+ *off = (u64)cmd[2] << 56 | (u64)cmd[3] << 48 |
+ (u64)cmd[4] << 40 | (u64)cmd[5] << 32 |
+ (u64)cmd[6] << 24 | (u64)cmd[7] << 16 |
+ (u64)cmd[8] << 8 | (u64)cmd[9];
+ *len = (u32)cmd[10] << 24 | (u32)cmd[11] << 16 |
+ (u32)cmd[12] << 8 | (u32)cmd[13];
break;
default:
BUG();
@@ -1191,10 +1196,56 @@
}
}
+static inline char *tmf_desc(int fun)
+{
+ static char *tmf_desc[] = {
+ "Unknown Function",
+ "Abort Task",
+ "Abort Task Set",
+ "Clear ACA",
+ "Clear Task Set",
+ "Logical Unit Reset",
+ "Target Warm Reset",
+ "Target Cold Reset",
+ "Task Reassign",
+ };
+
+ if ((fun < ISCSI_FUNCTION_ABORT_TASK) ||
+ (fun > ISCSI_FUNCTION_TASK_REASSIGN))
+ fun = 0;
+
+ return tmf_desc[fun];
+}
+
+static inline char *rsp_desc(int rsp)
+{
+ static char *rsp_desc[] = {
+ "Function Complete",
+ "Unknown Task",
+ "Unknown LUN",
+ "Task Allegiant",
+ "Failover Unsupported",
+ "Function Unsupported",
+ "No Authorization",
+ "Function Rejected",
+ "Unknown Response",
+ };
+
+ if (((rsp < ISCSI_RESPONSE_FUNCTION_COMPLETE) ||
+ (rsp > ISCSI_RESPONSE_NO_AUTHORIZATION)) &&
+ (rsp != ISCSI_RESPONSE_FUNCTION_REJECTED))
+ rsp = 8;
+ else if (rsp == ISCSI_RESPONSE_FUNCTION_REJECTED)
+ rsp = 7;
+
+ return rsp_desc[rsp];
+}
+
static void execute_task_management(struct iscsi_cmnd *req)
{
struct iscsi_conn *conn = req->conn;
- struct iscsi_target *target = conn->session->target;
+ struct iscsi_session *session = conn->session;
+ struct iscsi_target *target = session->target;
struct iscsi_cmnd *rsp;
struct iscsi_task_mgt_hdr *req_hdr = (struct iscsi_task_mgt_hdr *)&req->pdu.bhs;
struct iscsi_task_rsp_hdr *rsp_hdr;
@@ -1209,8 +1260,6 @@
rsp_hdr->itt = req_hdr->itt;
rsp_hdr->response = ISCSI_RESPONSE_FUNCTION_COMPLETE;
- eprintk("%x %d %x\n", cmnd_itt(req), function, req_hdr->rtt);
-
switch (function) {
case ISCSI_FUNCTION_ABORT_TASK:
case ISCSI_FUNCTION_ABORT_TASK_SET:
@@ -1255,6 +1304,11 @@
break;
}
out:
+ iprintk("%s (%02x) issued on tid:%d lun:%d by sid:%llu (%s)\n",
+ tmf_desc(function), function, target->tid,
+ translate_lun(req_hdr->lun), session->sid,
+ rsp_desc(rsp_hdr->response));
+
iscsi_cmnd_init_write(rsp);
}
@@ -1708,8 +1762,7 @@
if ((err = event_init()) < 0)
goto err;
- iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
- 0, 0, NULL, NULL);
+ iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
if (!iscsi_cmnd_cache)
goto err;
Index: kernel/null-io.c
===================================================================
--- kernel/null-io.c (.../tags/0.4.15) (revision 145)
+++ kernel/null-io.c (.../trunk) (revision 142)
@@ -16,7 +16,7 @@
#include "iotype.h"
struct nullio_data {
- u32 sectors;
+ u64 sectors;
};
enum {
@@ -32,7 +32,7 @@
static int parse_nullio_params(struct iet_volume *volume, char *params)
{
int err = 0;
- char *p;
+ char *p, *q;
struct nullio_data *data = volume->private;
while ((p = strsep(¶ms, ",")) != NULL) {
@@ -43,7 +43,11 @@
token = match_token(p, tokens, args);
switch (token) {
case Opt_sectors:
- match_int(&args[0], &data->sectors);
+ q = match_strdup(&args[0]);
+ if (!q)
+ return -ENOMEM;
+ data->sectors = simple_strtoull(q, NULL, 10);
+ kfree(q);
break;
case Opt_ignore:
break;
@@ -97,7 +101,7 @@
void nullio_show(struct iet_volume *lu, struct seq_file *seq)
{
struct nullio_data *p = lu->private;
- seq_printf(seq, " sectors:%u\n", p->sectors);
+ seq_printf(seq, " sectors:%llu\n", p->sectors);
}
struct iotype nullio =
Index: kernel/iscsi.h
===================================================================
--- kernel/iscsi.h (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi.h (.../trunk) (revision 142)
@@ -116,9 +116,6 @@
struct worker_thread_info wthread_info;
struct semaphore target_sem;
-
- struct list_head initiator_list;
- u32 initiator_iid_count;
};
struct iscsi_queue {
@@ -189,8 +186,6 @@
struct list_head cmnd_hash[1 << IET_HASH_ORDER];
u32 next_ttt;
-
- struct iscsi_initiator *rinitiator;
};
enum connection_state_bit {
Index: kernel/digest.c
===================================================================
--- kernel/digest.c (.../tags/0.4.15) (revision 145)
+++ kernel/digest.c (.../trunk) (revision 142)
@@ -218,7 +218,7 @@
count = get_pgcnt(size, offset);
assert(idx + count <= tio->pg_cnt);
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
crypto_hash_init(hash);
Index: kernel/event.c
===================================================================
--- kernel/event.c (.../tags/0.4.15) (revision 145)
+++ kernel/event.c (.../trunk) (revision 142)
@@ -95,7 +95,8 @@
int event_init(void)
{
- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+ THIS_MODULE);
if (!nl)
return -ENOMEM;
else
Index: kernel/nthread.c
===================================================================
--- kernel/nthread.c (.../tags/0.4.15) (revision 145)
+++ kernel/nthread.c (.../trunk) (revision 142)
@@ -13,8 +13,6 @@
#include "iscsi_dbg.h"
#include "digest.h"
-DECLARE_WAIT_QUEUE_HEAD(iscsi_ctl_wait);
-
enum daemon_state_bit {
D_ACTIVE,
D_DATA_READY,
Index: kernel/target.c
===================================================================
--- kernel/target.c (.../tags/0.4.15) (revision 145)
+++ kernel/target.c (.../trunk) (revision 142)
@@ -148,7 +148,6 @@
INIT_LIST_HEAD(&target->session_list);
INIT_LIST_HEAD(&target->volumes);
- INIT_LIST_HEAD(&target->initiator_list);
atomic_set(&target->nr_volumes, 0);
Index: kernel/iscsi_dbg.h
===================================================================
--- kernel/iscsi_dbg.h (.../tags/0.4.15) (revision 145)
+++ kernel/iscsi_dbg.h (.../trunk) (revision 142)
@@ -15,21 +15,25 @@
extern unsigned long debug_enable_flags;
-#define dprintk(debug, fmt, args...) \
-do { \
- if ((debug) & debug_enable_flags) { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
- } \
+#define PFX "iscsi_trgt: "
+
+#define dprintk(debug, fmt, args...) do { \
+ if ((debug) & debug_enable_flags) { \
+ printk(KERN_DEBUG PFX "%s(%d) " fmt, __FUNCTION__,\
+ __LINE__, args);\
+ } \
} while (0)
-#define eprintk(fmt, args...) \
-do { \
- printk("%s(%d) " fmt, __FUNCTION__, __LINE__, args); \
+#define eprintk(fmt, args...) do { \
+ printk(KERN_ERR PFX "%s(%d) " fmt, __FUNCTION__, \
+ __LINE__, args);\
} while (0)
+#define iprintk(X...) printk(KERN_INFO PFX X)
+
#define assert(p) do { \
if (!(p)) { \
- printk(KERN_CRIT "BUG at %s:%d assert(%s)\n", \
+ printk(KERN_CRIT PFX "BUG at %s:%d assert(%s)\n",\
__FILE__, __LINE__, #p); \
dump_stack(); \
BUG(); \
@@ -40,9 +44,10 @@
static inline void iscsi_dump_iov(struct msghdr *msg)
{
int i;
- printk("%p, %d\n", msg->msg_iov, msg->msg_iovlen);
+ printk(PFX "%p, %d\n", msg->msg_iov, msg->msg_iovlen);
for (i = 0; i < min_t(size_t, msg->msg_iovlen, ISCSI_CONN_IOV_MAX); i++)
- printk("%d: %p,%d\n", i, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
+ printk(PFX "%d: %p,%d\n", i, msg->msg_iov[i].iov_base,
+ msg->msg_iov[i].iov_len);
}
#else
#define iscsi_dump_iov(x) do {} while (0)
@@ -84,18 +89,18 @@
int i;
buf = (void *)&pdu->bhs;
- printk("BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
+ printk(PFX "BHS: (%p,%d)\n", buf, sizeof(pdu->bhs));
for (i = 0; i < sizeof(pdu->bhs); i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
buf = (void *)pdu->ahs;
- printk("AHS: (%p,%d)\n", buf, pdu->ahssize);
+ printk(PFX "AHS: (%p,%d)\n", buf, pdu->ahssize);
for (i = 0; i < pdu->ahssize; i++)
iscsi_dump_char(*buf++);
iscsi_dump_char(-1);
- printk("Data: (%d)\n", pdu->datasize);
+ printk(PFX "Data: (%d)\n", pdu->datasize);
}
#else
Index: kernel/tio.c
===================================================================
--- kernel/tio.c (.../tags/0.4.15) (revision 145)
+++ kernel/tio.c (.../trunk) (revision 142)
@@ -110,8 +110,7 @@
int tio_init(void)
{
- tio_cache = kmem_cache_create("tio", sizeof(struct tio),
- 0, 0, NULL, NULL);
+ tio_cache = KMEM_CACHE(tio, 0);
return tio_cache ? 0 : -ENOMEM;
}
Index: patches/compat-2.6.19-2.6.21.patch
===================================================================
--- patches/compat-2.6.19-2.6.21.patch (.../tags/0.4.15) (revision 0)
+++ patches/compat-2.6.19-2.6.21.patch (.../trunk) (revision 142)
@@ -0,0 +1,41 @@
+Index: kernel/event.c
+===================================================================
+--- kernel/event.c (working copy)
++++ kernel/event.c (revision 122)
+@@ -95,8 +95,7 @@ int event_send(u32 tid, u64 sid, u32 cid
+
+ int event_init(void)
+ {
+- nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, NULL,
+- THIS_MODULE);
++ nl = netlink_kernel_create(NETLINK_IET, 1, event_recv, THIS_MODULE);
+ if (!nl)
+ return -ENOMEM;
+ else
+Index: kernel/iscsi.c
+===================================================================
+--- kernel/iscsi.c (working copy)
++++ kernel/iscsi.c (revision 137)
+@@ -1757,7 +1757,8 @@ static int iscsi_init(void)
+ if ((err = event_init()) < 0)
+ goto err;
+
+- iscsi_cmnd_cache = KMEM_CACHE(iscsi_cmnd, 0);
++ iscsi_cmnd_cache = kmem_cache_create("iscsi_cmnd", sizeof(struct iscsi_cmnd),
++ 0, 0, NULL, NULL);
+ if (!iscsi_cmnd_cache)
+ goto err;
+
+Index: kernel/tio.c
+===================================================================
+--- kernel/tio.c (working copy)
++++ kernel/tio.c (revision 137)
+@@ -110,7 +110,8 @@ int tio_sync(struct iet_volume *lu, stru
+
+ int tio_init(void)
+ {
+- tio_cache = KMEM_CACHE(tio, 0);
++ tio_cache = kmem_cache_create("tio", sizeof(struct tio),
++ 0, 0, NULL, NULL);
+ return tio_cache ? 0 : -ENOMEM;
+ }
Index: patches/compat-2.6.14-2.6.18.patch
===================================================================
--- patches/compat-2.6.14-2.6.18.patch (.../tags/0.4.15) (revision 145)
+++ patches/compat-2.6.14-2.6.18.patch (.../trunk) (revision 142)
@@ -2,7 +2,7 @@
===================================================================
--- kernel/iscsi.h (revision 105)
+++ kernel/iscsi.h (working copy)
-@@ -238,8 +238,8 @@ struct iscsi_conn {
+@@ -233,8 +233,8 @@ struct iscsi_conn {
u32 write_offset;
int write_state;
@@ -134,7 +134,7 @@
idx = offset >> PAGE_CACHE_SHIFT;
@@ -220,7 +211,7 @@ static void digest_data(struct hash_desc
- assert(count < ISCSI_CONN_IOV_MAX);
+ assert(count <= ISCSI_CONN_IOV_MAX);
- crypto_hash_init(hash);
+ crypto_digest_init(tfm);
Index: usr/isns.c
===================================================================
--- usr/isns.c (.../tags/0.4.15) (revision 145)
+++ usr/isns.c (.../trunk) (revision 142)
@@ -256,7 +256,8 @@
scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE |
ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED;
- scn_flags = htonl(set_scn_flag(scn_flags));
+ set_scn_flag(scn_flags);
+ scn_flags = htonl(scn_flags);
length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_SCN_BITMAP,
sizeof(scn_flags), &scn_flags);
Index: usr/iscsid.c
===================================================================
--- usr/iscsid.c (.../tags/0.4.15) (revision 145)
+++ usr/iscsid.c (.../trunk) (revision 142)
@@ -89,8 +89,13 @@
char *buffer;
if (!conn->rsp.datasize) {
- if (!conn->rsp_buffer)
+ if (!conn->rsp_buffer) {
conn->rsp_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->rsp_buffer) {
+ log_error("Failed to alloc send buffer");
+ return;
+ }
+ }
conn->rsp.data = conn->rsp_buffer;
}
if (conn->rwsize + len > INCOMING_BUFSIZE) {
@@ -385,7 +390,12 @@
/* return; */
/* } */
- ki->param_get(conn->tid, 0, key_session, conn->session_param);
+ if (ki->param_get(conn->tid, 0, key_session,
+ conn->session_param)) {
+ rsp->status_class = ISCSI_STATUS_TARGET_ERROR;
+ rsp->status_detail = ISCSI_STATUS_SVC_UNAVAILABLE;
+ conn->state = STATE_EXIT;
+ }
}
conn->exp_cmd_sn = be32_to_cpu(req->cmd_sn);
log_debug(1, "exp_cmd_sn: %d,%d", conn->exp_cmd_sn, req->cmd_sn);
Index: usr/ietd.c
===================================================================
--- usr/ietd.c (.../tags/0.4.15) (revision 145)
+++ usr/ietd.c (.../trunk) (revision 142)
@@ -307,9 +307,24 @@
(conn->req.bhs.datalength[1] << 8) +
conn->req.bhs.datalength[2]);
conn->rwsize = (conn->req.ahssize + conn->req.datasize + 3) & -4;
+ if (conn->rwsize > INCOMING_BUFSIZE) {
+ log_warning("Recv PDU with "
+ "invalid size %d "
+ "(max: %d)",
+ conn->rwsize,
+ INCOMING_BUFSIZE);
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
if (conn->rwsize) {
- if (!conn->req_buffer)
+ if (!conn->req_buffer) {
conn->req_buffer = malloc(INCOMING_BUFSIZE);
+ if (!conn->req_buffer) {
+ log_error("Failed to alloc recv buffer");
+ conn->state = STATE_CLOSE;
+ goto conn_close;
+ }
+ }
conn->buffer = conn->req_buffer;
conn->req.ahs = conn->buffer;
conn->req.data = conn->buffer + conn->req.ahssize;
@@ -396,6 +411,7 @@
exit(1);
}
+ conn_close:
if (conn->state == STATE_CLOSE) {
log_debug(0, "connection closed");
conn_free_pdu(conn);
Index: etc/initd/initd.gentoo
===================================================================
--- etc/initd/initd.gentoo (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.gentoo (.../trunk) (revision 142)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
depend()
{
use net
}
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
Index: etc/initd/initd
===================================================================
--- etc/initd/initd (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd (.../trunk) (revision 142)
@@ -4,47 +4,14 @@
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
start_server()
{
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
/usr/sbin/ietd
}
-
+
stop_server()
{
ietadm --op delete
Index: etc/initd/initd.debian
===================================================================
--- etc/initd/initd.debian (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.debian (.../trunk) (revision 142)
@@ -10,65 +10,29 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# Don't touch this "memsize thingy" unless you are blessed
-# with knowledge about it.
-MEM_SIZE=1048576
-
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
ietd_start()
{
echo -n "Starting iSCSI enterprise target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
start-stop-daemon --start --exec $DAEMON --quiet
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
- fi
+ fi
}
-
+
ietd_stop()
{
echo -n "Removing iSCSI enterprise target devices: "
- # ugly, but ietadm does not allways provides correct exit values
+ # ugly, but ietadm does not always provide correct exit values
RETURN=`ietadm --op delete 2>&1`
RETVAL=$?
- if [ $RETVAL == "0" ] && [[ $RETURN != "something wrong" ]]; then
+ if [ $RETVAL -eq 0 ] && [ x$RETURN != x"something wrong" ]; then
echo "succeeded."
else
echo "failed with reason :$RETURN"
@@ -78,19 +42,19 @@
echo -n "Stopping iSCSI enterprise target service: "
start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE
RETVAL=$?
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
fi
- # ugly, but pid file is not removed ba ietd
+ # ugly, but pid file is not removed by ietd
rm -f $PID_FILE
echo -n "Removing iSCSI enterprise target modules: "
modprobe -r iscsi_trgt
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo "succeeded."
else
echo "failed."
@@ -117,18 +81,18 @@
else
echo "no iSCSI enterprise target found!"
exit 1
- fi
+ fi
;;
dump)
DUMP=`tempfile -p ietd`
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Failed to create dump file $DUMP"
exit 1
fi
ietadm --mode dump --all >$DUMP
RETVAL=$?
- if [ $RETVAL != "0" ]; then
+ if [ $RETVAL -ne 0 ]; then
echo "Error dumping config from daemon"
rm $DUMP
exit 1
Index: etc/initd/initd.redhat
===================================================================
--- etc/initd/initd.redhat (.../tags/0.4.15) (revision 145)
+++ etc/initd/initd.redhat (.../trunk) (revision 142)
@@ -16,45 +16,12 @@
fi
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-MEM_SIZE=1048576
-configure_memsize()
-{
- if [ -e /proc/sys/net/core/wmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_max
- fi
-
- if [ -e /proc/sys/net/core/rmem_max ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_max
- fi
-
- if [ -e /proc/sys/net/core/wmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/wmem_default
- fi
-
- if [ -e /proc/sys/net/core/rmem_default ]; then
- echo ${MEM_SIZE} > /proc/sys/net/core/rmem_default
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_mem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_mem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_rmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_rmem
- fi
-
- if [ -e /proc/sys/net/ipv4/tcp_wmem ]; then
- echo "${MEM_SIZE} ${MEM_SIZE} ${MEM_SIZE}" > /proc/sys/net/ipv4/tcp_wmem
- fi
-}
-
RETVAL=0
start()
{
echo -n "Starting iSCSI target service: "
- configure_memsize
modprobe -q crc32c
modprobe iscsi_trgt
daemon /usr/sbin/ietd
@@ -62,7 +29,7 @@
echo
return $RETVAL
}
-
+
stop()
{
echo -n "Stopping iSCSI target service: "
@@ -71,7 +38,7 @@
modprobe -r iscsi_trgt 2>/dev/null
RETVAL=$?
modprobe -r crc32c 2>/dev/null
- if [ $RETVAL == "0" ]; then
+ if [ $RETVAL -eq 0 ]; then
echo_success
else
echo_failure
@@ -102,7 +69,7 @@
exit 1
else
echo "ietd (pid $PID) is running..."
- fi
+ fi
}
case "$1" in
Index: Makefile
===================================================================
--- Makefile (.../tags/0.4.15) (revision 145)
+++ Makefile (.../trunk) (revision 142)
@@ -51,6 +51,11 @@
# base first the earlier patch sets will not need to be modified.
#
+# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21
+ifeq ($(call kver_le,2,6,21),1)
+ PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patch
+endif
+
# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18
ifeq ($(call kver_le,2,6,18),1)
PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patch
@@ -140,27 +145,34 @@
rm -f .patched.*; \
fi
-install: install-kernel install-usr install-etc install-doc
+depmod:
+ @echo "Running depmod"
+ @if [ x$(DISTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \
+ depmod -aq -b $(DISTDIR)$(INSTALL_MOD_PATH) $(KVER); \
+ else \
+ depmod -aq $(KVER); \
+ fi
+install: install-usr install-etc install-doc install-kernel depmod
+
install-kernel: kernel/iscsi_trgt.ko
@install -vD kernel/iscsi_trgt.ko \
$(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
install-usr: usr/ietd usr/ietadm
@install -vD usr/ietd $(DISTDIR)/usr/sbin/ietd
@install -vD usr/ietadm $(DISTDIR)/usr/sbin/ietadm
install-etc: install-initd
- @if [ ! -e /etc/ietd.conf ]; then \
+ @if [ ! -e $(DISTDIR)/etc/ietd.conf ]; then \
install -vD -m 644 etc/ietd.conf \
$(DISTDIR)/etc/ietd.conf; \
fi
- @if [ ! -e /etc/initiators.allow ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.allow ]; then \
install -vD -m 644 etc/initiators.allow \
$(DISTDIR)/etc/initiators.allow; \
fi
- @if [ ! -e /etc/initiators.deny ]; then \
+ @if [ ! -e $(DISTDIR)/etc/initiators.deny ]; then \
install -vD -m 644 etc/initiators.deny \
$(DISTDIR)/etc/initiators.deny; \
fi
@@ -204,11 +216,10 @@
$(DISTDIR)$(MANDIR)/man$$s/$$f ; \
done
-uninstall: uninstall-kernel uninstall-usr uninstall-etc uninstall-doc
+uninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-doc
uninstall-kernel:
rm -f $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.ko
- -depmod -aq
uninstall-usr:
@rm -f $(DISTDIR)/usr/sbin/ietd
--- NEW FILE iscsitarget.spec ---
%define patchlevel svn142
Name: iscsitarget
Version: 0.4.15
Release: 10.%{patchlevel}%{?dist}
Epoch: 1
Summary: Utilities for iSCSI Enterprise Target
Group: System Environment/Daemons
License: GPLv2
URL: http://sourceforge.net/projects/iscsitarget/
Source0: http://dl.sf.net/iscsitarget/%{name}-%{version}.tar.gz
# This was created with:
# svn diff http://svn.berlios.de/svnroot/repos/iscsitarget/tags/0.4.15/ \
# http://svn.berlios.de/svnroot/repos/iscsitarget/trunk/@142
Patch0: iscsitarget-0.4.15-%{patchlevel}.patch
Patch1: iscsitarget-0.4.15-initscript.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: %{name}-kmod >= %{epoch}:%{version}
Provides: %{name}-kmod-common = %{epoch}:%{version}
BuildRequires: openssl-devel
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%description
An open source iSCSI target with professional features,
works well in enterprise environment under real workload,
and is scalable and versatile enough to meet the challenge
of future storage needs.
%prep
%setup -q
%patch0 -p0 -b .%{patchlevel}
%patch1 -p1 -b .initscript
%build
make CFLAGS="%{optflags} -I../include" -C usr %{?_smp_flags}
%install
rm -rf $RPM_BUILD_ROOT
make DISTDIR=$RPM_BUILD_ROOT install-usr install-etc install-man
install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d
mv $RPM_BUILD_ROOT%{_sysconfdir}/init.d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d
%clean
rm -rf $RPM_BUILD_ROOT
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add iscsi-target
%preun
if [ $1 = 0 ]; then
/sbin/service iscsi-target stop >/dev/null 2>&1
/sbin/chkconfig --del iscsi-target
fi
%files
%defattr(-,root,root,-)
%doc COPYING README README.vmware ChangeLog
%{_sbindir}/ietd
%{_sbindir}/ietadm
%config(noreplace) %{_sysconfdir}/ietd.conf
%config(noreplace) %{_sysconfdir}/initiators.allow
%config(noreplace) %{_sysconfdir}/initiators.deny
%{_initrddir}/iscsi-target
%{_mandir}/man5/ietd.conf.5*
%{_mandir}/man8/ietadm.8*
%{_mandir}/man8/ietd.8*
%changelog
* Fri Oct 03 2008 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info - 1:0.4.15-10.svn142
- rebuild for rpm fusion
* Fri Jan 25 2008 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-9.svn142
- Init script needs bash to run (Thanks to Rolf Fokkens)
* Sun Dec 23 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-8.svn142
- Corrected dependencies to take Epoch into account (Thanks Ville Skyttä)
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-7.svn142
- No need to try to patch the kernel module, we build userland
* Sun Dec 09 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 1:0.4.15-6.svn142
- Require the proper name of the kernel module
- Correct the versioning
- Stop the daemon upon package removal
- Describe how the patch was generated
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-5
- Fixed the init script to comply with Fedora guidelines
* Thu Nov 08 2007 Lubomir Kundrak <lkundrak(a)redhat.com> - 0.4.15.svn142-4
- Adjusted for kmodtool
* Thu Oct 18 2007 Tom G. Christensen <swpkg(a)statsbiblioteket.dk> - 0.4.15-3
- Build for kernel pointed to by kmdl_kernelsrcdir instead
of running kernel
* Fri Oct 5 2007 Tom G. Christensen <swpkg(a)statsbiblioteket.dk> - 0.4.15-2
- Initial build.
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/iscsitarget/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 3 Oct 2008 11:59:38 -0000 1.1
+++ .cvsignore 3 Oct 2008 13:56:24 -0000 1.2
@@ -0,0 +1 @@
+iscsitarget-0.4.15.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/iscsitarget/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 3 Oct 2008 11:59:38 -0000 1.1
+++ sources 3 Oct 2008 13:56:24 -0000 1.2
@@ -0,0 +1 @@
+81390e388d87e3cc17383ef5f4322c28 iscsitarget-0.4.15.tar.gz
16 years, 1 month