diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-15 17:25:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-15 17:25:10 -0500 |
commit | 5bd665f28db2b04a8d6fe277342479906fc60b62 (patch) | |
tree | 4f9f63120fed3a61b44bbb7ec4ebaaa4dc4fc571 /drivers/infiniband | |
parent | 115b1cc2ef0f43ecb42bdbf55f06e9d2231d5a7e (diff) | |
parent | 79e62fc3827bd437c304c1810f36896fc1e717b1 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull target updates from Nicholas Bellinger:
"It has been a very busy development cycle this time around in target
land, with the highlights including:
- Kill struct se_subsystem_dev, in favor of direct se_device usage
(hch)
- Simplify reservations code by combining SPC-3 + SCSI-2 support for
virtual backends only (hch)
- Simplify ALUA code for virtual only backends, and remove left over
abstractions (hch)
- Pass sense_reason_t as return value for I/O submission path (hch)
- Refactor MODE_SENSE emulation to allow for easier addition of new
mode pages. (roland)
- Add emulation of MODE_SELECT (roland)
- Fix bug in handling of ExpStatSN wrap-around (steve)
- Fix bug in TMR ABORT_TASK lookup in qla2xxx target (steve)
- Add WRITE_SAME w/ UNMAP=0 support for IBLOCK backends (nab)
- Convert ib_srpt to use modern target_submit_cmd caller + drop
legacy ioctx->kref usage (nab)
- Convert ib_srpt to use modern target_submit_tmr caller (nab)
- Add link_magic for fabric allow_link destination target_items for
symlinks within target_core_fabric_configfs.c code (nab)
- Allocate pointers in instead of full structs for
config_group->default_groups (sebastian)
- Fix 32-bit highmem breakage for FILEIO (sebastian)
All told, hch was able to shave off another ~1K LOC by killing the
se_subsystem_dev abstraction, along with a number of PR + ALUA
simplifications. Also, a nice patch by Roland is the refactoring of
MODE_SENSE handling, along with the addition of initial MODE_SELECT
emulation support for virtual backends.
Sebastian found a long-standing issue wrt to allocation of full
config_group instead of pointers for config_group->default_group[]
setup in a number of areas, which ends up saving memory with big
configurations. He also managed to fix another long-standing BUG wrt
to broken 32-bit highmem support within the FILEIO backend driver.
Thank you again to everyone who contributed this round!"
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (50 commits)
target/iscsi_target: Add NodeACL tags for initiator group support
target/tcm_fc: fix the lockdep warning due to inconsistent lock state
sbp-target: fix error path in sbp_make_tpg()
sbp-target: use simple assignment in tgt_agent_rw_agent_state()
iscsi-target: use kstrdup() for iscsi_param
target/file: merge fd_do_readv() and fd_do_writev()
target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping
target: Add link_magic for fabric allow_link destination target_items
ib_srpt: Convert TMR path to target_submit_tmr
ib_srpt: Convert I/O path to target_submit_cmd + drop legacy ioctx->kref
target: Make spc_get_write_same_sectors return sector_t
target/configfs: use kmalloc() instead of kzalloc() for default groups
target/configfs: allocate only 6 slots for dev_cg->default_groups
target/configfs: allocate pointers instead of full struct for default_groups
target: update error handling for sbc_setup_write_same()
iscsit: use GFP_ATOMIC under spin lock
iscsi_target: Remove redundant null check before kfree
target/iblock: Forward declare bio helpers
target: Clean up flow in transport_check_aborted_status()
target: Clean up logic in transport_put_cmd()
...
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 178 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.h | 1 |
2 files changed, 76 insertions, 103 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index cf23c46185b2..c09d41b1a2ff 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -1269,7 +1269,6 @@ static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) | |||
1269 | return ioctx; | 1269 | return ioctx; |
1270 | 1270 | ||
1271 | BUG_ON(ioctx->ch != ch); | 1271 | BUG_ON(ioctx->ch != ch); |
1272 | kref_init(&ioctx->kref); | ||
1273 | spin_lock_init(&ioctx->spinlock); | 1272 | spin_lock_init(&ioctx->spinlock); |
1274 | ioctx->state = SRPT_STATE_NEW; | 1273 | ioctx->state = SRPT_STATE_NEW; |
1275 | ioctx->n_rbuf = 0; | 1274 | ioctx->n_rbuf = 0; |
@@ -1291,39 +1290,6 @@ static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) | |||
1291 | } | 1290 | } |
1292 | 1291 | ||
1293 | /** | 1292 | /** |
1294 | * srpt_put_send_ioctx() - Free up resources. | ||
1295 | */ | ||
1296 | static void srpt_put_send_ioctx(struct srpt_send_ioctx *ioctx) | ||
1297 | { | ||
1298 | struct srpt_rdma_ch *ch; | ||
1299 | unsigned long flags; | ||
1300 | |||
1301 | BUG_ON(!ioctx); | ||
1302 | ch = ioctx->ch; | ||
1303 | BUG_ON(!ch); | ||
1304 | |||
1305 | WARN_ON(srpt_get_cmd_state(ioctx) != SRPT_STATE_DONE); | ||
1306 | |||
1307 | srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx); | ||
1308 | transport_generic_free_cmd(&ioctx->cmd, 0); | ||
1309 | |||
1310 | if (ioctx->n_rbuf > 1) { | ||
1311 | kfree(ioctx->rbufs); | ||
1312 | ioctx->rbufs = NULL; | ||
1313 | ioctx->n_rbuf = 0; | ||
1314 | } | ||
1315 | |||
1316 | spin_lock_irqsave(&ch->spinlock, flags); | ||
1317 | list_add(&ioctx->free_list, &ch->free_list); | ||
1318 | spin_unlock_irqrestore(&ch->spinlock, flags); | ||
1319 | } | ||
1320 | |||
1321 | static void srpt_put_send_ioctx_kref(struct kref *kref) | ||
1322 | { | ||
1323 | srpt_put_send_ioctx(container_of(kref, struct srpt_send_ioctx, kref)); | ||
1324 | } | ||
1325 | |||
1326 | /** | ||
1327 | * srpt_abort_cmd() - Abort a SCSI command. | 1293 | * srpt_abort_cmd() - Abort a SCSI command. |
1328 | * @ioctx: I/O context associated with the SCSI command. | 1294 | * @ioctx: I/O context associated with the SCSI command. |
1329 | * @context: Preferred execution context. | 1295 | * @context: Preferred execution context. |
@@ -1359,8 +1325,14 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) | |||
1359 | } | 1325 | } |
1360 | spin_unlock_irqrestore(&ioctx->spinlock, flags); | 1326 | spin_unlock_irqrestore(&ioctx->spinlock, flags); |
1361 | 1327 | ||
1362 | if (state == SRPT_STATE_DONE) | 1328 | if (state == SRPT_STATE_DONE) { |
1329 | struct srpt_rdma_ch *ch = ioctx->ch; | ||
1330 | |||
1331 | BUG_ON(ch->sess == NULL); | ||
1332 | |||
1333 | target_put_sess_cmd(ch->sess, &ioctx->cmd); | ||
1363 | goto out; | 1334 | goto out; |
1335 | } | ||
1364 | 1336 | ||
1365 | pr_debug("Aborting cmd with state %d and tag %lld\n", state, | 1337 | pr_debug("Aborting cmd with state %d and tag %lld\n", state, |
1366 | ioctx->tag); | 1338 | ioctx->tag); |
@@ -1395,11 +1367,11 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) | |||
1395 | spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags); | 1367 | spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags); |
1396 | ioctx->cmd.transport_state |= CMD_T_LUN_STOP; | 1368 | ioctx->cmd.transport_state |= CMD_T_LUN_STOP; |
1397 | spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags); | 1369 | spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags); |
1398 | kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); | 1370 | target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); |
1399 | break; | 1371 | break; |
1400 | case SRPT_STATE_MGMT_RSP_SENT: | 1372 | case SRPT_STATE_MGMT_RSP_SENT: |
1401 | srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); | 1373 | srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); |
1402 | kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); | 1374 | target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); |
1403 | break; | 1375 | break; |
1404 | default: | 1376 | default: |
1405 | WARN_ON("ERROR: unexpected command state"); | 1377 | WARN_ON("ERROR: unexpected command state"); |
@@ -1457,11 +1429,13 @@ static void srpt_handle_send_comp(struct srpt_rdma_ch *ch, | |||
1457 | && state != SRPT_STATE_DONE)) | 1429 | && state != SRPT_STATE_DONE)) |
1458 | pr_debug("state = %d\n", state); | 1430 | pr_debug("state = %d\n", state); |
1459 | 1431 | ||
1460 | if (state != SRPT_STATE_DONE) | 1432 | if (state != SRPT_STATE_DONE) { |
1461 | kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); | 1433 | srpt_unmap_sg_to_ib_sge(ch, ioctx); |
1462 | else | 1434 | transport_generic_free_cmd(&ioctx->cmd, 0); |
1435 | } else { | ||
1463 | printk(KERN_ERR "IB completion has been received too late for" | 1436 | printk(KERN_ERR "IB completion has been received too late for" |
1464 | " wr_id = %u.\n", ioctx->ioctx.index); | 1437 | " wr_id = %u.\n", ioctx->ioctx.index); |
1438 | } | ||
1465 | } | 1439 | } |
1466 | 1440 | ||
1467 | /** | 1441 | /** |
@@ -1712,10 +1686,10 @@ out_err: | |||
1712 | 1686 | ||
1713 | static int srpt_check_stop_free(struct se_cmd *cmd) | 1687 | static int srpt_check_stop_free(struct se_cmd *cmd) |
1714 | { | 1688 | { |
1715 | struct srpt_send_ioctx *ioctx; | 1689 | struct srpt_send_ioctx *ioctx = container_of(cmd, |
1690 | struct srpt_send_ioctx, cmd); | ||
1716 | 1691 | ||
1717 | ioctx = container_of(cmd, struct srpt_send_ioctx, cmd); | 1692 | return target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); |
1718 | return kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); | ||
1719 | } | 1693 | } |
1720 | 1694 | ||
1721 | /** | 1695 | /** |
@@ -1730,12 +1704,12 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, | |||
1730 | uint64_t unpacked_lun; | 1704 | uint64_t unpacked_lun; |
1731 | u64 data_len; | 1705 | u64 data_len; |
1732 | enum dma_data_direction dir; | 1706 | enum dma_data_direction dir; |
1733 | int ret; | 1707 | sense_reason_t ret; |
1708 | int rc; | ||
1734 | 1709 | ||
1735 | BUG_ON(!send_ioctx); | 1710 | BUG_ON(!send_ioctx); |
1736 | 1711 | ||
1737 | srp_cmd = recv_ioctx->ioctx.buf; | 1712 | srp_cmd = recv_ioctx->ioctx.buf; |
1738 | kref_get(&send_ioctx->kref); | ||
1739 | cmd = &send_ioctx->cmd; | 1713 | cmd = &send_ioctx->cmd; |
1740 | send_ioctx->tag = srp_cmd->tag; | 1714 | send_ioctx->tag = srp_cmd->tag; |
1741 | 1715 | ||
@@ -1755,40 +1729,26 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, | |||
1755 | break; | 1729 | break; |
1756 | } | 1730 | } |
1757 | 1731 | ||
1758 | ret = srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len); | 1732 | if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) { |
1759 | if (ret) { | ||
1760 | printk(KERN_ERR "0x%llx: parsing SRP descriptor table failed.\n", | 1733 | printk(KERN_ERR "0x%llx: parsing SRP descriptor table failed.\n", |
1761 | srp_cmd->tag); | 1734 | srp_cmd->tag); |
1762 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | 1735 | ret = TCM_INVALID_CDB_FIELD; |
1763 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
1764 | kref_put(&send_ioctx->kref, srpt_put_send_ioctx_kref); | ||
1765 | goto send_sense; | 1736 | goto send_sense; |
1766 | } | 1737 | } |
1767 | 1738 | ||
1768 | cmd->data_length = data_len; | ||
1769 | cmd->data_direction = dir; | ||
1770 | unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_cmd->lun, | 1739 | unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_cmd->lun, |
1771 | sizeof(srp_cmd->lun)); | 1740 | sizeof(srp_cmd->lun)); |
1772 | if (transport_lookup_cmd_lun(cmd, unpacked_lun) < 0) { | 1741 | rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb, |
1773 | kref_put(&send_ioctx->kref, srpt_put_send_ioctx_kref); | 1742 | &send_ioctx->sense_data[0], unpacked_lun, data_len, |
1743 | MSG_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); | ||
1744 | if (rc != 0) { | ||
1745 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1774 | goto send_sense; | 1746 | goto send_sense; |
1775 | } | 1747 | } |
1776 | ret = target_setup_cmd_from_cdb(cmd, srp_cmd->cdb); | ||
1777 | if (ret < 0) { | ||
1778 | kref_put(&send_ioctx->kref, srpt_put_send_ioctx_kref); | ||
1779 | if (cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT) { | ||
1780 | srpt_queue_status(cmd); | ||
1781 | return 0; | ||
1782 | } else | ||
1783 | goto send_sense; | ||
1784 | } | ||
1785 | |||
1786 | transport_handle_cdb_direct(cmd); | ||
1787 | return 0; | 1748 | return 0; |
1788 | 1749 | ||
1789 | send_sense: | 1750 | send_sense: |
1790 | transport_send_check_condition_and_sense(cmd, cmd->scsi_sense_reason, | 1751 | transport_send_check_condition_and_sense(cmd, ret, 0); |
1791 | 0); | ||
1792 | return -1; | 1752 | return -1; |
1793 | } | 1753 | } |
1794 | 1754 | ||
@@ -1865,9 +1825,11 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, | |||
1865 | { | 1825 | { |
1866 | struct srp_tsk_mgmt *srp_tsk; | 1826 | struct srp_tsk_mgmt *srp_tsk; |
1867 | struct se_cmd *cmd; | 1827 | struct se_cmd *cmd; |
1828 | struct se_session *sess = ch->sess; | ||
1868 | uint64_t unpacked_lun; | 1829 | uint64_t unpacked_lun; |
1830 | uint32_t tag = 0; | ||
1869 | int tcm_tmr; | 1831 | int tcm_tmr; |
1870 | int res; | 1832 | int rc; |
1871 | 1833 | ||
1872 | BUG_ON(!send_ioctx); | 1834 | BUG_ON(!send_ioctx); |
1873 | 1835 | ||
@@ -1882,39 +1844,32 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, | |||
1882 | send_ioctx->tag = srp_tsk->tag; | 1844 | send_ioctx->tag = srp_tsk->tag; |
1883 | tcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func); | 1845 | tcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func); |
1884 | if (tcm_tmr < 0) { | 1846 | if (tcm_tmr < 0) { |
1885 | send_ioctx->cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
1886 | send_ioctx->cmd.se_tmr_req->response = | 1847 | send_ioctx->cmd.se_tmr_req->response = |
1887 | TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED; | 1848 | TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED; |
1888 | goto process_tmr; | 1849 | goto fail; |
1889 | } | ||
1890 | res = core_tmr_alloc_req(cmd, NULL, tcm_tmr, GFP_KERNEL); | ||
1891 | if (res < 0) { | ||
1892 | send_ioctx->cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
1893 | send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; | ||
1894 | goto process_tmr; | ||
1895 | } | 1850 | } |
1896 | |||
1897 | unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun, | 1851 | unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun, |
1898 | sizeof(srp_tsk->lun)); | 1852 | sizeof(srp_tsk->lun)); |
1899 | res = transport_lookup_tmr_lun(&send_ioctx->cmd, unpacked_lun); | ||
1900 | if (res) { | ||
1901 | pr_debug("rejecting TMR for LUN %lld\n", unpacked_lun); | ||
1902 | send_ioctx->cmd.se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
1903 | send_ioctx->cmd.se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; | ||
1904 | goto process_tmr; | ||
1905 | } | ||
1906 | |||
1907 | if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) | ||
1908 | srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag); | ||
1909 | |||
1910 | process_tmr: | ||
1911 | kref_get(&send_ioctx->kref); | ||
1912 | if (!(send_ioctx->cmd.se_cmd_flags & SCF_SCSI_CDB_EXCEPTION)) | ||
1913 | transport_generic_handle_tmr(&send_ioctx->cmd); | ||
1914 | else | ||
1915 | transport_send_check_condition_and_sense(cmd, | ||
1916 | cmd->scsi_sense_reason, 0); | ||
1917 | 1853 | ||
1854 | if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) { | ||
1855 | rc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag); | ||
1856 | if (rc < 0) { | ||
1857 | send_ioctx->cmd.se_tmr_req->response = | ||
1858 | TMR_TASK_DOES_NOT_EXIST; | ||
1859 | goto fail; | ||
1860 | } | ||
1861 | tag = srp_tsk->task_tag; | ||
1862 | } | ||
1863 | rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun, | ||
1864 | srp_tsk, tcm_tmr, GFP_KERNEL, tag, | ||
1865 | TARGET_SCF_ACK_KREF); | ||
1866 | if (rc != 0) { | ||
1867 | send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; | ||
1868 | goto fail; | ||
1869 | } | ||
1870 | return; | ||
1871 | fail: | ||
1872 | transport_send_check_condition_and_sense(cmd, 0, 0); // XXX: | ||
1918 | } | 1873 | } |
1919 | 1874 | ||
1920 | /** | 1875 | /** |
@@ -1956,10 +1911,6 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, | |||
1956 | } | 1911 | } |
1957 | } | 1912 | } |
1958 | 1913 | ||
1959 | transport_init_se_cmd(&send_ioctx->cmd, &srpt_target->tf_ops, ch->sess, | ||
1960 | 0, DMA_NONE, MSG_SIMPLE_TAG, | ||
1961 | send_ioctx->sense_data); | ||
1962 | |||
1963 | switch (srp_cmd->opcode) { | 1914 | switch (srp_cmd->opcode) { |
1964 | case SRP_CMD: | 1915 | case SRP_CMD: |
1965 | srpt_handle_cmd(ch, recv_ioctx, send_ioctx); | 1916 | srpt_handle_cmd(ch, recv_ioctx, send_ioctx); |
@@ -2365,6 +2316,7 @@ static void srpt_release_channel_work(struct work_struct *w) | |||
2365 | { | 2316 | { |
2366 | struct srpt_rdma_ch *ch; | 2317 | struct srpt_rdma_ch *ch; |
2367 | struct srpt_device *sdev; | 2318 | struct srpt_device *sdev; |
2319 | struct se_session *se_sess; | ||
2368 | 2320 | ||
2369 | ch = container_of(w, struct srpt_rdma_ch, release_work); | 2321 | ch = container_of(w, struct srpt_rdma_ch, release_work); |
2370 | pr_debug("ch = %p; ch->sess = %p; release_done = %p\n", ch, ch->sess, | 2322 | pr_debug("ch = %p; ch->sess = %p; release_done = %p\n", ch, ch->sess, |
@@ -2373,8 +2325,13 @@ static void srpt_release_channel_work(struct work_struct *w) | |||
2373 | sdev = ch->sport->sdev; | 2325 | sdev = ch->sport->sdev; |
2374 | BUG_ON(!sdev); | 2326 | BUG_ON(!sdev); |
2375 | 2327 | ||
2376 | transport_deregister_session_configfs(ch->sess); | 2328 | se_sess = ch->sess; |
2377 | transport_deregister_session(ch->sess); | 2329 | BUG_ON(!se_sess); |
2330 | |||
2331 | target_wait_for_sess_cmds(se_sess, 0); | ||
2332 | |||
2333 | transport_deregister_session_configfs(se_sess); | ||
2334 | transport_deregister_session(se_sess); | ||
2378 | ch->sess = NULL; | 2335 | ch->sess = NULL; |
2379 | 2336 | ||
2380 | srpt_destroy_ch_ib(ch); | 2337 | srpt_destroy_ch_ib(ch); |
@@ -3099,7 +3056,7 @@ static int srpt_queue_response(struct se_cmd *cmd) | |||
3099 | ioctx->tag); | 3056 | ioctx->tag); |
3100 | srpt_unmap_sg_to_ib_sge(ch, ioctx); | 3057 | srpt_unmap_sg_to_ib_sge(ch, ioctx); |
3101 | srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); | 3058 | srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); |
3102 | kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); | 3059 | target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); |
3103 | } | 3060 | } |
3104 | 3061 | ||
3105 | out: | 3062 | out: |
@@ -3490,6 +3447,23 @@ static u32 srpt_tpg_get_inst_index(struct se_portal_group *se_tpg) | |||
3490 | 3447 | ||
3491 | static void srpt_release_cmd(struct se_cmd *se_cmd) | 3448 | static void srpt_release_cmd(struct se_cmd *se_cmd) |
3492 | { | 3449 | { |
3450 | struct srpt_send_ioctx *ioctx = container_of(se_cmd, | ||
3451 | struct srpt_send_ioctx, cmd); | ||
3452 | struct srpt_rdma_ch *ch = ioctx->ch; | ||
3453 | unsigned long flags; | ||
3454 | |||
3455 | WARN_ON(ioctx->state != SRPT_STATE_DONE); | ||
3456 | WARN_ON(ioctx->mapped_sg_count != 0); | ||
3457 | |||
3458 | if (ioctx->n_rbuf > 1) { | ||
3459 | kfree(ioctx->rbufs); | ||
3460 | ioctx->rbufs = NULL; | ||
3461 | ioctx->n_rbuf = 0; | ||
3462 | } | ||
3463 | |||
3464 | spin_lock_irqsave(&ch->spinlock, flags); | ||
3465 | list_add(&ioctx->free_list, &ch->free_list); | ||
3466 | spin_unlock_irqrestore(&ch->spinlock, flags); | ||
3493 | } | 3467 | } |
3494 | 3468 | ||
3495 | /** | 3469 | /** |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h index 61e52b830816..4caf55cda7b1 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h | |||
@@ -228,7 +228,6 @@ struct srpt_recv_ioctx { | |||
228 | struct srpt_send_ioctx { | 228 | struct srpt_send_ioctx { |
229 | struct srpt_ioctx ioctx; | 229 | struct srpt_ioctx ioctx; |
230 | struct srpt_rdma_ch *ch; | 230 | struct srpt_rdma_ch *ch; |
231 | struct kref kref; | ||
232 | struct rdma_iu *rdma_ius; | 231 | struct rdma_iu *rdma_ius; |
233 | struct srp_direct_buf *rbufs; | 232 | struct srp_direct_buf *rbufs; |
234 | struct srp_direct_buf single_rbuf; | 233 | struct srp_direct_buf single_rbuf; |