diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-12-21 14:13:47 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-25 17:37:45 -0500 |
commit | 7d680f3b74dd6f0f57569eeeee8c257790ceaa96 (patch) | |
tree | e0797ab722c222213b7cbe4fa9ba4a61db2d8b0c /drivers/infiniband/ulp/srpt | |
parent | b01543dfe67bb1d191998e90d20534dc354de059 (diff) |
target: replace various cmd flags with a transport state
Replace various atomic_ts used as flags in struct se_cmd with a single
transport_state bitmap that requires t_state_lock to be held for modifications.
In the target core that assumption generally is true, but some recently added
code in the SRP target had to grow new lock calls. I can't say I like the way
how it messes with the command state directly, but let's leave that for later.
(Re-add missing ib_srpt.c changes that nab dropped..)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/infiniband/ulp/srpt')
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 2b73d43cd691..e1e6b5b03c96 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -1378,7 +1378,9 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) | |||
1378 | break; | 1378 | break; |
1379 | case SRPT_STATE_NEED_DATA: | 1379 | case SRPT_STATE_NEED_DATA: |
1380 | /* DMA_TO_DEVICE (write) - RDMA read error. */ | 1380 | /* DMA_TO_DEVICE (write) - RDMA read error. */ |
1381 | atomic_set(&ioctx->cmd.transport_lun_stop, 1); | 1381 | spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags); |
1382 | ioctx->cmd.transport_state |= CMD_T_LUN_STOP; | ||
1383 | spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags); | ||
1382 | transport_generic_handle_data(&ioctx->cmd); | 1384 | transport_generic_handle_data(&ioctx->cmd); |
1383 | break; | 1385 | break; |
1384 | case SRPT_STATE_CMD_RSP_SENT: | 1386 | case SRPT_STATE_CMD_RSP_SENT: |
@@ -1387,7 +1389,9 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) | |||
1387 | * not been received in time. | 1389 | * not been received in time. |
1388 | */ | 1390 | */ |
1389 | srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx); | 1391 | srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx); |
1390 | atomic_set(&ioctx->cmd.transport_lun_stop, 1); | 1392 | spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags); |
1393 | ioctx->cmd.transport_state |= CMD_T_LUN_STOP; | ||
1394 | spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags); | ||
1391 | kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); | 1395 | kref_put(&ioctx->kref, srpt_put_send_ioctx_kref); |
1392 | break; | 1396 | break; |
1393 | case SRPT_STATE_MGMT_RSP_SENT: | 1397 | case SRPT_STATE_MGMT_RSP_SENT: |
@@ -1494,6 +1498,7 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch, | |||
1494 | { | 1498 | { |
1495 | struct se_cmd *cmd; | 1499 | struct se_cmd *cmd; |
1496 | enum srpt_command_state state; | 1500 | enum srpt_command_state state; |
1501 | unsigned long flags; | ||
1497 | 1502 | ||
1498 | cmd = &ioctx->cmd; | 1503 | cmd = &ioctx->cmd; |
1499 | state = srpt_get_cmd_state(ioctx); | 1504 | state = srpt_get_cmd_state(ioctx); |
@@ -1513,7 +1518,9 @@ static void srpt_handle_rdma_err_comp(struct srpt_rdma_ch *ch, | |||
1513 | __func__, __LINE__, state); | 1518 | __func__, __LINE__, state); |
1514 | break; | 1519 | break; |
1515 | case SRPT_RDMA_WRITE_LAST: | 1520 | case SRPT_RDMA_WRITE_LAST: |
1516 | atomic_set(&ioctx->cmd.transport_lun_stop, 1); | 1521 | spin_lock_irqsave(&ioctx->cmd.t_state_lock, flags); |
1522 | ioctx->cmd.transport_state |= CMD_T_LUN_STOP; | ||
1523 | spin_unlock_irqrestore(&ioctx->cmd.t_state_lock, flags); | ||
1517 | break; | 1524 | break; |
1518 | default: | 1525 | default: |
1519 | printk(KERN_ERR "%s[%d]: opcode = %u\n", __func__, | 1526 | printk(KERN_ERR "%s[%d]: opcode = %u\n", __func__, |