aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/target/iscsi/iscsi_target.c56
-rw-r--r--drivers/target/iscsi/iscsi_target.h2
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c2
-rw-r--r--drivers/target/iscsi/iscsi_target_core.h3
-rw-r--r--drivers/target/iscsi/iscsi_target_datain_values.c17
-rw-r--r--drivers/target/iscsi/iscsi_target_erl1.c13
-rw-r--r--drivers/target/iscsi/iscsi_target_parameters.c8
-rw-r--r--drivers/target/iscsi/iscsi_target_seq_pdu_list.c25
-rw-r--r--drivers/target/iscsi/iscsi_target_tmr.c7
-rw-r--r--drivers/target/target_core_file.c11
-rw-r--r--drivers/target/target_core_pr.c31
-rw-r--r--drivers/target/target_core_transport.c21
12 files changed, 87 insertions, 109 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index fd2b6381cb48..179aaceeb732 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -593,7 +593,7 @@ static void __exit iscsi_target_cleanup_module(void)
593 kfree(iscsit_global); 593 kfree(iscsit_global);
594} 594}
595 595
596int iscsit_add_reject( 596static int iscsit_add_reject(
597 u8 reason, 597 u8 reason,
598 int fail_conn, 598 int fail_conn,
599 unsigned char *buf, 599 unsigned char *buf,
@@ -1442,7 +1442,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf)
1442 return 0; 1442 return 0;
1443 else if (ret == DATAOUT_SEND_R2T) { 1443 else if (ret == DATAOUT_SEND_R2T) {
1444 iscsit_set_dataout_sequence_values(cmd); 1444 iscsit_set_dataout_sequence_values(cmd);
1445 iscsit_build_r2ts_for_cmd(cmd, conn, 0); 1445 iscsit_build_r2ts_for_cmd(cmd, conn, false);
1446 } else if (ret == DATAOUT_SEND_TO_TRANSPORT) { 1446 } else if (ret == DATAOUT_SEND_TO_TRANSPORT) {
1447 /* 1447 /*
1448 * Handle extra special case for out of order 1448 * Handle extra special case for out of order
@@ -2950,15 +2950,13 @@ static int iscsit_send_r2t(
2950} 2950}
2951 2951
2952/* 2952/*
2953 * type 0: Normal Operation. 2953 * @recovery: If called from iscsi_task_reassign_complete_write() for
2954 * type 1: Called from Storage Transport. 2954 * connection recovery.
2955 * type 2: Called from iscsi_task_reassign_complete_write() for
2956 * connection recovery.
2957 */ 2955 */
2958int iscsit_build_r2ts_for_cmd( 2956int iscsit_build_r2ts_for_cmd(
2959 struct iscsi_cmd *cmd, 2957 struct iscsi_cmd *cmd,
2960 struct iscsi_conn *conn, 2958 struct iscsi_conn *conn,
2961 int type) 2959 bool recovery)
2962{ 2960{
2963 int first_r2t = 1; 2961 int first_r2t = 1;
2964 u32 offset = 0, xfer_len = 0; 2962 u32 offset = 0, xfer_len = 0;
@@ -2969,27 +2967,33 @@ int iscsit_build_r2ts_for_cmd(
2969 return 0; 2967 return 0;
2970 } 2968 }
2971 2969
2972 if (conn->sess->sess_ops->DataSequenceInOrder && (type != 2)) 2970 if (conn->sess->sess_ops->DataSequenceInOrder &&
2971 !recovery)
2973 cmd->r2t_offset = max(cmd->r2t_offset, cmd->write_data_done); 2972 cmd->r2t_offset = max(cmd->r2t_offset, cmd->write_data_done);
2974 2973
2975 while (cmd->outstanding_r2ts < conn->sess->sess_ops->MaxOutstandingR2T) { 2974 while (cmd->outstanding_r2ts < conn->sess->sess_ops->MaxOutstandingR2T) {
2976 if (conn->sess->sess_ops->DataSequenceInOrder) { 2975 if (conn->sess->sess_ops->DataSequenceInOrder) {
2977 offset = cmd->r2t_offset; 2976 offset = cmd->r2t_offset;
2978 2977
2979 if (first_r2t && (type == 2)) { 2978 if (first_r2t && recovery) {
2980 xfer_len = ((offset + 2979 int new_data_end = offset +
2981 (conn->sess->sess_ops->MaxBurstLength - 2980 conn->sess->sess_ops->MaxBurstLength -
2982 cmd->next_burst_len) > 2981 cmd->next_burst_len;
2983 cmd->data_length) ? 2982
2984 (cmd->data_length - offset) : 2983 if (new_data_end > cmd->data_length)
2985 (conn->sess->sess_ops->MaxBurstLength - 2984 xfer_len = cmd->data_length - offset;
2986 cmd->next_burst_len)); 2985 else
2986 xfer_len =
2987 conn->sess->sess_ops->MaxBurstLength -
2988 cmd->next_burst_len;
2987 } else { 2989 } else {
2988 xfer_len = ((offset + 2990 int new_data_end = offset +
2989 conn->sess->sess_ops->MaxBurstLength) > 2991 conn->sess->sess_ops->MaxBurstLength;
2990 cmd->data_length) ? 2992
2991 (cmd->data_length - offset) : 2993 if (new_data_end > cmd->data_length)
2992 conn->sess->sess_ops->MaxBurstLength; 2994 xfer_len = cmd->data_length - offset;
2995 else
2996 xfer_len = conn->sess->sess_ops->MaxBurstLength;
2993 } 2997 }
2994 cmd->r2t_offset += xfer_len; 2998 cmd->r2t_offset += xfer_len;
2995 2999
@@ -3225,6 +3229,8 @@ static bool iscsit_check_inaddr_any(struct iscsi_np *np)
3225 return ret; 3229 return ret;
3226} 3230}
3227 3231
3232#define SENDTARGETS_BUF_LIMIT 32768U
3233
3228static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) 3234static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
3229{ 3235{
3230 char *payload = NULL; 3236 char *payload = NULL;
@@ -3233,12 +3239,10 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
3233 struct iscsi_tiqn *tiqn; 3239 struct iscsi_tiqn *tiqn;
3234 struct iscsi_tpg_np *tpg_np; 3240 struct iscsi_tpg_np *tpg_np;
3235 int buffer_len, end_of_buf = 0, len = 0, payload_len = 0; 3241 int buffer_len, end_of_buf = 0, len = 0, payload_len = 0;
3236 unsigned char buf[256]; 3242 unsigned char buf[ISCSI_IQN_LEN+12]; /* iqn + "TargetName=" + \0 */
3237
3238 buffer_len = (conn->conn_ops->MaxRecvDataSegmentLength > 32768) ?
3239 32768 : conn->conn_ops->MaxRecvDataSegmentLength;
3240 3243
3241 memset(buf, 0, 256); 3244 buffer_len = max(conn->conn_ops->MaxRecvDataSegmentLength,
3245 SENDTARGETS_BUF_LIMIT);
3242 3246
3243 payload = kzalloc(buffer_len, GFP_KERNEL); 3247 payload = kzalloc(buffer_len, GFP_KERNEL);
3244 if (!payload) { 3248 if (!payload) {
diff --git a/drivers/target/iscsi/iscsi_target.h b/drivers/target/iscsi/iscsi_target.h
index 7934cdc91356..12abb4c9e34e 100644
--- a/drivers/target/iscsi/iscsi_target.h
+++ b/drivers/target/iscsi/iscsi_target.h
@@ -18,7 +18,7 @@ extern int iscsit_logout_closesession(struct iscsi_cmd *, struct iscsi_conn *);
18extern int iscsit_logout_closeconnection(struct iscsi_cmd *, struct iscsi_conn *); 18extern int iscsit_logout_closeconnection(struct iscsi_cmd *, struct iscsi_conn *);
19extern int iscsit_logout_removeconnforrecovery(struct iscsi_cmd *, struct iscsi_conn *); 19extern int iscsit_logout_removeconnforrecovery(struct iscsi_cmd *, struct iscsi_conn *);
20extern int iscsit_send_async_msg(struct iscsi_conn *, u16, u8, u8); 20extern int iscsit_send_async_msg(struct iscsi_conn *, u16, u8, u8);
21extern int iscsit_build_r2ts_for_cmd(struct iscsi_cmd *, struct iscsi_conn *, int); 21extern int iscsit_build_r2ts_for_cmd(struct iscsi_cmd *, struct iscsi_conn *, bool recovery);
22extern void iscsit_thread_get_cpumask(struct iscsi_conn *); 22extern void iscsit_thread_get_cpumask(struct iscsi_conn *);
23extern int iscsi_target_tx_thread(void *); 23extern int iscsi_target_tx_thread(void *);
24extern int iscsi_target_rx_thread(void *); 24extern int iscsi_target_rx_thread(void *);
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 00c58cc82c85..69dc8e35c03a 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1538,7 +1538,7 @@ static int lio_write_pending(struct se_cmd *se_cmd)
1538 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); 1538 struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
1539 1539
1540 if (!cmd->immediate_data && !cmd->unsolicited_data) 1540 if (!cmd->immediate_data && !cmd->unsolicited_data)
1541 return iscsit_build_r2ts_for_cmd(cmd, cmd->conn, 1); 1541 return iscsit_build_r2ts_for_cmd(cmd, cmd->conn, false);
1542 1542
1543 return 0; 1543 return 0;
1544} 1544}
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
index 8a1d18ae8872..1a9a64ab4feb 100644
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -296,12 +296,11 @@ struct iscsi_datain_req {
296 u32 runlength; 296 u32 runlength;
297 u32 data_length; 297 u32 data_length;
298 u32 data_offset; 298 u32 data_offset;
299 u32 data_offset_end;
300 u32 data_sn; 299 u32 data_sn;
301 u32 next_burst_len; 300 u32 next_burst_len;
302 u32 read_data_done; 301 u32 read_data_done;
303 u32 seq_send_order; 302 u32 seq_send_order;
304 struct list_head dr_list; 303 struct list_head cmd_datain_node;
305} ____cacheline_aligned; 304} ____cacheline_aligned;
306 305
307struct iscsi_ooo_cmdsn { 306struct iscsi_ooo_cmdsn {
diff --git a/drivers/target/iscsi/iscsi_target_datain_values.c b/drivers/target/iscsi/iscsi_target_datain_values.c
index 8c0495129513..c19ca42eac67 100644
--- a/drivers/target/iscsi/iscsi_target_datain_values.c
+++ b/drivers/target/iscsi/iscsi_target_datain_values.c
@@ -37,7 +37,7 @@ struct iscsi_datain_req *iscsit_allocate_datain_req(void)
37 " struct iscsi_datain_req\n"); 37 " struct iscsi_datain_req\n");
38 return NULL; 38 return NULL;
39 } 39 }
40 INIT_LIST_HEAD(&dr->dr_list); 40 INIT_LIST_HEAD(&dr->cmd_datain_node);
41 41
42 return dr; 42 return dr;
43} 43}
@@ -45,14 +45,14 @@ struct iscsi_datain_req *iscsit_allocate_datain_req(void)
45void iscsit_attach_datain_req(struct iscsi_cmd *cmd, struct iscsi_datain_req *dr) 45void iscsit_attach_datain_req(struct iscsi_cmd *cmd, struct iscsi_datain_req *dr)
46{ 46{
47 spin_lock(&cmd->datain_lock); 47 spin_lock(&cmd->datain_lock);
48 list_add_tail(&dr->dr_list, &cmd->datain_list); 48 list_add_tail(&dr->cmd_datain_node, &cmd->datain_list);
49 spin_unlock(&cmd->datain_lock); 49 spin_unlock(&cmd->datain_lock);
50} 50}
51 51
52void iscsit_free_datain_req(struct iscsi_cmd *cmd, struct iscsi_datain_req *dr) 52void iscsit_free_datain_req(struct iscsi_cmd *cmd, struct iscsi_datain_req *dr)
53{ 53{
54 spin_lock(&cmd->datain_lock); 54 spin_lock(&cmd->datain_lock);
55 list_del(&dr->dr_list); 55 list_del(&dr->cmd_datain_node);
56 spin_unlock(&cmd->datain_lock); 56 spin_unlock(&cmd->datain_lock);
57 57
58 kmem_cache_free(lio_dr_cache, dr); 58 kmem_cache_free(lio_dr_cache, dr);
@@ -63,8 +63,8 @@ void iscsit_free_all_datain_reqs(struct iscsi_cmd *cmd)
63 struct iscsi_datain_req *dr, *dr_tmp; 63 struct iscsi_datain_req *dr, *dr_tmp;
64 64
65 spin_lock(&cmd->datain_lock); 65 spin_lock(&cmd->datain_lock);
66 list_for_each_entry_safe(dr, dr_tmp, &cmd->datain_list, dr_list) { 66 list_for_each_entry_safe(dr, dr_tmp, &cmd->datain_list, cmd_datain_node) {
67 list_del(&dr->dr_list); 67 list_del(&dr->cmd_datain_node);
68 kmem_cache_free(lio_dr_cache, dr); 68 kmem_cache_free(lio_dr_cache, dr);
69 } 69 }
70 spin_unlock(&cmd->datain_lock); 70 spin_unlock(&cmd->datain_lock);
@@ -72,17 +72,14 @@ void iscsit_free_all_datain_reqs(struct iscsi_cmd *cmd)
72 72
73struct iscsi_datain_req *iscsit_get_datain_req(struct iscsi_cmd *cmd) 73struct iscsi_datain_req *iscsit_get_datain_req(struct iscsi_cmd *cmd)
74{ 74{
75 struct iscsi_datain_req *dr;
76
77 if (list_empty(&cmd->datain_list)) { 75 if (list_empty(&cmd->datain_list)) {
78 pr_err("cmd->datain_list is empty for ITT:" 76 pr_err("cmd->datain_list is empty for ITT:"
79 " 0x%08x\n", cmd->init_task_tag); 77 " 0x%08x\n", cmd->init_task_tag);
80 return NULL; 78 return NULL;
81 } 79 }
82 list_for_each_entry(dr, &cmd->datain_list, dr_list)
83 break;
84 80
85 return dr; 81 return list_first_entry(&cmd->datain_list, struct iscsi_datain_req,
82 cmd_datain_node);
86} 83}
87 84
88/* 85/*
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index f6d1a23875a0..6deb8495d5f2 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -279,11 +279,9 @@ int iscsit_create_recovery_datain_values_datasequenceinorder_no(
279 * seq->first_datasn and seq->last_datasn have not been set. 279 * seq->first_datasn and seq->last_datasn have not been set.
280 */ 280 */
281 if (!seq->sent) { 281 if (!seq->sent) {
282#if 0
283 pr_err("Ignoring non-sent sequence 0x%08x ->" 282 pr_err("Ignoring non-sent sequence 0x%08x ->"
284 " 0x%08x\n\n", seq->first_datasn, 283 " 0x%08x\n\n", seq->first_datasn,
285 seq->last_datasn); 284 seq->last_datasn);
286#endif
287 continue; 285 continue;
288 } 286 }
289 287
@@ -294,11 +292,10 @@ int iscsit_create_recovery_datain_values_datasequenceinorder_no(
294 */ 292 */
295 if ((seq->first_datasn < begrun) && 293 if ((seq->first_datasn < begrun) &&
296 (seq->last_datasn < begrun)) { 294 (seq->last_datasn < begrun)) {
297#if 0
298 pr_err("Pre BegRun sequence 0x%08x ->" 295 pr_err("Pre BegRun sequence 0x%08x ->"
299 " 0x%08x\n", seq->first_datasn, 296 " 0x%08x\n", seq->first_datasn,
300 seq->last_datasn); 297 seq->last_datasn);
301#endif 298
302 read_data_done += cmd->seq_list[i].xfer_len; 299 read_data_done += cmd->seq_list[i].xfer_len;
303 seq->next_burst_len = seq->pdu_send_order = 0; 300 seq->next_burst_len = seq->pdu_send_order = 0;
304 continue; 301 continue;
@@ -309,11 +306,10 @@ int iscsit_create_recovery_datain_values_datasequenceinorder_no(
309 */ 306 */
310 if ((seq->first_datasn <= begrun) && 307 if ((seq->first_datasn <= begrun) &&
311 (seq->last_datasn >= begrun)) { 308 (seq->last_datasn >= begrun)) {
312#if 0
313 pr_err("Found sequence begrun: 0x%08x in" 309 pr_err("Found sequence begrun: 0x%08x in"
314 " 0x%08x -> 0x%08x\n", begrun, 310 " 0x%08x -> 0x%08x\n", begrun,
315 seq->first_datasn, seq->last_datasn); 311 seq->first_datasn, seq->last_datasn);
316#endif 312
317 seq_send_order = seq->seq_send_order; 313 seq_send_order = seq->seq_send_order;
318 data_sn = seq->first_datasn; 314 data_sn = seq->first_datasn;
319 seq->next_burst_len = seq->pdu_send_order = 0; 315 seq->next_burst_len = seq->pdu_send_order = 0;
@@ -369,10 +365,9 @@ int iscsit_create_recovery_datain_values_datasequenceinorder_no(
369 */ 365 */
370 if ((seq->first_datasn > begrun) || 366 if ((seq->first_datasn > begrun) ||
371 (seq->last_datasn > begrun)) { 367 (seq->last_datasn > begrun)) {
372#if 0
373 pr_err("Post BegRun sequence 0x%08x -> 0x%08x\n", 368 pr_err("Post BegRun sequence 0x%08x -> 0x%08x\n",
374 seq->first_datasn, seq->last_datasn); 369 seq->first_datasn, seq->last_datasn);
375#endif 370
376 seq->next_burst_len = seq->pdu_send_order = 0; 371 seq->next_burst_len = seq->pdu_send_order = 0;
377 continue; 372 continue;
378 } 373 }
@@ -987,7 +982,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo)
987 return 0; 982 return 0;
988 983
989 iscsit_set_dataout_sequence_values(cmd); 984 iscsit_set_dataout_sequence_values(cmd);
990 iscsit_build_r2ts_for_cmd(cmd, cmd->conn, 0); 985 iscsit_build_r2ts_for_cmd(cmd, cmd->conn, false);
991 } 986 }
992 return 0; 987 return 0;
993 } 988 }
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
index eb05c9d751ea..ad3b3c1605d8 100644
--- a/drivers/target/iscsi/iscsi_target_parameters.c
+++ b/drivers/target/iscsi/iscsi_target_parameters.c
@@ -803,14 +803,6 @@ static int iscsi_check_numerical_value(struct iscsi_param *param, char *value_pt
803 803
804 value = simple_strtoul(value_ptr, &tmpptr, 0); 804 value = simple_strtoul(value_ptr, &tmpptr, 0);
805 805
806/* #warning FIXME: Fix this */
807#if 0
808 if (strspn(endptr, WHITE_SPACE) != strlen(endptr)) {
809 pr_err("Illegal value \"%s\" for \"%s\".\n",
810 value, param->name);
811 return -1;
812 }
813#endif
814 if (IS_TYPERANGE_0_TO_2(param)) { 806 if (IS_TYPERANGE_0_TO_2(param)) {
815 if ((value < 0) || (value > 2)) { 807 if ((value < 0) || (value > 2)) {
816 pr_err("Illegal value for \"%s\", must be" 808 pr_err("Illegal value for \"%s\", must be"
diff --git a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c
index fc694082bfc0..c69c7577ad14 100644
--- a/drivers/target/iscsi/iscsi_target_seq_pdu_list.c
+++ b/drivers/target/iscsi/iscsi_target_seq_pdu_list.c
@@ -28,7 +28,8 @@
28 28
29#define OFFLOAD_BUF_SIZE 32768 29#define OFFLOAD_BUF_SIZE 32768
30 30
31void iscsit_dump_seq_list(struct iscsi_cmd *cmd) 31#ifdef DEBUG
32static void iscsit_dump_seq_list(struct iscsi_cmd *cmd)
32{ 33{
33 int i; 34 int i;
34 struct iscsi_seq *seq; 35 struct iscsi_seq *seq;
@@ -46,7 +47,7 @@ void iscsit_dump_seq_list(struct iscsi_cmd *cmd)
46 } 47 }
47} 48}
48 49
49void iscsit_dump_pdu_list(struct iscsi_cmd *cmd) 50static void iscsit_dump_pdu_list(struct iscsi_cmd *cmd)
50{ 51{
51 int i; 52 int i;
52 struct iscsi_pdu *pdu; 53 struct iscsi_pdu *pdu;
@@ -61,6 +62,10 @@ void iscsit_dump_pdu_list(struct iscsi_cmd *cmd)
61 pdu->length, pdu->pdu_send_order, pdu->seq_no); 62 pdu->length, pdu->pdu_send_order, pdu->seq_no);
62 } 63 }
63} 64}
65#else
66static void iscsit_dump_seq_list(struct iscsi_cmd *cmd) {}
67static void iscsit_dump_pdu_list(struct iscsi_cmd *cmd) {}
68#endif
64 69
65static void iscsit_ordered_seq_lists( 70static void iscsit_ordered_seq_lists(
66 struct iscsi_cmd *cmd, 71 struct iscsi_cmd *cmd,
@@ -464,9 +469,8 @@ static int iscsit_build_pdu_and_seq_list(
464 } else 469 } else
465 iscsit_ordered_seq_lists(cmd, bl->type); 470 iscsit_ordered_seq_lists(cmd, bl->type);
466 } 471 }
467#if 0 472
468 iscsit_dump_seq_list(cmd); 473 iscsit_dump_seq_list(cmd);
469#endif
470 } 474 }
471 if (!datapduinorder) { 475 if (!datapduinorder) {
472 if (bl->data_direction & ISCSI_PDU_WRITE) { 476 if (bl->data_direction & ISCSI_PDU_WRITE) {
@@ -484,9 +488,8 @@ static int iscsit_build_pdu_and_seq_list(
484 } else 488 } else
485 iscsit_ordered_pdu_lists(cmd, bl->type); 489 iscsit_ordered_pdu_lists(cmd, bl->type);
486 } 490 }
487#if 0 491
488 iscsit_dump_pdu_list(cmd); 492 iscsit_dump_pdu_list(cmd);
489#endif
490 } 493 }
491 494
492 return 0; 495 return 0;
@@ -572,13 +575,12 @@ redo:
572 pdu = &cmd->pdu_list[cmd->pdu_start]; 575 pdu = &cmd->pdu_list[cmd->pdu_start];
573 576
574 for (i = 0; pdu[i].seq_no != cmd->seq_no; i++) { 577 for (i = 0; pdu[i].seq_no != cmd->seq_no; i++) {
575#if 0
576 pr_debug("pdu[i].seq_no: %d, pdu[i].pdu" 578 pr_debug("pdu[i].seq_no: %d, pdu[i].pdu"
577 "_send_order: %d, pdu[i].offset: %d," 579 "_send_order: %d, pdu[i].offset: %d,"
578 " pdu[i].length: %d\n", pdu[i].seq_no, 580 " pdu[i].length: %d\n", pdu[i].seq_no,
579 pdu[i].pdu_send_order, pdu[i].offset, 581 pdu[i].pdu_send_order, pdu[i].offset,
580 pdu[i].length); 582 pdu[i].length);
581#endif 583
582 if (pdu[i].pdu_send_order == cmd->pdu_send_order) { 584 if (pdu[i].pdu_send_order == cmd->pdu_send_order) {
583 cmd->pdu_send_order++; 585 cmd->pdu_send_order++;
584 return &pdu[i]; 586 return &pdu[i];
@@ -601,11 +603,11 @@ redo:
601 pr_err("struct iscsi_seq is NULL!\n"); 603 pr_err("struct iscsi_seq is NULL!\n");
602 return NULL; 604 return NULL;
603 } 605 }
604#if 0 606
605 pr_debug("seq->pdu_start: %d, seq->pdu_count: %d," 607 pr_debug("seq->pdu_start: %d, seq->pdu_count: %d,"
606 " seq->seq_no: %d\n", seq->pdu_start, seq->pdu_count, 608 " seq->seq_no: %d\n", seq->pdu_start, seq->pdu_count,
607 seq->seq_no); 609 seq->seq_no);
608#endif 610
609 pdu = &cmd->pdu_list[seq->pdu_start]; 611 pdu = &cmd->pdu_list[seq->pdu_start];
610 612
611 if (seq->pdu_send_order == seq->pdu_count) { 613 if (seq->pdu_send_order == seq->pdu_count) {
@@ -645,12 +647,11 @@ struct iscsi_seq *iscsit_get_seq_holder(
645 } 647 }
646 648
647 for (i = 0; i < cmd->seq_count; i++) { 649 for (i = 0; i < cmd->seq_count; i++) {
648#if 0
649 pr_debug("seq_list[i].orig_offset: %d, seq_list[i]." 650 pr_debug("seq_list[i].orig_offset: %d, seq_list[i]."
650 "xfer_len: %d, seq_list[i].seq_no %u\n", 651 "xfer_len: %d, seq_list[i].seq_no %u\n",
651 cmd->seq_list[i].orig_offset, cmd->seq_list[i].xfer_len, 652 cmd->seq_list[i].orig_offset, cmd->seq_list[i].xfer_len,
652 cmd->seq_list[i].seq_no); 653 cmd->seq_list[i].seq_no);
653#endif 654
654 if ((cmd->seq_list[i].orig_offset + 655 if ((cmd->seq_list[i].orig_offset +
655 cmd->seq_list[i].xfer_len) >= 656 cmd->seq_list[i].xfer_len) >=
656 (offset + length)) 657 (offset + length))
diff --git a/drivers/target/iscsi/iscsi_target_tmr.c b/drivers/target/iscsi/iscsi_target_tmr.c
index 1fcdf99be76f..3f025fa10467 100644
--- a/drivers/target/iscsi/iscsi_target_tmr.c
+++ b/drivers/target/iscsi/iscsi_target_tmr.c
@@ -78,10 +78,7 @@ int iscsit_tmr_task_warm_reset(
78{ 78{
79 struct iscsi_session *sess = conn->sess; 79 struct iscsi_session *sess = conn->sess;
80 struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess); 80 struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess);
81#if 0 81
82 struct iscsi_init_task_mgt_cmnd *hdr =
83 (struct iscsi_init_task_mgt_cmnd *) buf;
84#endif
85 if (!na->tmr_warm_reset) { 82 if (!na->tmr_warm_reset) {
86 pr_err("TMR Opcode TARGET_WARM_RESET authorization" 83 pr_err("TMR Opcode TARGET_WARM_RESET authorization"
87 " failed for Initiator Node: %s\n", 84 " failed for Initiator Node: %s\n",
@@ -292,7 +289,7 @@ static int iscsit_task_reassign_complete_write(
292 /* 289 /*
293 * iscsit_build_r2ts_for_cmd() can handle the rest from here. 290 * iscsit_build_r2ts_for_cmd() can handle the rest from here.
294 */ 291 */
295 return iscsit_build_r2ts_for_cmd(cmd, conn, 2); 292 return iscsit_build_r2ts_for_cmd(cmd, conn, true);
296} 293}
297 294
298static int iscsit_task_reassign_complete_read( 295static int iscsit_task_reassign_complete_read(
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 7ed58e2df791..c3e899e551a5 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -133,15 +133,10 @@ static struct se_device *fd_create_virtdevice(
133 ret = PTR_ERR(dev_p); 133 ret = PTR_ERR(dev_p);
134 goto fail; 134 goto fail;
135 } 135 }
136#if 0 136
137 if (di->no_create_file) 137 /* O_DIRECT too? */
138 flags = O_RDWR | O_LARGEFILE;
139 else
140 flags = O_RDWR | O_CREAT | O_LARGEFILE;
141#else
142 flags = O_RDWR | O_CREAT | O_LARGEFILE; 138 flags = O_RDWR | O_CREAT | O_LARGEFILE;
143#endif 139
144/* flags |= O_DIRECT; */
145 /* 140 /*
146 * If fd_buffered_io=1 has not been set explicitly (the default), 141 * If fd_buffered_io=1 has not been set explicitly (the default),
147 * use O_SYNC to force FILEIO writes to disk. 142 * use O_SYNC to force FILEIO writes to disk.
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 86f0c3b5d500..9754819b6042 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -500,11 +500,10 @@ static int core_scsi3_pr_seq_non_holder(
500 * statement. 500 * statement.
501 */ 501 */
502 if (!ret && !other_cdb) { 502 if (!ret && !other_cdb) {
503#if 0
504 pr_debug("Allowing explict CDB: 0x%02x for %s" 503 pr_debug("Allowing explict CDB: 0x%02x for %s"
505 " reservation holder\n", cdb[0], 504 " reservation holder\n", cdb[0],
506 core_scsi3_pr_dump_type(pr_reg_type)); 505 core_scsi3_pr_dump_type(pr_reg_type));
507#endif 506
508 return ret; 507 return ret;
509 } 508 }
510 /* 509 /*
@@ -532,14 +531,14 @@ static int core_scsi3_pr_seq_non_holder(
532 * as we expect registered non-reservation holding 531 * as we expect registered non-reservation holding
533 * nexuses to issue CDBs. 532 * nexuses to issue CDBs.
534 */ 533 */
535#if 0 534
536 if (!registered_nexus) { 535 if (!registered_nexus) {
537 pr_debug("Allowing implict CDB: 0x%02x" 536 pr_debug("Allowing implict CDB: 0x%02x"
538 " for %s reservation on unregistered" 537 " for %s reservation on unregistered"
539 " nexus\n", cdb[0], 538 " nexus\n", cdb[0],
540 core_scsi3_pr_dump_type(pr_reg_type)); 539 core_scsi3_pr_dump_type(pr_reg_type));
541 } 540 }
542#endif 541
543 return 0; 542 return 0;
544 } 543 }
545 } else if ((reg_only) || (all_reg)) { 544 } else if ((reg_only) || (all_reg)) {
@@ -548,11 +547,11 @@ static int core_scsi3_pr_seq_non_holder(
548 * For PR_*_REG_ONLY and PR_*_ALL_REG reservations, 547 * For PR_*_REG_ONLY and PR_*_ALL_REG reservations,
549 * allow commands from registered nexuses. 548 * allow commands from registered nexuses.
550 */ 549 */
551#if 0 550
552 pr_debug("Allowing implict CDB: 0x%02x for %s" 551 pr_debug("Allowing implict CDB: 0x%02x for %s"
553 " reservation\n", cdb[0], 552 " reservation\n", cdb[0],
554 core_scsi3_pr_dump_type(pr_reg_type)); 553 core_scsi3_pr_dump_type(pr_reg_type));
555#endif 554
556 return 0; 555 return 0;
557 } 556 }
558 } 557 }
@@ -1666,12 +1665,12 @@ static int core_scsi3_decode_spec_i_port(
1666 ret = -EINVAL; 1665 ret = -EINVAL;
1667 goto out; 1666 goto out;
1668 } 1667 }
1669#if 0 1668
1670 pr_debug("SPC-3 PR SPEC_I_PT: Got %s data_length: %u tpdl: %u" 1669 pr_debug("SPC-3 PR SPEC_I_PT: Got %s data_length: %u tpdl: %u"
1671 " tid_len: %d for %s + %s\n", 1670 " tid_len: %d for %s + %s\n",
1672 dest_tpg->se_tpg_tfo->get_fabric_name(), cmd->data_length, 1671 dest_tpg->se_tpg_tfo->get_fabric_name(), cmd->data_length,
1673 tpdl, tid_len, i_str, iport_ptr); 1672 tpdl, tid_len, i_str, iport_ptr);
1674#endif 1673
1675 if (tid_len > tpdl) { 1674 if (tid_len > tpdl) {
1676 pr_err("SPC-3 PR SPEC_I_PT: Illegal tid_len:" 1675 pr_err("SPC-3 PR SPEC_I_PT: Illegal tid_len:"
1677 " %u for Transport ID: %s\n", tid_len, ptr); 1676 " %u for Transport ID: %s\n", tid_len, ptr);
@@ -1714,12 +1713,12 @@ static int core_scsi3_decode_spec_i_port(
1714 ret = -EINVAL; 1713 ret = -EINVAL;
1715 goto out; 1714 goto out;
1716 } 1715 }
1717#if 0 1716
1718 pr_debug("SPC-3 PR SPEC_I_PT: Located %s Node: %s" 1717 pr_debug("SPC-3 PR SPEC_I_PT: Located %s Node: %s"
1719 " dest_se_deve mapped_lun: %u\n", 1718 " dest_se_deve mapped_lun: %u\n",
1720 dest_tpg->se_tpg_tfo->get_fabric_name(), 1719 dest_tpg->se_tpg_tfo->get_fabric_name(),
1721 dest_node_acl->initiatorname, dest_se_deve->mapped_lun); 1720 dest_node_acl->initiatorname, dest_se_deve->mapped_lun);
1722#endif 1721
1723 /* 1722 /*
1724 * Skip any TransportIDs that already have a registration for 1723 * Skip any TransportIDs that already have a registration for
1725 * this target port. 1724 * this target port.
@@ -3473,10 +3472,10 @@ static int core_scsi3_emulate_pro_register_and_move(
3473 3472
3474 buf = transport_kmap_data_sg(cmd); 3473 buf = transport_kmap_data_sg(cmd);
3475 proto_ident = (buf[24] & 0x0f); 3474 proto_ident = (buf[24] & 0x0f);
3476#if 0 3475
3477 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:" 3476 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:"
3478 " 0x%02x\n", proto_ident); 3477 " 0x%02x\n", proto_ident);
3479#endif 3478
3480 if (proto_ident != dest_tf_ops->get_fabric_proto_ident(dest_se_tpg)) { 3479 if (proto_ident != dest_tf_ops->get_fabric_proto_ident(dest_se_tpg)) {
3481 pr_err("SPC-3 PR REGISTER_AND_MOVE: Received" 3480 pr_err("SPC-3 PR REGISTER_AND_MOVE: Received"
3482 " proto_ident: 0x%02x does not match ident: 0x%02x" 3481 " proto_ident: 0x%02x does not match ident: 0x%02x"
@@ -3575,11 +3574,11 @@ after_iport_check:
3575 ret = -EINVAL; 3574 ret = -EINVAL;
3576 goto out; 3575 goto out;
3577 } 3576 }
3578#if 0 3577
3579 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Found %s dest_node_acl:" 3578 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Found %s dest_node_acl:"
3580 " %s from TransportID\n", dest_tf_ops->get_fabric_name(), 3579 " %s from TransportID\n", dest_tf_ops->get_fabric_name(),
3581 dest_node_acl->initiatorname); 3580 dest_node_acl->initiatorname);
3582#endif 3581
3583 /* 3582 /*
3584 * Locate the struct se_dev_entry pointer for the matching RELATIVE TARGET 3583 * Locate the struct se_dev_entry pointer for the matching RELATIVE TARGET
3585 * PORT IDENTIFIER. 3584 * PORT IDENTIFIER.
@@ -3603,12 +3602,12 @@ after_iport_check:
3603 ret = -EINVAL; 3602 ret = -EINVAL;
3604 goto out; 3603 goto out;
3605 } 3604 }
3606#if 0 3605
3607 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Located %s node %s LUN" 3606 pr_debug("SPC-3 PR REGISTER_AND_MOVE: Located %s node %s LUN"
3608 " ACL for dest_se_deve->mapped_lun: %u\n", 3607 " ACL for dest_se_deve->mapped_lun: %u\n",
3609 dest_tf_ops->get_fabric_name(), dest_node_acl->initiatorname, 3608 dest_tf_ops->get_fabric_name(), dest_node_acl->initiatorname,
3610 dest_se_deve->mapped_lun); 3609 dest_se_deve->mapped_lun);
3611#endif 3610
3612 /* 3611 /*
3613 * A persistent reservation needs to already existing in order to 3612 * A persistent reservation needs to already existing in order to
3614 * successfully complete the REGISTER_AND_MOVE service action.. 3613 * successfully complete the REGISTER_AND_MOVE service action..
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 9fdc708d5040..1bd8837543a8 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2394,12 +2394,12 @@ static inline u32 transport_get_size(
2394 } else /* bytes */ 2394 } else /* bytes */
2395 return sectors; 2395 return sectors;
2396 } 2396 }
2397#if 0 2397
2398 pr_debug("Returning block_size: %u, sectors: %u == %u for" 2398 pr_debug("Returning block_size: %u, sectors: %u == %u for"
2399 " %s object\n", dev->se_sub_dev->se_dev_attrib.block_size, sectors, 2399 " %s object\n", dev->se_sub_dev->se_dev_attrib.block_size,
2400 dev->se_sub_dev->se_dev_attrib.block_size * sectors, 2400 sectors, dev->se_sub_dev->se_dev_attrib.block_size * sectors,
2401 dev->transport->name); 2401 dev->transport->name);
2402#endif 2402
2403 return dev->se_sub_dev->se_dev_attrib.block_size * sectors; 2403 return dev->se_sub_dev->se_dev_attrib.block_size * sectors;
2404} 2404}
2405 2405
@@ -2617,11 +2617,10 @@ static int transport_generic_cmd_sequencer(
2617 * by the ALUA primary or secondary access state.. 2617 * by the ALUA primary or secondary access state..
2618 */ 2618 */
2619 if (ret > 0) { 2619 if (ret > 0) {
2620#if 0
2621 pr_debug("[%s]: ALUA TG Port not available," 2620 pr_debug("[%s]: ALUA TG Port not available,"
2622 " SenseKey: NOT_READY, ASC/ASCQ: 0x04/0x%02x\n", 2621 " SenseKey: NOT_READY, ASC/ASCQ: 0x04/0x%02x\n",
2623 cmd->se_tfo->get_fabric_name(), alua_ascq); 2622 cmd->se_tfo->get_fabric_name(), alua_ascq);
2624#endif 2623
2625 transport_set_sense_codes(cmd, 0x04, alua_ascq); 2624 transport_set_sense_codes(cmd, 0x04, alua_ascq);
2626 cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; 2625 cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
2627 cmd->scsi_sense_reason = TCM_CHECK_CONDITION_NOT_READY; 2626 cmd->scsi_sense_reason = TCM_CHECK_CONDITION_NOT_READY;
@@ -4564,12 +4563,12 @@ int transport_check_aborted_status(struct se_cmd *cmd, int send_status)
4564 if (!send_status || 4563 if (!send_status ||
4565 (cmd->se_cmd_flags & SCF_SENT_DELAYED_TAS)) 4564 (cmd->se_cmd_flags & SCF_SENT_DELAYED_TAS))
4566 return 1; 4565 return 1;
4567#if 0 4566
4568 pr_debug("Sending delayed SAM_STAT_TASK_ABORTED" 4567 pr_debug("Sending delayed SAM_STAT_TASK_ABORTED"
4569 " status for CDB: 0x%02x ITT: 0x%08x\n", 4568 " status for CDB: 0x%02x ITT: 0x%08x\n",
4570 cmd->t_task_cdb[0], 4569 cmd->t_task_cdb[0],
4571 cmd->se_tfo->get_task_tag(cmd)); 4570 cmd->se_tfo->get_task_tag(cmd));
4572#endif 4571
4573 cmd->se_cmd_flags |= SCF_SENT_DELAYED_TAS; 4572 cmd->se_cmd_flags |= SCF_SENT_DELAYED_TAS;
4574 cmd->se_tfo->queue_status(cmd); 4573 cmd->se_tfo->queue_status(cmd);
4575 ret = 1; 4574 ret = 1;
@@ -4602,11 +4601,11 @@ void transport_send_task_abort(struct se_cmd *cmd)
4602 } 4601 }
4603 } 4602 }
4604 cmd->scsi_status = SAM_STAT_TASK_ABORTED; 4603 cmd->scsi_status = SAM_STAT_TASK_ABORTED;
4605#if 0 4604
4606 pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x," 4605 pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x,"
4607 " ITT: 0x%08x\n", cmd->t_task_cdb[0], 4606 " ITT: 0x%08x\n", cmd->t_task_cdb[0],
4608 cmd->se_tfo->get_task_tag(cmd)); 4607 cmd->se_tfo->get_task_tag(cmd));
4609#endif 4608
4610 cmd->se_tfo->queue_status(cmd); 4609 cmd->se_tfo->queue_status(cmd);
4611} 4610}
4612 4611