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

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>

+16 -14
+16 -14
drivers/target/sbp/sbp_target.c
··· 893 893 STATUS_BLOCK_SBP_STATUS( 894 894 SBP_STATUS_REQ_TYPE_NOTSUPP)); 895 895 sbp_send_status(req); 896 - sbp_free_request(req); 897 896 return; 898 897 case 3: /* Dummy ORB */ 899 898 req->status.status |= cpu_to_be32( ··· 903 904 STATUS_BLOCK_SBP_STATUS( 904 905 SBP_STATUS_DUMMY_ORB_COMPLETE)); 905 906 sbp_send_status(req); 906 - sbp_free_request(req); 907 907 return; 908 908 default: 909 909 BUG(); ··· 987 989 spin_unlock_bh(&agent->lock); 988 990 989 991 sbp_send_status(req); 990 - sbp_free_request(req); 991 992 return; 992 993 } 993 994 ··· 1233 1236 req->se_cmd.tag = req->orb_pointer; 1234 1237 if (target_submit_cmd(&req->se_cmd, sess->se_sess, req->cmd_buf, 1235 1238 req->sense_buf, unpacked_lun, data_length, 1236 - TCM_SIMPLE_TAG, data_dir, 0)) 1239 + TCM_SIMPLE_TAG, data_dir, TARGET_SCF_ACK_KREF)) 1237 1240 goto err; 1238 1241 1239 1242 return; ··· 1245 1248 STATUS_BLOCK_LEN(1) | 1246 1249 STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR)); 1247 1250 sbp_send_status(req); 1248 - sbp_free_request(req); 1249 1251 } 1250 1252 1251 1253 /* ··· 1343 1347 1344 1348 static int sbp_send_status(struct sbp_target_request *req) 1345 1349 { 1346 - int ret, length; 1350 + int rc, ret = 0, length; 1347 1351 struct sbp_login_descriptor *login = req->login; 1348 1352 1349 1353 length = (((be32_to_cpu(req->status.status) >> 24) & 0x07) + 1) * 4; 1350 1354 1351 - ret = sbp_run_request_transaction(req, TCODE_WRITE_BLOCK_REQUEST, 1355 + rc = sbp_run_request_transaction(req, TCODE_WRITE_BLOCK_REQUEST, 1352 1356 login->status_fifo_addr, &req->status, length); 1353 - if (ret != RCODE_COMPLETE) { 1354 - pr_debug("sbp_send_status: write failed: 0x%x\n", ret); 1355 - return -EIO; 1357 + if (rc != RCODE_COMPLETE) { 1358 + pr_debug("sbp_send_status: write failed: 0x%x\n", rc); 1359 + ret = -EIO; 1360 + goto put_ref; 1356 1361 } 1357 1362 1358 1363 pr_debug("sbp_send_status: status write complete for ORB: 0x%llx\n", 1359 1364 req->orb_pointer); 1360 - 1361 - return 0; 1365 + /* 1366 + * Drop the extra ACK_KREF reference taken by target_submit_cmd() 1367 + * ahead of sbp_check_stop_free() -> transport_generic_free_cmd() 1368 + * final se_cmd->cmd_kref put. 1369 + */ 1370 + put_ref: 1371 + target_put_sess_cmd(&req->se_cmd); 1372 + return ret; 1362 1373 } 1363 1374 1364 1375 static void sbp_sense_mangle(struct sbp_target_request *req) ··· 1825 1822 struct sbp_target_request *req = container_of(se_cmd, 1826 1823 struct sbp_target_request, se_cmd); 1827 1824 1828 - transport_generic_free_cmd(&req->se_cmd, 0); 1829 - return 1; 1825 + return transport_generic_free_cmd(&req->se_cmd, 0); 1830 1826 } 1831 1827 1832 1828 static int sbp_count_se_tpg_luns(struct se_portal_group *tpg)