Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull SCSI target fixes from Nicholas Bellinger:
"This series addresses a number of outstanding issues wrt to active I/O
shutdown using iser-target. This includes:

- Fix a long standing tpg_state bug where a tpg could be referenced
during explicit shutdown (v3.1+ stable)
- Use list_del_init for iscsi_cmd->i_conn_node so list_empty checks
work as expected (v3.10+ stable)
- Fix a isert_conn->state related hung task bug + ensure outstanding
I/O completes during session shutdown. (v3.10+ stable)
- Fix isert_conn->post_send_buf_count accounting for RDMA READ/WRITEs
(v3.10+ stable)
- Ignore FRWR completions during active I/O shutdown (v3.12+ stable)
- Fix command leakage for interrupt coalescing during active I/O
shutdown (v3.13+ stable)

Also included is another DIF emulation fix from Sagi specific to
v3.14-rc code"

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
Target/sbc: Fix sbc_copy_prot for offset scatters
iser-target: Fix command leak for tx_desc->comp_llnode_batch
iser-target: Ignore completions for FRWRs in isert_cq_tx_work
iser-target: Fix post_send_buf_count for RDMA READ/WRITE
iscsi/iser-target: Fix isert_conn->state hung shutdown issues
iscsi/iser-target: Use list_del_init for ->i_conn_node
iscsi-target: Fix iscsit_get_tpg_from_np tpg_state bug

