aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2016-01-25 01:04:14 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2016-03-11 00:48:12 -0500
commit5f27edad953cfde6339f17ce461f57bc7060dc4f (patch)
tree0a206709a257e91c2f590fd12cab55532903f226
parent5a3ee221b543100ce3bed5b59bfb155d0ef293b7 (diff)
sbp-target: Convert to TARGET_SCF_ACK_KREF I/O krefs
This patch converts sbp-target to modern TARGET_SCF_ACK_KREF usage for sbp_send_status() callback path, and drops the now obsolete sbp_free_request() failure path calls. Acked-by: Chris Boot <bootc@bootc.net> Tested-by: Chris Boot <bootc@bootc.net> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/sbp/sbp_target.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index 627044f2b75e..c57e7884973d 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -893,7 +893,6 @@ static void tgt_agent_process_work(struct work_struct *work)
893 STATUS_BLOCK_SBP_STATUS( 893 STATUS_BLOCK_SBP_STATUS(
894 SBP_STATUS_REQ_TYPE_NOTSUPP)); 894 SBP_STATUS_REQ_TYPE_NOTSUPP));
895 sbp_send_status(req); 895 sbp_send_status(req);
896 sbp_free_request(req);
897 return; 896 return;
898 case 3: /* Dummy ORB */ 897 case 3: /* Dummy ORB */
899 req->status.status |= cpu_to_be32( 898 req->status.status |= cpu_to_be32(
@@ -904,7 +903,6 @@ static void tgt_agent_process_work(struct work_struct *work)
904 STATUS_BLOCK_SBP_STATUS( 903 STATUS_BLOCK_SBP_STATUS(
905 SBP_STATUS_DUMMY_ORB_COMPLETE)); 904 SBP_STATUS_DUMMY_ORB_COMPLETE));
906 sbp_send_status(req); 905 sbp_send_status(req);
907 sbp_free_request(req);
908 return; 906 return;
909 default: 907 default:
910 BUG(); 908 BUG();
@@ -989,7 +987,6 @@ static void tgt_agent_fetch_work(struct work_struct *work)
989 spin_unlock_bh(&agent->lock); 987 spin_unlock_bh(&agent->lock);
990 988
991 sbp_send_status(req); 989 sbp_send_status(req);
992 sbp_free_request(req);
993 return; 990 return;
994 } 991 }
995 992
@@ -1236,7 +1233,7 @@ static void sbp_handle_command(struct sbp_target_request *req)
1236 req->se_cmd.tag = req->orb_pointer; 1233 req->se_cmd.tag = req->orb_pointer;
1237 if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, 1234 if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf,
1238 req->sense_buf, unpacked_lun, data_length, 1235 req->sense_buf, unpacked_lun, data_length,
1239 TCM_SIMPLE_TAG, data_dir, 0)) 1236 TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF))
1240 goto err; 1237 goto err;
1241 1238
1242 return; 1239 return;
@@ -1248,7 +1245,6 @@ err:
1248 STATUS_BLOCK_LEN(1) | 1245 STATUS_BLOCK_LEN(1) |
1249 STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR)); 1246 STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
1250 sbp_send_status(req); 1247 sbp_send_status(req);
1251 sbp_free_request(req);
1252} 1248}
1253 1249
1254/* 1250/*
@@ -1347,22 +1343,29 @@ static int sbp_rw_data(struct sbp_target_request *req)
1347 1343
1348static int sbp_send_status(struct sbp_target_request *req) 1344static int sbp_send_status(struct sbp_target_request *req)
1349{ 1345{
1350 int ret, length; 1346 int rc, ret = 0, length;
1351 struct sbp_login_descriptor *login = req->login; 1347 struct sbp_login_descriptor *login = req->login;
1352 1348
1353 length = (((be32_to_cpu(req->status.status) >> 24) & 0x07) + 1) * 4; 1349 length = (((be32_to_cpu(req->status.status) >> 24) & 0x07) + 1) * 4;
1354 1350
1355 ret = sbp_run_request_transaction(req, TCODE_WRITE_BLOCK_REQUEST, 1351 rc = sbp_run_request_transaction(req, TCODE_WRITE_BLOCK_REQUEST,
1356 login->status_fifo_addr, &req->status, length); 1352 login->status_fifo_addr, &req->status, length);
1357 if (ret != RCODE_COMPLETE) { 1353 if (rc != RCODE_COMPLETE) {
1358 pr_debug("sbp_send_status: write failed: 0x%x\n", ret); 1354 pr_debug("sbp_send_status: write failed: 0x%x\n", rc);
1359 return -EIO; 1355 ret = -EIO;
1356 goto put_ref;
1360 } 1357 }
1361 1358
1362 pr_debug("sbp_send_status: status write complete for ORB: 0x%llx\n", 1359 pr_debug("sbp_send_status: status write complete for ORB: 0x%llx\n",
1363 req->orb_pointer); 1360 req->orb_pointer);
1364 1361 /*
1365 return 0; 1362 * Drop the extra ACK_KREF reference taken by target_submit_cmd()
1363 * ahead of sbp_check_stop_free() -> transport_generic_free_cmd()
1364 * final se_cmd->cmd_kref put.
1365 */
1366put_ref:
1367 target_put_sess_cmd(&req->se_cmd);
1368 return ret;
1366} 1369}
1367 1370
1368static void sbp_sense_mangle(struct sbp_target_request *req) 1371static void sbp_sense_mangle(struct sbp_target_request *req)
@@ -1822,8 +1825,7 @@ static int sbp_check_stop_free(struct se_cmd *se_cmd)
1822 struct sbp_target_request *req = container_of(se_cmd, 1825 struct sbp_target_request *req = container_of(se_cmd,
1823 struct sbp_target_request, se_cmd); 1826 struct sbp_target_request, se_cmd);
1824 1827
1825 transport_generic_free_cmd(&req->se_cmd, 0); 1828 return transport_generic_free_cmd(&req->se_cmd, 0);
1826 return 1;
1827} 1829}
1828 1830
1829static int sbp_count_se_tpg_luns(struct se_portal_group *tpg) 1831static int sbp_count_se_tpg_luns(struct se_portal_group *tpg)