diff --git a/include/iscsi_if.h b/include/iscsi_if.h index 8e399b6..afa86e8 100644 --- a/include/iscsi_if.h +++ b/include/iscsi_if.h @@ -213,6 +213,8 @@ enum iscsi_err { ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, + ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18, + ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, }; /* diff --git a/kernel/2.6.14-19_compat.patch b/kernel/2.6.14-19_compat.patch index 2835b35..39b4869 100644 --- a/kernel/2.6.14-19_compat.patch +++ b/kernel/2.6.14-19_compat.patch @@ -1,5 +1,5 @@ diff --git a/iscsi_tcp.c b/iscsi_tcp.c -index 908b541..dfd8e31 100644 +index d074146..4a01066 100644 --- a/iscsi_tcp.c +++ b/iscsi_tcp.c @@ -426,6 +426,17 @@ iscsi_segment_seek_sg(struct iscsi_segment *segment, @@ -20,25 +20,16 @@ index 908b541..dfd8e31 100644 __iscsi_segment_init(segment, size, done, hash); for_each_sg(sg_list, sg, sg_count, i) { debug_scsi("sg %d, len %u offset %u\n", i, sg->length, -@@ -536,7 +547,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) - struct iscsi_session *session = conn->session; - struct scsi_cmnd *sc = task->sc; +@@ -534,7 +545,7 @@ iscsi_data_in(struct iscsi_conn *conn, struct iscsi_task *task) + struct iscsi_tcp_task *tcp_task = task->dd_data; + struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)tcp_conn->in.hdr; int datasn = be32_to_cpu(rhdr->datasn); -- unsigned total_in_length = scsi_in(sc)->length; -+ unsigned total_in_length = scsi_bufflen(sc); +- unsigned total_in_length = scsi_in(task->sc)->length; ++ unsigned total_in_length = scsi_bufflen(task->sc); - iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); + iscsi_update_cmdsn(conn->session, (struct iscsi_nopin*)rhdr); if (tcp_conn->in.datalen == 0) -@@ -568,7 +579,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) - if (res_count > 0 && - (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || - res_count <= total_in_length)) -- scsi_in(sc)->resid = res_count; -+ scsi_set_resid(sc, res_count); - else - sc->result = (DID_BAD_TARGET << 16) | - rhdr->cmd_status; -@@ -679,11 +690,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) +@@ -660,11 +671,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) r2t->data_length, session->max_burst); r2t->data_offset = be32_to_cpu(rhdr->data_offset); @@ -52,7 +43,7 @@ index 908b541..dfd8e31 100644 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); return ISCSI_ERR_DATALEN; -@@ -783,7 +794,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) +@@ -764,7 +775,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) if (tcp_conn->in.datalen) { struct iscsi_tcp_task *tcp_task = task->dd_data; struct hash_desc *rx_hash = NULL; @@ -60,7 +51,7 @@ index 908b541..dfd8e31 100644 /* * Setup copy of Data-In into the Scsi_Cmnd -@@ -801,8 +811,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) +@@ -782,8 +792,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) tcp_task->data_offset, tcp_conn->in.datalen); rc = iscsi_segment_seek_sg(&tcp_conn->in.segment, @@ -71,7 +62,7 @@ index 908b541..dfd8e31 100644 tcp_task->data_offset, tcp_conn->in.datalen, iscsi_tcp_process_data_in, -@@ -1369,8 +1379,8 @@ iscsi_tcp_task_init(struct iscsi_task *task) +@@ -1352,8 +1362,8 @@ iscsi_tcp_task_init(struct iscsi_task *task) return 0; /* If we have immediate data, attach a payload */ @@ -82,7 +73,7 @@ index 908b541..dfd8e31 100644 0, task->imm_count); if (err) return err; -@@ -1393,7 +1403,6 @@ iscsi_tcp_task_xmit(struct iscsi_task *task) +@@ -1376,7 +1386,6 @@ iscsi_tcp_task_xmit(struct iscsi_task *task) struct iscsi_conn *conn = task->conn; struct iscsi_tcp_task *tcp_task = task->dd_data; struct scsi_cmnd *sc = task->sc; @@ -90,7 +81,7 @@ index 908b541..dfd8e31 100644 int rc = 0; flush: -@@ -1413,7 +1422,6 @@ flush: +@@ -1396,7 +1405,6 @@ flush: if (sc->sc_data_direction != DMA_TO_DEVICE) return 0; @@ -98,7 +89,7 @@ index 908b541..dfd8e31 100644 if (task->unsol_count != 0) { struct iscsi_data *hdr = &tcp_task->unsol_dtask.hdr; -@@ -1428,8 +1436,8 @@ flush: +@@ -1411,8 +1419,8 @@ flush: task->itt, tcp_task->sent, task->data_count); iscsi_tcp_send_hdr_prep(conn, hdr, sizeof(*hdr)); @@ -109,7 +100,7 @@ index 908b541..dfd8e31 100644 task->data_count); if (rc) goto fail; -@@ -1475,8 +1483,8 @@ flush: +@@ -1458,8 +1466,8 @@ flush: iscsi_tcp_send_hdr_prep(conn, &r2t->dtask.hdr, sizeof(struct iscsi_hdr)); @@ -120,7 +111,7 @@ index 908b541..dfd8e31 100644 r2t->data_offset + r2t->sent, r2t->data_count); if (rc) -@@ -1864,7 +1872,11 @@ iscsi_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, +@@ -1847,7 +1855,11 @@ iscsi_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, shost->max_lun = iscsi_max_lun; shost->max_id = 0; shost->max_channel = 0; @@ -132,7 +123,7 @@ index 908b541..dfd8e31 100644 if (iscsi_host_add(shost, NULL)) goto free_host; -@@ -1917,6 +1929,9 @@ static int iscsi_tcp_slave_configure(struct scsi_device *sdev) +@@ -1900,6 +1912,9 @@ static int iscsi_tcp_slave_configure(struct scsi_device *sdev) } static struct scsi_host_template iscsi_sht = { @@ -156,7 +147,7 @@ index 68423e8..1796c96 100644 struct socket; struct iscsi_tcp_conn; diff --git a/libiscsi.c b/libiscsi.c -index e45476b..d7613eb 100644 +index f3b845f..cfafb60 100644 --- a/libiscsi.c +++ b/libiscsi.c @@ -24,7 +24,10 @@ @@ -206,8 +197,8 @@ index e45476b..d7613eb 100644 session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1); return 0; } -@@ -412,12 +415,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task, - return; +@@ -407,12 +410,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task, + conn->session->tt->cleanup_task(conn, task); sc->result = err; - if (!scsi_bidi_cmnd(sc)) @@ -220,7 +211,7 @@ index e45476b..d7613eb 100644 if (conn->task == task) conn->task = NULL; -@@ -592,7 +590,7 @@ invalid_datalen: +@@ -587,7 +585,7 @@ invalid_datalen: goto out; } @@ -229,7 +220,7 @@ index e45476b..d7613eb 100644 if (datalen < senselen) goto invalid_datalen; -@@ -608,8 +606,8 @@ invalid_datalen: +@@ -603,8 +601,8 @@ invalid_datalen: if (scsi_bidi_cmnd(sc) && res_count > 0 && (rhdr->flags & ISCSI_FLAG_CMD_BIDI_OVERFLOW || @@ -240,7 +231,18 @@ index e45476b..d7613eb 100644 else sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; } -@@ -1127,10 +1125,9 @@ again: +@@ -653,8 +651,8 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + + if (res_count > 0 && + (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || +- res_count <= scsi_in(sc)->length)) +- scsi_in(sc)->resid = res_count; ++ res_count <= scsi_bufflen(sc))) ++ scsi_set_resid(sc, res_count); + else + sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; + } +@@ -1151,10 +1149,9 @@ again: return rc; } @@ -253,7 +255,7 @@ index e45476b..d7613eb 100644 int rc; /* * serialize Xmit worker on a per-connection basis. -@@ -1273,12 +1270,7 @@ reject: +@@ -1297,12 +1294,7 @@ reject: fault: spin_unlock(&session->lock); debug_scsi("iscsi: cmd 0x%x is not queued (%d)\n", sc->cmnd[0], reason); @@ -267,7 +269,7 @@ index e45476b..d7613eb 100644 done(sc); spin_lock(host->host_lock); return 0; -@@ -1882,8 +1874,9 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, +@@ -1906,8 +1898,9 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, shost = scsi_host_alloc(sht, sizeof(struct iscsi_host) + dd_data_size); if (!shost) return NULL; @@ -278,7 +280,7 @@ index e45476b..d7613eb 100644 if (qdepth > ISCSI_MAX_CMD_PER_LUN || qdepth < 1) { if (qdepth != 0) printk(KERN_ERR "iscsi: invalid queue depth of %d. " -@@ -2096,7 +2089,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, +@@ -2123,7 +2116,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, INIT_LIST_HEAD(&conn->mgmtqueue); INIT_LIST_HEAD(&conn->xmitqueue); INIT_LIST_HEAD(&conn->requeue); @@ -619,7 +621,7 @@ index 0000000..ecd48df + +#endif diff --git a/scsi_transport_iscsi.c b/scsi_transport_iscsi.c -index 535e461..319599a 100644 +index 852b016..8aa9888 100644 --- a/scsi_transport_iscsi.c +++ b/scsi_transport_iscsi.c @@ -21,7 +21,10 @@ @@ -719,8 +721,8 @@ index 535e461..319599a 100644 /* * iSCSI endpoint attrs */ -@@ -229,9 +231,10 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) - return iscsi_dev_to_endpoint(dev); +@@ -237,9 +239,10 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) + return ep; } EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint); +#endif @@ -731,7 +733,7 @@ index 535e461..319599a 100644 { struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data; -@@ -250,7 +253,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, +@@ -258,7 +261,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, } static int iscsi_remove_host(struct transport_container *tc, struct device *dev, @@ -740,7 +742,7 @@ index 535e461..319599a 100644 { struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data; -@@ -490,10 +493,9 @@ static int iscsi_user_scan(struct Scsi_Host *shost, uint channel, +@@ -498,10 +501,9 @@ static int iscsi_user_scan(struct Scsi_Host *shost, uint channel, iscsi_user_scan_session); } @@ -753,7 +755,7 @@ index 535e461..319599a 100644 struct Scsi_Host *shost = iscsi_session_to_shost(session); struct iscsi_cls_host *ihost = shost->shost_data; struct iscsi_scan_data scan_data; -@@ -506,11 +508,9 @@ static void iscsi_scan_session(struct work_struct *work) +@@ -514,11 +516,9 @@ static void iscsi_scan_session(struct work_struct *work) atomic_dec(&ihost->nr_scans); } @@ -767,7 +769,7 @@ index 535e461..319599a 100644 unsigned long flags; iscsi_cls_session_printk(KERN_INFO, session, -@@ -536,11 +536,9 @@ static void session_recovery_timedout(struct work_struct *work) +@@ -544,11 +544,9 @@ static void session_recovery_timedout(struct work_struct *work) scsi_target_unblock(&session->dev); } @@ -781,7 +783,7 @@ index 535e461..319599a 100644 struct Scsi_Host *shost = iscsi_session_to_shost(session); struct iscsi_cls_host *ihost = shost->shost_data; unsigned long flags; -@@ -560,10 +558,12 @@ static void __iscsi_unblock_session(struct work_struct *work) +@@ -568,10 +566,12 @@ static void __iscsi_unblock_session(struct work_struct *work) * the async scanning code (drivers like iscsi_tcp do login and * scanning from userspace). */ @@ -794,7 +796,7 @@ index 535e461..319599a 100644 } /** -@@ -583,11 +583,9 @@ void iscsi_unblock_session(struct iscsi_cls_session *session) +@@ -591,11 +591,9 @@ void iscsi_unblock_session(struct iscsi_cls_session *session) } EXPORT_SYMBOL_GPL(iscsi_unblock_session); @@ -808,7 +810,7 @@ index 535e461..319599a 100644 unsigned long flags; spin_lock_irqsave(&session->lock, flags); -@@ -604,11 +602,9 @@ void iscsi_block_session(struct iscsi_cls_session *session) +@@ -612,11 +610,9 @@ void iscsi_block_session(struct iscsi_cls_session *session) } EXPORT_SYMBOL_GPL(iscsi_block_session); @@ -822,7 +824,7 @@ index 535e461..319599a 100644 struct Scsi_Host *shost = iscsi_session_to_shost(session); struct iscsi_cls_host *ihost = shost->shost_data; unsigned long flags; -@@ -651,12 +647,12 @@ iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport, +@@ -659,12 +655,12 @@ iscsi_alloc_session(struct Scsi_Host *shost, struct iscsi_transport *transport, session->transport = transport; session->recovery_tmo = 120; session->state = ISCSI_SESSION_FREE; @@ -840,7 +842,7 @@ index 535e461..319599a 100644 spin_lock_init(&session->lock); /* this is released in the dev's release function */ -@@ -816,7 +812,7 @@ void iscsi_remove_session(struct iscsi_cls_session *session) +@@ -824,7 +820,7 @@ void iscsi_remove_session(struct iscsi_cls_session *session) scsi_target_unblock(&session->dev); /* flush running scans then delete devices */ flush_workqueue(ihost->scan_workq); @@ -849,7 +851,7 @@ index 535e461..319599a 100644 /* hw iscsi may not have removed all connections from session */ err = device_for_each_child(&session->dev, NULL, -@@ -1300,6 +1296,8 @@ static int +@@ -1308,6 +1304,8 @@ static int iscsi_if_transport_ep(struct iscsi_transport *transport, struct iscsi_uevent *ev, int msg_type) { @@ -858,7 +860,7 @@ index 535e461..319599a 100644 struct iscsi_endpoint *ep; struct sockaddr *dst_addr; int rc = 0; -@@ -1340,6 +1338,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, +@@ -1348,6 +1346,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, break; } return rc; @@ -867,7 +869,7 @@ index 535e461..319599a 100644 } static int -@@ -1421,6 +1421,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1429,6 +1429,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ev->u.c_session.queue_depth); break; case ISCSI_UEVENT_CREATE_BOUND_SESSION: @@ -877,7 +879,7 @@ index 535e461..319599a 100644 ep = iscsi_lookup_endpoint(ev->u.c_bound_session.ep_handle); if (!ep) { err = -EINVAL; -@@ -1432,6 +1435,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1440,6 +1443,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ev->u.c_bound_session.cmds_max, ev->u.c_bound_session.queue_depth); break; @@ -885,7 +887,7 @@ index 535e461..319599a 100644 case ISCSI_UEVENT_DESTROY_SESSION: session = iscsi_session_lookup(ev->u.d_session.sid); if (session) -@@ -1514,55 +1518,70 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1522,55 +1526,70 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) } /* @@ -992,7 +994,7 @@ index 535e461..319599a 100644 __ATTR(_name,_mode,_show,_store) /* -@@ -1570,10 +1589,9 @@ struct device_attribute dev_attr_##_prefix##_##_name = \ +@@ -1578,10 +1597,9 @@ struct device_attribute dev_attr_##_prefix##_##_name = \ */ #define iscsi_conn_attr_show(param) \ static ssize_t \ @@ -1005,7 +1007,7 @@ index 535e461..319599a 100644 struct iscsi_transport *t = conn->transport; \ return t->get_conn_param(conn, param, buf); \ } -@@ -1597,16 +1615,17 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); +@@ -1605,16 +1623,17 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); iscsi_conn_attr(ping_tmo, ISCSI_PARAM_PING_TMO); iscsi_conn_attr(recv_tmo, ISCSI_PARAM_RECV_TMO); @@ -1027,7 +1029,7 @@ index 535e461..319599a 100644 struct iscsi_transport *t = session->transport; \ \ if (perm && !capable(CAP_SYS_ADMIN)) \ -@@ -1640,10 +1659,9 @@ iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); +@@ -1648,10 +1667,9 @@ iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0) static ssize_t @@ -1040,7 +1042,7 @@ index 535e461..319599a 100644 return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); } static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, -@@ -1651,11 +1669,9 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, +@@ -1659,11 +1677,9 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, #define iscsi_priv_session_attr_show(field, format) \ static ssize_t \ @@ -1054,7 +1056,7 @@ index 535e461..319599a 100644 return sprintf(buf, format"\n", session->field); \ } -@@ -1670,10 +1686,9 @@ iscsi_priv_session_attr(recovery_tmo, "%d"); +@@ -1678,10 +1694,9 @@ iscsi_priv_session_attr(recovery_tmo, "%d"); */ #define iscsi_host_attr_show(param) \ static ssize_t \ @@ -1067,7 +1069,7 @@ index 535e461..319599a 100644 struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \ return priv->iscsi_transport->get_host_param(shost, param, buf); \ } -@@ -1690,7 +1705,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); +@@ -1698,7 +1713,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); #define SETUP_PRIV_SESSION_RD_ATTR(field) \ do { \ @@ -1076,7 +1078,7 @@ index 535e461..319599a 100644 count++; \ } while (0) -@@ -1698,7 +1713,7 @@ do { \ +@@ -1706,7 +1721,7 @@ do { \ #define SETUP_SESSION_RD_ATTR(field, param_flag) \ do { \ if (tt->param_mask & param_flag) { \ @@ -1085,7 +1087,7 @@ index 535e461..319599a 100644 count++; \ } \ } while (0) -@@ -1706,7 +1721,7 @@ do { \ +@@ -1714,7 +1729,7 @@ do { \ #define SETUP_CONN_RD_ATTR(field, param_flag) \ do { \ if (tt->param_mask & param_flag) { \ @@ -1094,7 +1096,7 @@ index 535e461..319599a 100644 count++; \ } \ } while (0) -@@ -1714,7 +1729,7 @@ do { \ +@@ -1722,7 +1737,7 @@ do { \ #define SETUP_HOST_RD_ATTR(field, param_flag) \ do { \ if (tt->host_param_mask & param_flag) { \ @@ -1103,7 +1105,7 @@ index 535e461..319599a 100644 count++; \ } \ } while (0) -@@ -1803,19 +1818,21 @@ iscsi_register_transport(struct iscsi_transport *tt) +@@ -1811,19 +1826,21 @@ iscsi_register_transport(struct iscsi_transport *tt) INIT_LIST_HEAD(&priv->list); priv->daemon_pid = -1; priv->iscsi_transport = tt; @@ -1130,7 +1132,7 @@ index 535e461..319599a 100644 /* host parameters */ priv->t.host_attrs.ac.attrs = &priv->host_attrs[0]; -@@ -1894,9 +1911,8 @@ iscsi_register_transport(struct iscsi_transport *tt) +@@ -1902,9 +1919,8 @@ iscsi_register_transport(struct iscsi_transport *tt) printk(KERN_NOTICE "iscsi: registered transport (%s)\n", tt->name); return &priv->t; @@ -1142,7 +1144,7 @@ index 535e461..319599a 100644 free_priv: kfree(priv); return NULL; -@@ -1923,8 +1939,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) +@@ -1931,8 +1947,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) transport_container_unregister(&priv->session_cont); transport_container_unregister(&priv->t.host_attrs); @@ -1153,7 +1155,7 @@ index 535e461..319599a 100644 mutex_unlock(&rx_queue_mutex); return 0; -@@ -1944,13 +1960,14 @@ static __init int iscsi_transport_init(void) +@@ -1952,13 +1968,14 @@ static __init int iscsi_transport_init(void) if (err) return err; @@ -1170,7 +1172,7 @@ index 535e461..319599a 100644 err = transport_class_register(&iscsi_connection_class); if (err) -@@ -1981,8 +1998,10 @@ unregister_conn_class: +@@ -1989,8 +2006,10 @@ unregister_conn_class: transport_class_unregister(&iscsi_connection_class); unregister_host_class: transport_class_unregister(&iscsi_host_class); @@ -1181,7 +1183,7 @@ index 535e461..319599a 100644 unregister_transport_class: class_unregister(&iscsi_transport_class); return err; -@@ -1995,7 +2014,9 @@ static void __exit iscsi_transport_exit(void) +@@ -2003,7 +2022,9 @@ static void __exit iscsi_transport_exit(void) transport_class_unregister(&iscsi_connection_class); transport_class_unregister(&iscsi_session_class); transport_class_unregister(&iscsi_host_class); @@ -1192,9 +1194,9 @@ index 535e461..319599a 100644 } diff --git a/scsi_transport_iscsi.h b/scsi_transport_iscsi.h -index b7652e3..03a8a2b 100644 +index b65c96a..15b1f0e 100644 --- a/scsi_transport_iscsi.h -+++ b//scsi_transport_iscsi.h ++++ b/scsi_transport_iscsi.h @@ -25,9 +25,14 @@ #include diff --git a/kernel/2.6.20-21_compat.patch b/kernel/2.6.20-21_compat.patch index 2006bf8..366206e 100644 --- a/kernel/2.6.20-21_compat.patch +++ b/kernel/2.6.20-21_compat.patch @@ -1,5 +1,5 @@ diff --git a/iscsi_tcp.c b/iscsi_tcp.c -index 908b541..dfd8e31 100644 +index d074146..4a01066 100644 --- a/iscsi_tcp.c +++ b/iscsi_tcp.c @@ -426,6 +426,17 @@ iscsi_segment_seek_sg(struct iscsi_segment *segment, @@ -20,25 +20,16 @@ index 908b541..dfd8e31 100644 __iscsi_segment_init(segment, size, done, hash); for_each_sg(sg_list, sg, sg_count, i) { debug_scsi("sg %d, len %u offset %u\n", i, sg->length, -@@ -536,7 +547,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) - struct iscsi_session *session = conn->session; - struct scsi_cmnd *sc = task->sc; +@@ -534,7 +545,7 @@ iscsi_data_in(struct iscsi_conn *conn, struct iscsi_task *task) + struct iscsi_tcp_task *tcp_task = task->dd_data; + struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)tcp_conn->in.hdr; int datasn = be32_to_cpu(rhdr->datasn); -- unsigned total_in_length = scsi_in(sc)->length; -+ unsigned total_in_length = scsi_bufflen(sc); +- unsigned total_in_length = scsi_in(task->sc)->length; ++ unsigned total_in_length = scsi_bufflen(task->sc); - iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); + iscsi_update_cmdsn(conn->session, (struct iscsi_nopin*)rhdr); if (tcp_conn->in.datalen == 0) -@@ -568,7 +579,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) - if (res_count > 0 && - (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || - res_count <= total_in_length)) -- scsi_in(sc)->resid = res_count; -+ scsi_set_resid(sc, res_count); - else - sc->result = (DID_BAD_TARGET << 16) | - rhdr->cmd_status; -@@ -679,11 +690,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) +@@ -660,11 +671,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) r2t->data_length, session->max_burst); r2t->data_offset = be32_to_cpu(rhdr->data_offset); @@ -52,7 +43,7 @@ index 908b541..dfd8e31 100644 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); return ISCSI_ERR_DATALEN; -@@ -783,7 +794,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) +@@ -764,7 +775,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) if (tcp_conn->in.datalen) { struct iscsi_tcp_task *tcp_task = task->dd_data; struct hash_desc *rx_hash = NULL; @@ -60,7 +51,7 @@ index 908b541..dfd8e31 100644 /* * Setup copy of Data-In into the Scsi_Cmnd -@@ -801,8 +811,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) +@@ -782,8 +792,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) tcp_task->data_offset, tcp_conn->in.datalen); rc = iscsi_segment_seek_sg(&tcp_conn->in.segment, @@ -71,7 +62,7 @@ index 908b541..dfd8e31 100644 tcp_task->data_offset, tcp_conn->in.datalen, iscsi_tcp_process_data_in, -@@ -1369,8 +1379,8 @@ iscsi_tcp_task_init(struct iscsi_task *task) +@@ -1352,8 +1362,8 @@ iscsi_tcp_task_init(struct iscsi_task *task) return 0; /* If we have immediate data, attach a payload */ @@ -82,7 +73,7 @@ index 908b541..dfd8e31 100644 0, task->imm_count); if (err) return err; -@@ -1393,7 +1403,6 @@ iscsi_tcp_task_xmit(struct iscsi_task *task) +@@ -1376,7 +1386,6 @@ iscsi_tcp_task_xmit(struct iscsi_task *task) struct iscsi_conn *conn = task->conn; struct iscsi_tcp_task *tcp_task = task->dd_data; struct scsi_cmnd *sc = task->sc; @@ -90,7 +81,7 @@ index 908b541..dfd8e31 100644 int rc = 0; flush: -@@ -1413,7 +1422,6 @@ flush: +@@ -1396,7 +1405,6 @@ flush: if (sc->sc_data_direction != DMA_TO_DEVICE) return 0; @@ -98,7 +89,7 @@ index 908b541..dfd8e31 100644 if (task->unsol_count != 0) { struct iscsi_data *hdr = &tcp_task->unsol_dtask.hdr; -@@ -1428,8 +1436,8 @@ flush: +@@ -1411,8 +1419,8 @@ flush: task->itt, tcp_task->sent, task->data_count); iscsi_tcp_send_hdr_prep(conn, hdr, sizeof(*hdr)); @@ -109,7 +100,7 @@ index 908b541..dfd8e31 100644 task->data_count); if (rc) goto fail; -@@ -1475,8 +1483,8 @@ flush: +@@ -1458,8 +1466,8 @@ flush: iscsi_tcp_send_hdr_prep(conn, &r2t->dtask.hdr, sizeof(struct iscsi_hdr)); @@ -120,7 +111,7 @@ index 908b541..dfd8e31 100644 r2t->data_offset + r2t->sent, r2t->data_count); if (rc) -@@ -1864,7 +1872,11 @@ iscsi_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, +@@ -1847,7 +1855,11 @@ iscsi_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, shost->max_lun = iscsi_max_lun; shost->max_id = 0; shost->max_channel = 0; @@ -132,7 +123,7 @@ index 908b541..dfd8e31 100644 if (iscsi_host_add(shost, NULL)) goto free_host; -@@ -1917,6 +1929,9 @@ static int iscsi_tcp_slave_configure(struct scsi_device *sdev) +@@ -1900,6 +1912,9 @@ static int iscsi_tcp_slave_configure(struct scsi_device *sdev) } static struct scsi_host_template iscsi_sht = { @@ -156,7 +147,7 @@ index 68423e8..1796c96 100644 struct socket; struct iscsi_tcp_conn; diff --git a/libiscsi.c b/libiscsi.c -index e45476b..60f7a5e 100644 +index f3b845f..80da87f 100644 --- a/libiscsi.c +++ b/libiscsi.c @@ -187,7 +187,7 @@ static int iscsi_prep_bidi_ahs(struct iscsi_task *task) @@ -195,8 +186,8 @@ index e45476b..60f7a5e 100644 session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1); return 0; } -@@ -412,12 +412,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task, - return; +@@ -407,12 +407,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task, + conn->session->tt->cleanup_task(conn, task); sc->result = err; - if (!scsi_bidi_cmnd(sc)) @@ -209,7 +200,7 @@ index e45476b..60f7a5e 100644 if (conn->task == task) conn->task = NULL; -@@ -592,7 +587,7 @@ invalid_datalen: +@@ -587,7 +582,7 @@ invalid_datalen: goto out; } @@ -218,7 +209,7 @@ index e45476b..60f7a5e 100644 if (datalen < senselen) goto invalid_datalen; -@@ -608,8 +603,8 @@ invalid_datalen: +@@ -603,8 +598,8 @@ invalid_datalen: if (scsi_bidi_cmnd(sc) && res_count > 0 && (rhdr->flags & ISCSI_FLAG_CMD_BIDI_OVERFLOW || @@ -229,7 +220,18 @@ index e45476b..60f7a5e 100644 else sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; } -@@ -1273,12 +1268,7 @@ reject: +@@ -653,8 +648,8 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + + if (res_count > 0 && + (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || +- res_count <= scsi_in(sc)->length)) +- scsi_in(sc)->resid = res_count; ++ res_count <= scsi_bufflen(sc))) ++ scsi_set_resid(sc, res_count); + else + sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; + } +@@ -1297,12 +1292,7 @@ reject: fault: spin_unlock(&session->lock); debug_scsi("iscsi: cmd 0x%x is not queued (%d)\n", sc->cmnd[0], reason); @@ -509,7 +511,7 @@ index 0000000..8bd48d1 + +#endif diff --git a/scsi_transport_iscsi.c b/scsi_transport_iscsi.c -index 535e461..65f36a3 100644 +index 852b016..f4270b2 100644 --- a/scsi_transport_iscsi.c +++ b/scsi_transport_iscsi.c @@ -41,13 +41,13 @@ struct iscsi_internal { @@ -598,8 +600,8 @@ index 535e461..65f36a3 100644 /* * iSCSI endpoint attrs */ -@@ -229,9 +228,10 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) - return iscsi_dev_to_endpoint(dev); +@@ -237,9 +236,10 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) + return ep; } EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint); +#endif @@ -610,7 +612,7 @@ index 535e461..65f36a3 100644 { struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data; -@@ -250,7 +250,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, +@@ -258,7 +258,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, } static int iscsi_remove_host(struct transport_container *tc, struct device *dev, @@ -619,7 +621,7 @@ index 535e461..65f36a3 100644 { struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data; -@@ -1300,6 +1300,8 @@ static int +@@ -1308,6 +1308,8 @@ static int iscsi_if_transport_ep(struct iscsi_transport *transport, struct iscsi_uevent *ev, int msg_type) { @@ -628,7 +630,7 @@ index 535e461..65f36a3 100644 struct iscsi_endpoint *ep; struct sockaddr *dst_addr; int rc = 0; -@@ -1340,6 +1342,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, +@@ -1348,6 +1350,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, break; } return rc; @@ -637,7 +639,7 @@ index 535e461..65f36a3 100644 } static int -@@ -1421,6 +1425,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1429,6 +1433,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ev->u.c_session.queue_depth); break; case ISCSI_UEVENT_CREATE_BOUND_SESSION: @@ -647,7 +649,7 @@ index 535e461..65f36a3 100644 ep = iscsi_lookup_endpoint(ev->u.c_bound_session.ep_handle); if (!ep) { err = -EINVAL; -@@ -1432,6 +1439,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1440,6 +1447,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ev->u.c_bound_session.cmds_max, ev->u.c_bound_session.queue_depth); break; @@ -655,7 +657,7 @@ index 535e461..65f36a3 100644 case ISCSI_UEVENT_DESTROY_SESSION: session = iscsi_session_lookup(ev->u.d_session.sid); if (session) -@@ -1514,55 +1522,70 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1522,55 +1530,70 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) } /* @@ -762,7 +764,7 @@ index 535e461..65f36a3 100644 __ATTR(_name,_mode,_show,_store) /* -@@ -1570,10 +1593,9 @@ struct device_attribute dev_attr_##_prefix##_##_name = \ +@@ -1578,10 +1601,9 @@ struct device_attribute dev_attr_##_prefix##_##_name = \ */ #define iscsi_conn_attr_show(param) \ static ssize_t \ @@ -775,7 +777,7 @@ index 535e461..65f36a3 100644 struct iscsi_transport *t = conn->transport; \ return t->get_conn_param(conn, param, buf); \ } -@@ -1597,16 +1619,17 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); +@@ -1605,16 +1627,17 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); iscsi_conn_attr(ping_tmo, ISCSI_PARAM_PING_TMO); iscsi_conn_attr(recv_tmo, ISCSI_PARAM_RECV_TMO); @@ -797,7 +799,7 @@ index 535e461..65f36a3 100644 struct iscsi_transport *t = session->transport; \ \ if (perm && !capable(CAP_SYS_ADMIN)) \ -@@ -1640,10 +1663,9 @@ iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); +@@ -1648,10 +1671,9 @@ iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0) static ssize_t @@ -810,7 +812,7 @@ index 535e461..65f36a3 100644 return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); } static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, -@@ -1651,11 +1673,9 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, +@@ -1659,11 +1681,9 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, #define iscsi_priv_session_attr_show(field, format) \ static ssize_t \ @@ -824,7 +826,7 @@ index 535e461..65f36a3 100644 return sprintf(buf, format"\n", session->field); \ } -@@ -1670,10 +1690,9 @@ iscsi_priv_session_attr(recovery_tmo, "%d"); +@@ -1678,10 +1698,9 @@ iscsi_priv_session_attr(recovery_tmo, "%d"); */ #define iscsi_host_attr_show(param) \ static ssize_t \ @@ -837,7 +839,7 @@ index 535e461..65f36a3 100644 struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \ return priv->iscsi_transport->get_host_param(shost, param, buf); \ } -@@ -1690,7 +1709,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); +@@ -1698,7 +1717,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); #define SETUP_PRIV_SESSION_RD_ATTR(field) \ do { \ @@ -846,7 +848,7 @@ index 535e461..65f36a3 100644 count++; \ } while (0) -@@ -1698,7 +1717,7 @@ do { \ +@@ -1706,7 +1725,7 @@ do { \ #define SETUP_SESSION_RD_ATTR(field, param_flag) \ do { \ if (tt->param_mask & param_flag) { \ @@ -855,7 +857,7 @@ index 535e461..65f36a3 100644 count++; \ } \ } while (0) -@@ -1706,7 +1725,7 @@ do { \ +@@ -1714,7 +1733,7 @@ do { \ #define SETUP_CONN_RD_ATTR(field, param_flag) \ do { \ if (tt->param_mask & param_flag) { \ @@ -864,7 +866,7 @@ index 535e461..65f36a3 100644 count++; \ } \ } while (0) -@@ -1714,7 +1733,7 @@ do { \ +@@ -1722,7 +1741,7 @@ do { \ #define SETUP_HOST_RD_ATTR(field, param_flag) \ do { \ if (tt->host_param_mask & param_flag) { \ @@ -873,7 +875,7 @@ index 535e461..65f36a3 100644 count++; \ } \ } while (0) -@@ -1807,15 +1826,15 @@ iscsi_register_transport(struct iscsi_transport *tt) +@@ -1815,15 +1834,15 @@ iscsi_register_transport(struct iscsi_transport *tt) if (!(tt->caps & CAP_DATA_PATH_OFFLOAD)) priv->t.create_work_queue = 1; @@ -894,7 +896,7 @@ index 535e461..65f36a3 100644 /* host parameters */ priv->t.host_attrs.ac.attrs = &priv->host_attrs[0]; -@@ -1894,9 +1913,8 @@ iscsi_register_transport(struct iscsi_transport *tt) +@@ -1902,9 +1921,8 @@ iscsi_register_transport(struct iscsi_transport *tt) printk(KERN_NOTICE "iscsi: registered transport (%s)\n", tt->name); return &priv->t; @@ -906,7 +908,7 @@ index 535e461..65f36a3 100644 free_priv: kfree(priv); return NULL; -@@ -1923,8 +1941,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) +@@ -1931,8 +1949,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) transport_container_unregister(&priv->session_cont); transport_container_unregister(&priv->t.host_attrs); @@ -917,7 +919,7 @@ index 535e461..65f36a3 100644 mutex_unlock(&rx_queue_mutex); return 0; -@@ -1944,13 +1962,14 @@ static __init int iscsi_transport_init(void) +@@ -1952,13 +1970,14 @@ static __init int iscsi_transport_init(void) if (err) return err; @@ -934,7 +936,7 @@ index 535e461..65f36a3 100644 err = transport_class_register(&iscsi_connection_class); if (err) -@@ -1981,8 +2000,10 @@ unregister_conn_class: +@@ -1989,8 +2008,10 @@ unregister_conn_class: transport_class_unregister(&iscsi_connection_class); unregister_host_class: transport_class_unregister(&iscsi_host_class); @@ -945,7 +947,7 @@ index 535e461..65f36a3 100644 unregister_transport_class: class_unregister(&iscsi_transport_class); return err; -@@ -1995,7 +2016,9 @@ static void __exit iscsi_transport_exit(void) +@@ -2003,7 +2024,9 @@ static void __exit iscsi_transport_exit(void) transport_class_unregister(&iscsi_connection_class); transport_class_unregister(&iscsi_session_class); transport_class_unregister(&iscsi_host_class); @@ -956,7 +958,7 @@ index 535e461..65f36a3 100644 } diff --git a/scsi_transport_iscsi.h b/scsi_transport_iscsi.h -index b7652e3..4b6dc5c 100644 +index b65c96a..9919c0d 100644 --- a/scsi_transport_iscsi.h +++ b/scsi_transport_iscsi.h @@ -28,6 +28,8 @@ diff --git a/kernel/2.6.24_compat.patch b/kernel/2.6.24_compat.patch index 909ea56..f1b7cae 100644 --- a/kernel/2.6.24_compat.patch +++ b/kernel/2.6.24_compat.patch @@ -1,5 +1,5 @@ diff --git a/iscsi_tcp.c b/iscsi_tcp.c -index 908b541..dfd8e31 100644 +index d074146..4a01066 100644 --- a/iscsi_tcp.c +++ b/iscsi_tcp.c @@ -426,6 +426,17 @@ iscsi_segment_seek_sg(struct iscsi_segment *segment, @@ -20,25 +20,16 @@ index 908b541..dfd8e31 100644 __iscsi_segment_init(segment, size, done, hash); for_each_sg(sg_list, sg, sg_count, i) { debug_scsi("sg %d, len %u offset %u\n", i, sg->length, -@@ -536,7 +547,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) - struct iscsi_session *session = conn->session; - struct scsi_cmnd *sc = task->sc; +@@ -534,7 +545,7 @@ iscsi_data_in(struct iscsi_conn *conn, struct iscsi_task *task) + struct iscsi_tcp_task *tcp_task = task->dd_data; + struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)tcp_conn->in.hdr; int datasn = be32_to_cpu(rhdr->datasn); -- unsigned total_in_length = scsi_in(sc)->length; -+ unsigned total_in_length = scsi_bufflen(sc); +- unsigned total_in_length = scsi_in(task->sc)->length; ++ unsigned total_in_length = scsi_bufflen(task->sc); - iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); + iscsi_update_cmdsn(conn->session, (struct iscsi_nopin*)rhdr); if (tcp_conn->in.datalen == 0) -@@ -568,7 +579,7 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) - if (res_count > 0 && - (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || - res_count <= total_in_length)) -- scsi_in(sc)->resid = res_count; -+ scsi_set_resid(sc, res_count); - else - sc->result = (DID_BAD_TARGET << 16) | - rhdr->cmd_status; -@@ -679,11 +690,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) +@@ -660,11 +671,11 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_task *task) r2t->data_length, session->max_burst); r2t->data_offset = be32_to_cpu(rhdr->data_offset); @@ -52,7 +43,7 @@ index 908b541..dfd8e31 100644 __kfifo_put(tcp_task->r2tpool.queue, (void*)&r2t, sizeof(void*)); return ISCSI_ERR_DATALEN; -@@ -783,7 +794,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) +@@ -764,7 +775,6 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) if (tcp_conn->in.datalen) { struct iscsi_tcp_task *tcp_task = task->dd_data; struct hash_desc *rx_hash = NULL; @@ -60,7 +51,7 @@ index 908b541..dfd8e31 100644 /* * Setup copy of Data-In into the Scsi_Cmnd -@@ -801,8 +811,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) +@@ -782,8 +792,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) tcp_task->data_offset, tcp_conn->in.datalen); rc = iscsi_segment_seek_sg(&tcp_conn->in.segment, @@ -71,7 +62,7 @@ index 908b541..dfd8e31 100644 tcp_task->data_offset, tcp_conn->in.datalen, iscsi_tcp_process_data_in, -@@ -1369,8 +1379,8 @@ iscsi_tcp_task_init(struct iscsi_task *task) +@@ -1352,8 +1362,8 @@ iscsi_tcp_task_init(struct iscsi_task *task) return 0; /* If we have immediate data, attach a payload */ @@ -82,7 +73,7 @@ index 908b541..dfd8e31 100644 0, task->imm_count); if (err) return err; -@@ -1393,7 +1403,6 @@ iscsi_tcp_task_xmit(struct iscsi_task *task) +@@ -1376,7 +1386,6 @@ iscsi_tcp_task_xmit(struct iscsi_task *task) struct iscsi_conn *conn = task->conn; struct iscsi_tcp_task *tcp_task = task->dd_data; struct scsi_cmnd *sc = task->sc; @@ -90,7 +81,7 @@ index 908b541..dfd8e31 100644 int rc = 0; flush: -@@ -1413,7 +1422,6 @@ flush: +@@ -1396,7 +1405,6 @@ flush: if (sc->sc_data_direction != DMA_TO_DEVICE) return 0; @@ -98,7 +89,7 @@ index 908b541..dfd8e31 100644 if (task->unsol_count != 0) { struct iscsi_data *hdr = &tcp_task->unsol_dtask.hdr; -@@ -1428,8 +1436,8 @@ flush: +@@ -1411,8 +1419,8 @@ flush: task->itt, tcp_task->sent, task->data_count); iscsi_tcp_send_hdr_prep(conn, hdr, sizeof(*hdr)); @@ -109,7 +100,7 @@ index 908b541..dfd8e31 100644 task->data_count); if (rc) goto fail; -@@ -1475,8 +1483,8 @@ flush: +@@ -1458,8 +1466,8 @@ flush: iscsi_tcp_send_hdr_prep(conn, &r2t->dtask.hdr, sizeof(struct iscsi_hdr)); @@ -120,7 +111,7 @@ index 908b541..dfd8e31 100644 r2t->data_offset + r2t->sent, r2t->data_count); if (rc) -@@ -1864,7 +1872,11 @@ iscsi_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, +@@ -1847,7 +1855,11 @@ iscsi_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, shost->max_lun = iscsi_max_lun; shost->max_id = 0; shost->max_channel = 0; @@ -132,7 +123,7 @@ index 908b541..dfd8e31 100644 if (iscsi_host_add(shost, NULL)) goto free_host; -@@ -1917,6 +1929,9 @@ static int iscsi_tcp_slave_configure(struct scsi_device *sdev) +@@ -1900,6 +1912,9 @@ static int iscsi_tcp_slave_configure(struct scsi_device *sdev) } static struct scsi_host_template iscsi_sht = { @@ -142,7 +133,7 @@ index 908b541..dfd8e31 100644 .module = THIS_MODULE, .name = "iSCSI Initiator over TCP/IP", .queuecommand = iscsi_queuecommand, -diff --git a/iscsi_tcp.h b//iscsi_tcp.h +diff --git a/iscsi_tcp.h b/iscsi_tcp.h index 68423e8..1796c96 100644 --- a/iscsi_tcp.h +++ b/iscsi_tcp.h @@ -156,7 +147,7 @@ index 68423e8..1796c96 100644 struct socket; struct iscsi_tcp_conn; diff --git a/libiscsi.c b/libiscsi.c -index e45476b..60f7a5e 100644 +index f3b845f..80da87f 100644 --- a/libiscsi.c +++ b/libiscsi.c @@ -187,7 +187,7 @@ static int iscsi_prep_bidi_ahs(struct iscsi_task *task) @@ -195,8 +186,8 @@ index e45476b..60f7a5e 100644 session->cmdsn, session->max_cmdsn - session->exp_cmdsn + 1); return 0; } -@@ -412,12 +412,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task, - return; +@@ -407,12 +407,7 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task, + conn->session->tt->cleanup_task(conn, task); sc->result = err; - if (!scsi_bidi_cmnd(sc)) @@ -209,7 +200,7 @@ index e45476b..60f7a5e 100644 if (conn->task == task) conn->task = NULL; -@@ -592,7 +587,7 @@ invalid_datalen: +@@ -587,7 +582,7 @@ invalid_datalen: goto out; } @@ -218,7 +209,7 @@ index e45476b..60f7a5e 100644 if (datalen < senselen) goto invalid_datalen; -@@ -608,8 +603,8 @@ invalid_datalen: +@@ -603,8 +598,8 @@ invalid_datalen: if (scsi_bidi_cmnd(sc) && res_count > 0 && (rhdr->flags & ISCSI_FLAG_CMD_BIDI_OVERFLOW || @@ -229,7 +220,18 @@ index e45476b..60f7a5e 100644 else sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; } -@@ -1273,12 +1268,7 @@ reject: +@@ -653,8 +648,8 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + + if (res_count > 0 && + (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || +- res_count <= scsi_in(sc)->length)) +- scsi_in(sc)->resid = res_count; ++ res_count <= scsi_bufflen(sc))) ++ scsi_set_resid(sc, res_count); + else + sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; + } +@@ -1297,12 +1292,7 @@ reject: fault: spin_unlock(&session->lock); debug_scsi("iscsi: cmd 0x%x is not queued (%d)\n", sc->cmnd[0], reason); @@ -509,7 +511,7 @@ index 0000000..8bd48d1 + +#endif diff --git a/scsi_transport_iscsi.c b/scsi_transport_iscsi.c -index 535e461..ce81324 100644 +index 852b016..28c4d9f 100644 --- a/scsi_transport_iscsi.c +++ b/scsi_transport_iscsi.c @@ -41,13 +41,13 @@ struct iscsi_internal { @@ -598,8 +600,8 @@ index 535e461..ce81324 100644 /* * iSCSI endpoint attrs */ -@@ -229,9 +228,10 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) - return iscsi_dev_to_endpoint(dev); +@@ -237,9 +236,10 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) + return ep; } EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint); +#endif @@ -610,7 +612,7 @@ index 535e461..ce81324 100644 { struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data; -@@ -250,7 +250,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, +@@ -258,7 +258,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, } static int iscsi_remove_host(struct transport_container *tc, struct device *dev, @@ -619,7 +621,7 @@ index 535e461..ce81324 100644 { struct Scsi_Host *shost = dev_to_shost(dev); struct iscsi_cls_host *ihost = shost->shost_data; -@@ -1300,6 +1300,8 @@ static int +@@ -1308,6 +1308,8 @@ static int iscsi_if_transport_ep(struct iscsi_transport *transport, struct iscsi_uevent *ev, int msg_type) { @@ -628,7 +630,7 @@ index 535e461..ce81324 100644 struct iscsi_endpoint *ep; struct sockaddr *dst_addr; int rc = 0; -@@ -1340,6 +1342,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, +@@ -1348,6 +1350,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, break; } return rc; @@ -637,7 +639,7 @@ index 535e461..ce81324 100644 } static int -@@ -1421,6 +1425,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1429,6 +1433,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ev->u.c_session.queue_depth); break; case ISCSI_UEVENT_CREATE_BOUND_SESSION: @@ -647,7 +649,7 @@ index 535e461..ce81324 100644 ep = iscsi_lookup_endpoint(ev->u.c_bound_session.ep_handle); if (!ep) { err = -EINVAL; -@@ -1432,6 +1439,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) +@@ -1440,6 +1447,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ev->u.c_bound_session.cmds_max, ev->u.c_bound_session.queue_depth); break; @@ -655,7 +657,7 @@ index 535e461..ce81324 100644 case ISCSI_UEVENT_DESTROY_SESSION: session = iscsi_session_lookup(ev->u.d_session.sid); if (session) -@@ -1561,8 +1569,11 @@ iscsi_if_rx(struct sk_buff *skb) +@@ -1569,8 +1577,11 @@ iscsi_if_rx(struct sk_buff *skb) mutex_unlock(&rx_queue_mutex); } @@ -668,7 +670,7 @@ index 535e461..ce81324 100644 __ATTR(_name,_mode,_show,_store) /* -@@ -1570,10 +1581,9 @@ struct device_attribute dev_attr_##_prefix##_##_name = \ +@@ -1578,10 +1589,9 @@ struct device_attribute dev_attr_##_prefix##_##_name = \ */ #define iscsi_conn_attr_show(param) \ static ssize_t \ @@ -681,7 +683,7 @@ index 535e461..ce81324 100644 struct iscsi_transport *t = conn->transport; \ return t->get_conn_param(conn, param, buf); \ } -@@ -1597,16 +1607,17 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); +@@ -1605,16 +1615,17 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); iscsi_conn_attr(ping_tmo, ISCSI_PARAM_PING_TMO); iscsi_conn_attr(recv_tmo, ISCSI_PARAM_RECV_TMO); @@ -703,7 +705,7 @@ index 535e461..ce81324 100644 struct iscsi_transport *t = session->transport; \ \ if (perm && !capable(CAP_SYS_ADMIN)) \ -@@ -1640,10 +1651,9 @@ iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); +@@ -1648,10 +1659,9 @@ iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0); iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0) static ssize_t @@ -716,7 +718,7 @@ index 535e461..ce81324 100644 return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); } static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, -@@ -1651,11 +1661,9 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, +@@ -1659,11 +1669,9 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, #define iscsi_priv_session_attr_show(field, format) \ static ssize_t \ @@ -730,7 +732,7 @@ index 535e461..ce81324 100644 return sprintf(buf, format"\n", session->field); \ } -@@ -1670,10 +1678,9 @@ iscsi_priv_session_attr(recovery_tmo, "%d"); +@@ -1678,10 +1686,9 @@ iscsi_priv_session_attr(recovery_tmo, "%d"); */ #define iscsi_host_attr_show(param) \ static ssize_t \ @@ -743,7 +745,7 @@ index 535e461..ce81324 100644 struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \ return priv->iscsi_transport->get_host_param(shost, param, buf); \ } -@@ -1690,7 +1697,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); +@@ -1698,7 +1705,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); #define SETUP_PRIV_SESSION_RD_ATTR(field) \ do { \ @@ -752,7 +754,7 @@ index 535e461..ce81324 100644 count++; \ } while (0) -@@ -1698,7 +1705,7 @@ do { \ +@@ -1706,7 +1713,7 @@ do { \ #define SETUP_SESSION_RD_ATTR(field, param_flag) \ do { \ if (tt->param_mask & param_flag) { \ @@ -761,7 +763,7 @@ index 535e461..ce81324 100644 count++; \ } \ } while (0) -@@ -1706,7 +1713,7 @@ do { \ +@@ -1714,7 +1721,7 @@ do { \ #define SETUP_CONN_RD_ATTR(field, param_flag) \ do { \ if (tt->param_mask & param_flag) { \ @@ -770,7 +772,7 @@ index 535e461..ce81324 100644 count++; \ } \ } while (0) -@@ -1714,7 +1721,7 @@ do { \ +@@ -1722,7 +1729,7 @@ do { \ #define SETUP_HOST_RD_ATTR(field, param_flag) \ do { \ if (tt->host_param_mask & param_flag) { \ @@ -779,7 +781,7 @@ index 535e461..ce81324 100644 count++; \ } \ } while (0) -@@ -1807,15 +1814,15 @@ iscsi_register_transport(struct iscsi_transport *tt) +@@ -1815,15 +1822,15 @@ iscsi_register_transport(struct iscsi_transport *tt) if (!(tt->caps & CAP_DATA_PATH_OFFLOAD)) priv->t.create_work_queue = 1; @@ -800,7 +802,7 @@ index 535e461..ce81324 100644 /* host parameters */ priv->t.host_attrs.ac.attrs = &priv->host_attrs[0]; -@@ -1894,9 +1901,8 @@ iscsi_register_transport(struct iscsi_transport *tt) +@@ -1902,9 +1909,8 @@ iscsi_register_transport(struct iscsi_transport *tt) printk(KERN_NOTICE "iscsi: registered transport (%s)\n", tt->name); return &priv->t; @@ -812,7 +814,7 @@ index 535e461..ce81324 100644 free_priv: kfree(priv); return NULL; -@@ -1923,8 +1929,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) +@@ -1931,8 +1937,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) transport_container_unregister(&priv->session_cont); transport_container_unregister(&priv->t.host_attrs); @@ -823,7 +825,7 @@ index 535e461..ce81324 100644 mutex_unlock(&rx_queue_mutex); return 0; -@@ -1944,13 +1950,14 @@ static __init int iscsi_transport_init(void) +@@ -1952,13 +1958,14 @@ static __init int iscsi_transport_init(void) if (err) return err; @@ -840,7 +842,7 @@ index 535e461..ce81324 100644 err = transport_class_register(&iscsi_connection_class); if (err) -@@ -1981,8 +1988,10 @@ unregister_conn_class: +@@ -1989,8 +1996,10 @@ unregister_conn_class: transport_class_unregister(&iscsi_connection_class); unregister_host_class: transport_class_unregister(&iscsi_host_class); @@ -851,7 +853,7 @@ index 535e461..ce81324 100644 unregister_transport_class: class_unregister(&iscsi_transport_class); return err; -@@ -1995,7 +2004,9 @@ static void __exit iscsi_transport_exit(void) +@@ -2003,7 +2012,9 @@ static void __exit iscsi_transport_exit(void) transport_class_unregister(&iscsi_connection_class); transport_class_unregister(&iscsi_session_class); transport_class_unregister(&iscsi_host_class); @@ -862,7 +864,7 @@ index 535e461..ce81324 100644 } diff --git a/scsi_transport_iscsi.h b/scsi_transport_iscsi.h -index b7652e3..4b6dc5c 100644 +index b65c96a..9919c0d 100644 --- a/scsi_transport_iscsi.h +++ b/scsi_transport_iscsi.h @@ -28,6 +28,8 @@ diff --git a/kernel/iscsi_tcp.c b/kernel/iscsi_tcp.c index 908b541..d074146 100644 --- a/kernel/iscsi_tcp.c +++ b/kernel/iscsi_tcp.c @@ -523,22 +523,20 @@ iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task) } /** - * iscsi_data_rsp - SCSI Data-In Response processing + * iscsi_data_in - SCSI Data-In Response processing * @conn: iscsi connection * @task: scsi command task **/ static int -iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) +iscsi_data_in(struct iscsi_conn *conn, struct iscsi_task *task) { struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_tcp_task *tcp_task = task->dd_data; struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)tcp_conn->in.hdr; - struct iscsi_session *session = conn->session; - struct scsi_cmnd *sc = task->sc; int datasn = be32_to_cpu(rhdr->datasn); - unsigned total_in_length = scsi_in(sc)->length; + unsigned total_in_length = scsi_in(task->sc)->length; - iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); + iscsi_update_cmdsn(conn->session, (struct iscsi_nopin*)rhdr); if (tcp_conn->in.datalen == 0) return 0; @@ -558,23 +556,6 @@ iscsi_data_rsp(struct iscsi_conn *conn, struct iscsi_task *task) return ISCSI_ERR_DATA_OFFSET; } - if (rhdr->flags & ISCSI_FLAG_DATA_STATUS) { - sc->result = (DID_OK << 16) | rhdr->cmd_status; - conn->exp_statsn = be32_to_cpu(rhdr->statsn) + 1; - if (rhdr->flags & (ISCSI_FLAG_DATA_UNDERFLOW | - ISCSI_FLAG_DATA_OVERFLOW)) { - int res_count = be32_to_cpu(rhdr->residual_count); - - if (res_count > 0 && - (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || - res_count <= total_in_length)) - scsi_in(sc)->resid = res_count; - else - sc->result = (DID_BAD_TARGET << 16) | - rhdr->cmd_status; - } - } - conn->datain_pdus_cnt++; return 0; } @@ -774,7 +755,7 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) if (!task) rc = ISCSI_ERR_BAD_ITT; else - rc = iscsi_data_rsp(conn, task); + rc = iscsi_data_in(conn, task); if (rc) { spin_unlock(&conn->session->lock); break; @@ -998,7 +979,7 @@ iscsi_tcp_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, error: debug_tcp("Error receiving PDU, errno=%d\n", rc); - iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); + iscsi_conn_failure(conn, rc); return 0; } @@ -1117,8 +1098,10 @@ iscsi_xmit(struct iscsi_conn *conn) while (1) { rc = iscsi_tcp_xmit_segment(tcp_conn, segment); - if (rc < 0) + if (rc < 0) { + rc = ISCSI_ERR_XMIT_FAILED; goto error; + } if (rc == 0) break; @@ -1127,7 +1110,7 @@ iscsi_xmit(struct iscsi_conn *conn) if (segment->total_copied >= segment->total_size) { if (segment->done != NULL) { rc = segment->done(tcp_conn, segment); - if (rc < 0) + if (rc != 0) goto error; } } @@ -1142,8 +1125,8 @@ error: /* Transmit error. We could initiate error recovery * here. */ debug_tcp("Error sending PDU, errno=%d\n", rc); - iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); - return rc; + iscsi_conn_failure(conn, rc); + return -EIO; } /** diff --git a/kernel/libiscsi.c b/kernel/libiscsi.c index dfeaed3..f3b845f 100644 --- a/kernel/libiscsi.c +++ b/kernel/libiscsi.c @@ -405,11 +405,6 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_task *task, conn->session->queued_cmdsn--; else conn->session->tt->cleanup_task(conn, task); - /* - * Check if cleanup_task dropped the lock and the command completed, - */ - if (!task->sc) - return; sc->result = err; if (!scsi_bidi_cmnd(sc)) @@ -634,6 +629,40 @@ out: __iscsi_put_task(task); } +/** + * iscsi_data_in_rsp - SCSI Data-In Response processing + * @conn: iscsi connection + * @hdr: iscsi pdu + * @task: scsi command task + **/ +static void +iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + struct iscsi_task *task) +{ + struct iscsi_data_rsp *rhdr = (struct iscsi_data_rsp *)hdr; + struct scsi_cmnd *sc = task->sc; + + if (!(rhdr->flags & ISCSI_FLAG_DATA_STATUS)) + return; + + sc->result = (DID_OK << 16) | rhdr->cmd_status; + conn->exp_statsn = be32_to_cpu(rhdr->statsn) + 1; + if (rhdr->flags & (ISCSI_FLAG_DATA_UNDERFLOW | + ISCSI_FLAG_DATA_OVERFLOW)) { + int res_count = be32_to_cpu(rhdr->residual_count); + + if (res_count > 0 && + (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW || + res_count <= scsi_in(sc)->length)) + scsi_in(sc)->resid = res_count; + else + sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status; + } + + conn->scsirsp_pdus_cnt++; + __iscsi_put_task(task); +} + static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) { struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr; @@ -819,12 +848,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, iscsi_scsi_cmd_rsp(conn, hdr, task, data, datalen); break; case ISCSI_OP_SCSI_DATA_IN: - if (hdr->flags & ISCSI_FLAG_DATA_STATUS) { - conn->scsirsp_pdus_cnt++; - iscsi_update_cmdsn(session, - (struct iscsi_nopin*) hdr); - __iscsi_put_task(task); - } + iscsi_data_in_rsp(conn, hdr, task); break; case ISCSI_OP_LOGOUT_RSP: iscsi_update_cmdsn(session, (struct iscsi_nopin*)hdr); @@ -1769,10 +1793,10 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) iscsi_suspend_tx(conn); - spin_lock(&session->lock); + spin_lock_bh(&session->lock); fail_all_commands(conn, sc->device->lun, DID_ERROR); conn->tmf_state = TMF_INITIAL; - spin_unlock(&session->lock); + spin_unlock_bh(&session->lock); iscsi_start_tx(conn); goto done; diff --git a/kernel/scsi_transport_iscsi.c b/kernel/scsi_transport_iscsi.c index 7dfb7da..852b016 100644 --- a/kernel/scsi_transport_iscsi.c +++ b/kernel/scsi_transport_iscsi.c @@ -138,7 +138,7 @@ static ssize_t show_ep_handle(struct device *dev, struct device_attribute *attr, char *buf) { struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); - return sprintf(buf, "%u\n", ep->id); + return sprintf(buf, "%llu\n", (unsigned long long) ep->id); } static ISCSI_ATTR(ep, handle, S_IRUGO, show_ep_handle, NULL); @@ -156,7 +156,7 @@ static struct attribute_group iscsi_endpoint_group = { static int iscsi_match_epid(struct device *dev, void *data) { struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); - unsigned int *epid = (unsigned int *) data; + uint64_t *epid = (uint64_t *) data; return *epid == ep->id; } @@ -166,7 +166,7 @@ iscsi_create_endpoint(int dd_size) { struct device *dev; struct iscsi_endpoint *ep; - unsigned int id; + uint64_t id; int err; for (id = 1; id < ISCSI_MAX_EPID; id++) { @@ -187,7 +187,8 @@ iscsi_create_endpoint(int dd_size) ep->id = id; ep->dev.class = &iscsi_endpoint_class; - snprintf(ep->dev.bus_id, BUS_ID_SIZE, "ep-%u", id); + snprintf(ep->dev.bus_id, BUS_ID_SIZE, "ep-%llu", + (unsigned long long) id); err = device_register(&ep->dev); if (err) goto free_ep; diff --git a/kernel/scsi_transport_iscsi.h b/kernel/scsi_transport_iscsi.h index 7013828..b65c96a 100644 --- a/kernel/scsi_transport_iscsi.h +++ b/kernel/scsi_transport_iscsi.h @@ -207,7 +207,7 @@ extern void iscsi_host_for_each_session(struct Scsi_Host *shost, struct iscsi_endpoint { void *dd_data; /* LLD private data */ struct device dev; - unsigned int id; + uint64_t id; }; /* diff --git a/usr/initiator.c b/usr/initiator.c index b85416e..8bd7a90 100644 --- a/usr/initiator.c +++ b/usr/initiator.c @@ -995,7 +995,15 @@ static void session_conn_error(void *data) "state (%d)", session->id, conn->id, error, conn->state); iscsi_conn_context_put(conn_context); - __conn_error_handle(session, conn); + + switch (error) { + case ISCSI_ERR_INVALID_HOST: + if (session_conn_shutdown(conn, NULL, MGMT_IPC_OK)) + log_error("BUG: Could not shutdown session."); + break; + default: + __conn_error_handle(session, conn); + } } static void iscsi_login_timedout(void *data)