+150 -102
+109 -73
drivers/infiniband/ulp/isert/ib_isert.c
··· 492 492 isert_conn->state = ISER_CONN_INIT; 493 493 INIT_LIST_HEAD(&isert_conn->conn_accept_node); 494 494 init_completion(&isert_conn->conn_login_comp); 495 - init_waitqueue_head(&isert_conn->conn_wait); 496 - init_waitqueue_head(&isert_conn->conn_wait_comp_err); 495 + init_completion(&isert_conn->conn_wait); 496 + init_completion(&isert_conn->conn_wait_comp_err); 497 497 kref_init(&isert_conn->conn_kref); 498 498 kref_get(&isert_conn->conn_kref); 499 499 mutex_init(&isert_conn->conn_mutex); 500 - mutex_init(&isert_conn->conn_comp_mutex); 501 500 spin_lock_init(&isert_conn->conn_lock); 502 501 503 502 cma_id->context = isert_conn; ··· 687 688 688 689 pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); 689 690 mutex_lock(&isert_conn->conn_mutex); 690 - isert_conn->state = ISER_CONN_DOWN; 691 + if (isert_conn->state == ISER_CONN_UP) 692 + isert_conn->state = ISER_CONN_TERMINATING; 691 693 692 694 if (isert_conn->post_recv_buf_count == 0 && 693 695 atomic_read(&isert_conn->post_send_buf_count) == 0) { 694 - pr_debug("Calling wake_up(&isert_conn->conn_wait);\n"); 695 696 mutex_unlock(&isert_conn->conn_mutex); 696 697 goto wake_up; 697 698 } ··· 711 712 mutex_unlock(&isert_conn->conn_mutex); 712 713 713 714 wake_up: 714 - wake_up(&isert_conn->conn_wait); 715 + complete(&isert_conn->conn_wait); 715 716 isert_put_conn(isert_conn); 716 717 } 717 718 ··· 887 888 * Coalesce send completion interrupts by only setting IB_SEND_SIGNALED 888 889 * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. 889 890 */ 890 - mutex_lock(&isert_conn->conn_comp_mutex); 891 - if (coalesce && 891 + mutex_lock(&isert_conn->conn_mutex); 892 + if (coalesce && isert_conn->state == ISER_CONN_UP && 892 893 ++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) { 894 + tx_desc->llnode_active = true; 893 895 llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist); 894 - mutex_unlock(&isert_conn->conn_comp_mutex); 896 + mutex_unlock(&isert_conn->conn_mutex); 895 897 return; 896 898 } 897 899 isert_conn->conn_comp_batch = 0; 898 900 tx_desc->comp_llnode_batch = llist_del_all(&isert_conn->conn_comp_llist); 899 - mutex_unlock(&isert_conn->conn_comp_mutex); 901 + mutex_unlock(&isert_conn->conn_mutex); 900 902 901 903 send_wr->send_flags = IB_SEND_SIGNALED; 902 904 } ··· 1464 1464 case ISCSI_OP_SCSI_CMD: 1465 1465 spin_lock_bh(&conn->cmd_lock); 1466 1466 if (!list_empty(&cmd->i_conn_node)) 1467 - list_del(&cmd->i_conn_node); 1467 + list_del_init(&cmd->i_conn_node); 1468 1468 spin_unlock_bh(&conn->cmd_lock); 1469 1469 1470 1470 if (cmd->data_direction == DMA_TO_DEVICE) ··· 1476 1476 case ISCSI_OP_SCSI_TMFUNC: 1477 1477 spin_lock_bh(&conn->cmd_lock); 1478 1478 if (!list_empty(&cmd->i_conn_node)) 1479 - list_del(&cmd->i_conn_node); 1479 + list_del_init(&cmd->i_conn_node); 1480 1480 spin_unlock_bh(&conn->cmd_lock); 1481 1481 1482 1482 transport_generic_free_cmd(&cmd->se_cmd, 0); ··· 1486 1486 case ISCSI_OP_TEXT: 1487 1487 spin_lock_bh(&conn->cmd_lock); 1488 1488 if (!list_empty(&cmd->i_conn_node)) 1489 - list_del(&cmd->i_conn_node); 1489 + list_del_init(&cmd->i_conn_node); 1490 1490 spin_unlock_bh(&conn->cmd_lock); 1491 1491 1492 1492 /* ··· 1549 1549 iscsit_stop_dataout_timer(cmd); 1550 1550 device->unreg_rdma_mem(isert_cmd, isert_conn); 1551 1551 cmd->write_data_done = wr->cur_rdma_length; 1552 + wr->send_wr_num = 0; 1552 1553 1553 1554 pr_debug("Cmd: %p RDMA_READ comp calling execute_cmd\n", isert_cmd); 1554 1555 spin_lock_bh(&cmd->istate_lock); ··· 1590 1589 pr_debug("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n"); 1591 1590 /* 1592 1591 * Call atomic_dec(&isert_conn->post_send_buf_count) 1593 - * from isert_free_conn() 1592 + * from isert_wait_conn() 1594 1593 */ 1595 1594 isert_conn->logout_posted = true; 1596 1595 iscsit_logout_post_handler(cmd, cmd->conn); ··· 1614 1613 struct ib_device *ib_dev) 1615 1614 { 1616 1615 struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; 1616 + struct isert_rdma_wr *wr = &isert_cmd->rdma_wr; 1617 1617 1618 1618 if (cmd->i_state == ISTATE_SEND_TASKMGTRSP || 1619 1619 cmd->i_state == ISTATE_SEND_LOGOUTRSP || ··· 1626 1624 queue_work(isert_comp_wq, &isert_cmd->comp_work); 1627 1625 return; 1628 1626 } 1629 - atomic_dec(&isert_conn->post_send_buf_count); 1627 + atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); 1630 1628 1631 1629 cmd->i_state = ISTATE_SENT_STATUS; 1632 1630 isert_completion_put(tx_desc, isert_cmd, ib_dev); ··· 1664 1662 case ISER_IB_RDMA_READ: 1665 1663 pr_debug("isert_send_completion: Got ISER_IB_RDMA_READ:\n"); 1666 1664 1667 - atomic_dec(&isert_conn->post_send_buf_count); 1665 + atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count); 1668 1666 isert_completion_rdma_read(tx_desc, isert_cmd); 1669 1667 break; 1670 1668 default: ··· 1693 1691 } 1694 1692 1695 1693 static void 1696 - isert_cq_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) 1694 + isert_cq_drain_comp_llist(struct isert_conn *isert_conn, struct ib_device *ib_dev) 1695 + { 1696 + struct llist_node *llnode; 1697 + struct isert_rdma_wr *wr; 1698 + struct iser_tx_desc *t; 1699 + 1700 + mutex_lock(&isert_conn->conn_mutex); 1701 + llnode = llist_del_all(&isert_conn->conn_comp_llist); 1702 + isert_conn->conn_comp_batch = 0; 1703 + mutex_unlock(&isert_conn->conn_mutex); 1704 + 1705 + while (llnode) { 1706 + t = llist_entry(llnode, struct iser_tx_desc, comp_llnode); 1707 + llnode = llist_next(llnode); 1708 + wr = &t->isert_cmd->rdma_wr; 1709 + 1710 + atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); 1711 + isert_completion_put(t, t->isert_cmd, ib_dev); 1712 + } 1713 + } 1714 + 1715 + static void 1716 + isert_cq_tx_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) 1697 1717 { 1698 1718 struct ib_device *ib_dev = isert_conn->conn_cm_id->device; 1719 + struct isert_cmd *isert_cmd = tx_desc->isert_cmd; 1720 + struct llist_node *llnode = tx_desc->comp_llnode_batch; 1721 + struct isert_rdma_wr *wr; 1722 + struct iser_tx_desc *t; 1699 1723 1700 - if (tx_desc) { 1701 - struct isert_cmd *isert_cmd = tx_desc->isert_cmd; 1724 + while (llnode) { 1725 + t = llist_entry(llnode, struct iser_tx_desc, comp_llnode); 1726 + llnode = llist_next(llnode); 1727 + wr = &t->isert_cmd->rdma_wr; 1702 1728 1703 - if (!isert_cmd) 1704 - isert_unmap_tx_desc(tx_desc, ib_dev); 1705 - else 1706 - isert_completion_put(tx_desc, isert_cmd, ib_dev); 1729 + atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); 1730 + isert_completion_put(t, t->isert_cmd, ib_dev); 1731 + } 1732 + tx_desc->comp_llnode_batch = NULL; 1733 + 1734 + if (!isert_cmd) 1735 + isert_unmap_tx_desc(tx_desc, ib_dev); 1736 + else 1737 + isert_completion_put(tx_desc, isert_cmd, ib_dev); 1738 + } 1739 + 1740 + static void 1741 + isert_cq_rx_comp_err(struct isert_conn *isert_conn) 1742 + { 1743 + struct ib_device *ib_dev = isert_conn->conn_cm_id->device; 1744 + struct iscsi_conn *conn = isert_conn->conn; 1745 + 1746 + if (isert_conn->post_recv_buf_count) 1747 + return; 1748 + 1749 + isert_cq_drain_comp_llist(isert_conn, ib_dev); 1750 + 1751 + if (conn->sess) { 1752 + target_sess_cmd_list_set_waiting(conn->sess->se_sess); 1753 + target_wait_for_sess_cmds(conn->sess->se_sess); 1707 1754 } 1708 1755 1709 - if (isert_conn->post_recv_buf_count == 0 && 1710 - atomic_read(&isert_conn->post_send_buf_count) == 0) { 1711 - pr_debug("isert_cq_comp_err >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); 1712 - pr_debug("Calling wake_up from isert_cq_comp_err\n"); 1756 + while (atomic_read(&isert_conn->post_send_buf_count)) 1757 + msleep(3000); 1713 1758 1714 - mutex_lock(&isert_conn->conn_mutex); 1715 - if (isert_conn->state != ISER_CONN_DOWN) 1716 - isert_conn->state = ISER_CONN_TERMINATING; 1717 - mutex_unlock(&isert_conn->conn_mutex); 1759 + mutex_lock(&isert_conn->conn_mutex); 1760 + isert_conn->state = ISER_CONN_DOWN; 1761 + mutex_unlock(&isert_conn->conn_mutex); 1718 1762 1719 - wake_up(&isert_conn->conn_wait_comp_err); 1720 - } 1763 + complete(&isert_conn->conn_wait_comp_err); 1721 1764 } 1722 1765 1723 1766 static void ··· 1787 1740 pr_debug("TX wc.status != IB_WC_SUCCESS >>>>>>>>>>>>>>\n"); 1788 1741 pr_debug("TX wc.status: 0x%08x\n", wc.status); 1789 1742 pr_debug("TX wc.vendor_err: 0x%08x\n", wc.vendor_err); 1790 - atomic_dec(&isert_conn->post_send_buf_count); 1791 - isert_cq_comp_err(tx_desc, isert_conn); 1743 + 1744 + if (wc.wr_id != ISER_FASTREG_LI_WRID) { 1745 + if (tx_desc->llnode_active) 1746 + continue; 1747 + 1748 + atomic_dec(&isert_conn->post_send_buf_count); 1749 + isert_cq_tx_comp_err(tx_desc, isert_conn); 1750 + } 1792 1751 } 1793 1752 } 1794 1753 ··· 1837 1784 wc.vendor_err); 1838 1785 } 1839 1786 isert_conn->post_recv_buf_count--; 1840 - isert_cq_comp_err(NULL, isert_conn); 1787 + isert_cq_rx_comp_err(isert_conn); 1841 1788 } 1842 1789 } 1843 1790 ··· 2255 2202 2256 2203 if (!fr_desc->valid) { 2257 2204 memset(&inv_wr, 0, sizeof(inv_wr)); 2205 + inv_wr.wr_id = ISER_FASTREG_LI_WRID; 2258 2206 inv_wr.opcode = IB_WR_LOCAL_INV; 2259 2207 inv_wr.ex.invalidate_rkey = fr_desc->data_mr->rkey; 2260 2208 wr = &inv_wr; ··· 2266 2212 2267 2213 /* Prepare FASTREG WR */ 2268 2214 memset(&fr_wr, 0, sizeof(fr_wr)); 2215 + fr_wr.wr_id = ISER_FASTREG_LI_WRID; 2269 2216 fr_wr.opcode = IB_WR_FAST_REG_MR; 2270 2217 fr_wr.wr.fast_reg.iova_start = 2271 2218 fr_desc->data_frpl->page_list[0] + page_off; ··· 2432 2377 isert_init_send_wr(isert_conn, isert_cmd, 2433 2378 &isert_cmd->tx_desc.send_wr, true); 2434 2379 2435 - atomic_inc(&isert_conn->post_send_buf_count); 2380 + atomic_add(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); 2436 2381 2437 2382 rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); 2438 2383 if (rc) { 2439 2384 pr_warn("ib_post_send() failed for IB_WR_RDMA_WRITE\n"); 2440 - atomic_dec(&isert_conn->post_send_buf_count); 2385 + atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); 2441 2386 } 2442 2387 pr_debug("Cmd: %p posted RDMA_WRITE + Response for iSER Data READ\n", 2443 2388 isert_cmd); ··· 2465 2410 return rc; 2466 2411 } 2467 2412 2468 - atomic_inc(&isert_conn->post_send_buf_count); 2413 + atomic_add(wr->send_wr_num, &isert_conn->post_send_buf_count); 2469 2414 2470 2415 rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); 2471 2416 if (rc) { 2472 2417 pr_warn("ib_post_send() failed for IB_WR_RDMA_READ\n"); 2473 - atomic_dec(&isert_conn->post_send_buf_count); 2418 + atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count); 2474 2419 } 2475 2420 pr_debug("Cmd: %p posted RDMA_READ memory for ISER Data WRITE\n", 2476 2421 isert_cmd); ··· 2757 2702 kfree(isert_np); 2758 2703 } 2759 2704 2760 - static int isert_check_state(struct isert_conn *isert_conn, int state) 2761 - { 2762 - int ret; 2763 - 2764 - mutex_lock(&isert_conn->conn_mutex); 2765 - ret = (isert_conn->state == state); 2766 - mutex_unlock(&isert_conn->conn_mutex); 2767 - 2768 - return ret; 2769 - } 2770 - 2771 - static void isert_free_conn(struct iscsi_conn *conn) 2705 + static void isert_wait_conn(struct iscsi_conn *conn) 2772 2706 { 2773 2707 struct isert_conn *isert_conn = conn->context; 2774 2708 2775 - pr_debug("isert_free_conn: Starting \n"); 2709 + pr_debug("isert_wait_conn: Starting \n"); 2776 2710 /* 2777 2711 * Decrement post_send_buf_count for special case when called 2778 2712 * from isert_do_control_comp() -> iscsit_logout_post_handler() ··· 2771 2727 atomic_dec(&isert_conn->post_send_buf_count); 2772 2728 2773 2729 if (isert_conn->conn_cm_id && isert_conn->state != ISER_CONN_DOWN) { 2774 - pr_debug("Calling rdma_disconnect from isert_free_conn\n"); 2730 + pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); 2775 2731 rdma_disconnect(isert_conn->conn_cm_id); 2776 2732 } 2777 2733 /* 2778 2734 * Only wait for conn_wait_comp_err if the isert_conn made it 2779 2735 * into full feature phase.. 2780 2736 */ 2781 - if (isert_conn->state == ISER_CONN_UP) { 2782 - pr_debug("isert_free_conn: Before wait_event comp_err %d\n", 2783 - isert_conn->state); 2784 - mutex_unlock(&isert_conn->conn_mutex); 2785 - 2786 - wait_event(isert_conn->conn_wait_comp_err, 2787 - (isert_check_state(isert_conn, ISER_CONN_TERMINATING))); 2788 - 2789 - wait_event(isert_conn->conn_wait, 2790 - (isert_check_state(isert_conn, ISER_CONN_DOWN))); 2791 - 2792 - isert_put_conn(isert_conn); 2793 - return; 2794 - } 2795 2737 if (isert_conn->state == ISER_CONN_INIT) { 2796 2738 mutex_unlock(&isert_conn->conn_mutex); 2797 - isert_put_conn(isert_conn); 2798 2739 return; 2799 2740 } 2800 - pr_debug("isert_free_conn: wait_event conn_wait %d\n", 2801 - isert_conn->state); 2741 + if (isert_conn->state == ISER_CONN_UP) 2742 + isert_conn->state = ISER_CONN_TERMINATING; 2802 2743 mutex_unlock(&isert_conn->conn_mutex); 2803 2744 2804 - wait_event(isert_conn->conn_wait, 2805 - (isert_check_state(isert_conn, ISER_CONN_DOWN))); 2745 + wait_for_completion(&isert_conn->conn_wait_comp_err); 2746 + 2747 + wait_for_completion(&isert_conn->conn_wait); 2748 + } 2749 + 2750 + static void isert_free_conn(struct iscsi_conn *conn) 2751 + { 2752 + struct isert_conn *isert_conn = conn->context; 2806 2753 2807 2754 isert_put_conn(isert_conn); 2808 2755 } ··· 2806 2771 .iscsit_setup_np = isert_setup_np, 2807 2772 .iscsit_accept_np = isert_accept_np, 2808 2773 .iscsit_free_np = isert_free_np, 2774 + .iscsit_wait_conn = isert_wait_conn, 2809 2775 .iscsit_free_conn = isert_free_conn, 2810 2776 .iscsit_get_login_rx = isert_get_login_rx, 2811 2777 .iscsit_put_login_tx = isert_put_login_tx,
+4 -3
drivers/infiniband/ulp/isert/ib_isert.h
··· 6 6 7 7 #define ISERT_RDMA_LISTEN_BACKLOG 10 8 8 #define ISCSI_ISER_SG_TABLESIZE 256 9 + #define ISER_FASTREG_LI_WRID 0xffffffffffffffffULL 9 10 10 11 enum isert_desc_type { 11 12 ISCSI_TX_CONTROL, ··· 46 45 struct isert_cmd *isert_cmd; 47 46 struct llist_node *comp_llnode_batch; 48 47 struct llist_node comp_llnode; 48 + bool llnode_active; 49 49 struct ib_send_wr send_wr; 50 50 } __packed; 51 51 ··· 118 116 struct isert_device *conn_device; 119 117 struct work_struct conn_logout_work; 120 118 struct mutex conn_mutex; 121 - wait_queue_head_t conn_wait; 122 - wait_queue_head_t conn_wait_comp_err; 119 + struct completion conn_wait; 120 + struct completion conn_wait_comp_err; 123 121 struct kref conn_kref; 124 122 struct list_head conn_fr_pool; 125 123 int conn_fr_pool_size; ··· 128 126 #define ISERT_COMP_BATCH_COUNT 8 129 127 int conn_comp_batch; 130 128 struct llist_head conn_comp_llist; 131 - struct mutex conn_comp_mutex; 132 129 }; 133 130 134 131 #define ISERT_MAX_CQ 64
+7 -3
drivers/target/iscsi/iscsi_target.c
··· 785 785 spin_unlock_bh(&conn->cmd_lock); 786 786 787 787 list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) { 788 - list_del(&cmd->i_conn_node); 788 + list_del_init(&cmd->i_conn_node); 789 789 iscsit_free_cmd(cmd, false); 790 790 } 791 791 } ··· 3708 3708 break; 3709 3709 case ISTATE_REMOVE: 3710 3710 spin_lock_bh(&conn->cmd_lock); 3711 - list_del(&cmd->i_conn_node); 3711 + list_del_init(&cmd->i_conn_node); 3712 3712 spin_unlock_bh(&conn->cmd_lock); 3713 3713 3714 3714 iscsit_free_cmd(cmd, false); ··· 4151 4151 spin_lock_bh(&conn->cmd_lock); 4152 4152 list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { 4153 4153 4154 - list_del(&cmd->i_conn_node); 4154 + list_del_init(&cmd->i_conn_node); 4155 4155 spin_unlock_bh(&conn->cmd_lock); 4156 4156 4157 4157 iscsit_increment_maxcmdsn(cmd, sess); ··· 4196 4196 iscsit_stop_timers_for_cmds(conn); 4197 4197 iscsit_stop_nopin_response_timer(conn); 4198 4198 iscsit_stop_nopin_timer(conn); 4199 + 4200 + if (conn->conn_transport->iscsit_wait_conn) 4201 + conn->conn_transport->iscsit_wait_conn(conn); 4202 + 4199 4203 iscsit_free_queue_reqs_for_conn(conn); 4200 4204 4201 4205 /*
+8 -8
drivers/target/iscsi/iscsi_target_erl2.c
··· 138 138 list_for_each_entry_safe(cmd, cmd_tmp, 139 139 &cr->conn_recovery_cmd_list, i_conn_node) { 140 140 141 - list_del(&cmd->i_conn_node); 141 + list_del_init(&cmd->i_conn_node); 142 142 cmd->conn = NULL; 143 143 spin_unlock(&cr->conn_recovery_cmd_lock); 144 144 iscsit_free_cmd(cmd, true); ··· 160 160 list_for_each_entry_safe(cmd, cmd_tmp, 161 161 &cr->conn_recovery_cmd_list, i_conn_node) { 162 162 163 - list_del(&cmd->i_conn_node); 163 + list_del_init(&cmd->i_conn_node); 164 164 cmd->conn = NULL; 165 165 spin_unlock(&cr->conn_recovery_cmd_lock); 166 166 iscsit_free_cmd(cmd, true); ··· 216 216 } 217 217 cr = cmd->cr; 218 218 219 - list_del(&cmd->i_conn_node); 219 + list_del_init(&cmd->i_conn_node); 220 220 return --cr->cmd_count; 221 221 } 222 222 ··· 297 297 if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) 298 298 continue; 299 299 300 - list_del(&cmd->i_conn_node); 300 + list_del_init(&cmd->i_conn_node); 301 301 302 302 spin_unlock_bh(&conn->cmd_lock); 303 303 iscsit_free_cmd(cmd, true); ··· 335 335 /* 336 336 * Only perform connection recovery on ISCSI_OP_SCSI_CMD or 337 337 * ISCSI_OP_NOOP_OUT opcodes. For all other opcodes call 338 - * list_del(&cmd->i_conn_node); to release the command to the 338 + * list_del_init(&cmd->i_conn_node); to release the command to the 339 339 * session pool and remove it from the connection's list. 340 340 * 341 341 * Also stop the DataOUT timer, which will be restarted after ··· 351 351 " CID: %hu\n", cmd->iscsi_opcode, 352 352 cmd->init_task_tag, cmd->cmd_sn, conn->cid); 353 353 354 - list_del(&cmd->i_conn_node); 354 + list_del_init(&cmd->i_conn_node); 355 355 spin_unlock_bh(&conn->cmd_lock); 356 356 iscsit_free_cmd(cmd, true); 357 357 spin_lock_bh(&conn->cmd_lock); ··· 371 371 */ 372 372 if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && 373 373 iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { 374 - list_del(&cmd->i_conn_node); 374 + list_del_init(&cmd->i_conn_node); 375 375 spin_unlock_bh(&conn->cmd_lock); 376 376 iscsit_free_cmd(cmd, true); 377 377 spin_lock_bh(&conn->cmd_lock); ··· 393 393 394 394 cmd->sess = conn->sess; 395 395 396 - list_del(&cmd->i_conn_node); 396 + list_del_init(&cmd->i_conn_node); 397 397 spin_unlock_bh(&conn->cmd_lock); 398 398 399 399 iscsit_free_all_datain_reqs(cmd);
+1 -1
drivers/target/iscsi/iscsi_target_tpg.c
··· 137 137 list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { 138 138 139 139 spin_lock(&tpg->tpg_state_lock); 140 - if (tpg->tpg_state == TPG_STATE_FREE) { 140 + if (tpg->tpg_state != TPG_STATE_ACTIVE) { 141 141 spin_unlock(&tpg->tpg_state_lock); 142 142 continue; 143 143 }
+20 -14
drivers/target/target_core_sbc.c
··· 1079 1079 left = sectors * dev->prot_length; 1080 1080 1081 1081 for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { 1082 - 1083 - len = min(psg->length, left); 1084 - if (offset >= sg->length) { 1085 - sg = sg_next(sg); 1086 - offset = 0; 1087 - } 1082 + unsigned int psg_len, copied = 0; 1088 1083 1089 1084 paddr = kmap_atomic(sg_page(psg)) + psg->offset; 1090 - addr = kmap_atomic(sg_page(sg)) + sg->offset + offset; 1085 + psg_len = min(left, psg->length); 1086 + while (psg_len) { 1087 + len = min(psg_len, sg->length - offset); 1088 + addr = kmap_atomic(sg_page(sg)) + sg->offset + offset; 1091 1089 1092 - if (read) 1093 - memcpy(paddr, addr, len); 1094 - else 1095 - memcpy(addr, paddr, len); 1090 + if (read) 1091 + memcpy(paddr + copied, addr, len); 1092 + else 1093 + memcpy(addr, paddr + copied, len); 1096 1094 1097 - left -= len; 1098 - offset += len; 1095 + left -= len; 1096 + offset += len; 1097 + copied += len; 1098 + psg_len -= len; 1099 + 1100 + if (offset >= sg->length) { 1101 + sg = sg_next(sg); 1102 + offset = 0; 1103 + } 1104 + kunmap_atomic(addr); 1105 + } 1099 1106 kunmap_atomic(paddr); 1100 - kunmap_atomic(addr); 1101 1107 } 1102 1108 } 1103 1109
+1
include/target/iscsi/iscsi_transport.h
··· 12 12 int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *); 13 13 int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *); 14 14 void (*iscsit_free_np)(struct iscsi_np *); 15 + void (*iscsit_wait_conn)(struct iscsi_conn *); 15 16 void (*iscsit_free_conn)(struct iscsi_conn *); 16 17 int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *); 17 18 int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32);