Skip to content

Commit b98b809

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Four non-core fixes. Two are reverts of target fixes which turned out to have unwanted side effects, one is a revert of an RDMA fix with the same problem and the final one fixes an incorrect warning about memory allocation failures in megaraid_sas (the driver actually reduces the allocation size until it succeeds)" Signed-off-by: James E.J. Bottomley <[email protected]> * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: Revert "target: iscsi: Wait for all commands to finish before freeing a session" scsi: Revert "RDMA/isert: Fix a recently introduced regression related to logout" scsi: megaraid_sas: silence a warning scsi: Revert "target/core: Inline transport_lun_remove_cmd()"
2 parents 5b442b1 + 807b951 commit b98b809

File tree

5 files changed

+48
-17
lines changed

5 files changed

+48
-17
lines changed

drivers/infiniband/ulp/isert/ib_isert.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,6 +2575,17 @@ isert_wait4logout(struct isert_conn *isert_conn)
25752575
}
25762576
}
25772577

2578+
static void
2579+
isert_wait4cmds(struct iscsi_conn *conn)
2580+
{
2581+
isert_info("iscsi_conn %p\n", conn);
2582+
2583+
if (conn->sess) {
2584+
target_sess_cmd_list_set_waiting(conn->sess->se_sess);
2585+
target_wait_for_sess_cmds(conn->sess->se_sess);
2586+
}
2587+
}
2588+
25782589
/**
25792590
* isert_put_unsol_pending_cmds() - Drop commands waiting for
25802591
* unsolicitate dataout
@@ -2622,6 +2633,7 @@ static void isert_wait_conn(struct iscsi_conn *conn)
26222633

26232634
ib_drain_qp(isert_conn->qp);
26242635
isert_put_unsol_pending_cmds(conn);
2636+
isert_wait4cmds(conn);
26252637
isert_wait4logout(isert_conn);
26262638

26272639
queue_work(isert_release_wq, &isert_conn->release_work);

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
623623

624624
fusion->io_request_frames =
625625
dma_pool_alloc(fusion->io_request_frames_pool,
626-
GFP_KERNEL, &fusion->io_request_frames_phys);
626+
GFP_KERNEL | __GFP_NOWARN,
627+
&fusion->io_request_frames_phys);
627628
if (!fusion->io_request_frames) {
628629
if (instance->max_fw_cmds >= (MEGASAS_REDUCE_QD_COUNT * 2)) {
629630
instance->max_fw_cmds -= MEGASAS_REDUCE_QD_COUNT;
@@ -661,7 +662,7 @@ megasas_alloc_request_fusion(struct megasas_instance *instance)
661662

662663
fusion->io_request_frames =
663664
dma_pool_alloc(fusion->io_request_frames_pool,
664-
GFP_KERNEL,
665+
GFP_KERNEL | __GFP_NOWARN,
665666
&fusion->io_request_frames_phys);
666667

667668
if (!fusion->io_request_frames) {

drivers/target/iscsi/iscsi_target.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,9 +1165,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
11651165
hdr->cmdsn, be32_to_cpu(hdr->data_length), payload_length,
11661166
conn->cid);
11671167

1168-
if (target_get_sess_cmd(&cmd->se_cmd, true) < 0)
1169-
return iscsit_add_reject_cmd(cmd,
1170-
ISCSI_REASON_WAITING_FOR_LOGOUT, buf);
1168+
target_get_sess_cmd(&cmd->se_cmd, true);
11711169

11721170
cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd,
11731171
scsilun_to_int(&hdr->lun));
@@ -2004,9 +2002,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
20042002
conn->sess->se_sess, 0, DMA_NONE,
20052003
TCM_SIMPLE_TAG, cmd->sense_buffer + 2);
20062004

2007-
if (target_get_sess_cmd(&cmd->se_cmd, true) < 0)
2008-
return iscsit_add_reject_cmd(cmd,
2009-
ISCSI_REASON_WAITING_FOR_LOGOUT, buf);
2005+
target_get_sess_cmd(&cmd->se_cmd, true);
20102006

20112007
/*
20122008
* TASK_REASSIGN for ERL=2 / connection stays inside of
@@ -4149,6 +4145,9 @@ int iscsit_close_connection(
41494145
iscsit_stop_nopin_response_timer(conn);
41504146
iscsit_stop_nopin_timer(conn);
41514147

4148+
if (conn->conn_transport->iscsit_wait_conn)
4149+
conn->conn_transport->iscsit_wait_conn(conn);
4150+
41524151
/*
41534152
* During Connection recovery drop unacknowledged out of order
41544153
* commands for this connection, and prepare the other commands
@@ -4231,11 +4230,6 @@ int iscsit_close_connection(
42314230
* must wait until they have completed.
42324231
*/
42334232
iscsit_check_conn_usage_count(conn);
4234-
target_sess_cmd_list_set_waiting(sess->se_sess);
4235-
target_wait_for_sess_cmds(sess->se_sess);
4236-
4237-
if (conn->conn_transport->iscsit_wait_conn)
4238-
conn->conn_transport->iscsit_wait_conn(conn);
42394233

42404234
ahash_request_free(conn->conn_tx_hash);
42414235
if (conn->conn_rx_hash) {

drivers/target/target_core_transport.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ static int transport_cmd_check_stop_to_fabric(struct se_cmd *cmd)
666666

667667
target_remove_from_state_list(cmd);
668668

669+
/*
670+
* Clear struct se_cmd->se_lun before the handoff to FE.
671+
*/
672+
cmd->se_lun = NULL;
673+
669674
spin_lock_irqsave(&cmd->t_state_lock, flags);
670675
/*
671676
* Determine if frontend context caller is requesting the stopping of
@@ -693,6 +698,17 @@ static int transport_cmd_check_stop_to_fabric(struct se_cmd *cmd)
693698
return cmd->se_tfo->check_stop_free(cmd);
694699
}
695700

701+
static void transport_lun_remove_cmd(struct se_cmd *cmd)
702+
{
703+
struct se_lun *lun = cmd->se_lun;
704+
705+
if (!lun)
706+
return;
707+
708+
if (cmpxchg(&cmd->lun_ref_active, true, false))
709+
percpu_ref_put(&lun->lun_ref);
710+
}
711+
696712
static void target_complete_failure_work(struct work_struct *work)
697713
{
698714
struct se_cmd *cmd = container_of(work, struct se_cmd, work);
@@ -783,6 +799,8 @@ static void target_handle_abort(struct se_cmd *cmd)
783799

784800
WARN_ON_ONCE(kref_read(&cmd->cmd_kref) == 0);
785801

802+
transport_lun_remove_cmd(cmd);
803+
786804
transport_cmd_check_stop_to_fabric(cmd);
787805
}
788806

@@ -1708,6 +1726,7 @@ static void target_complete_tmr_failure(struct work_struct *work)
17081726
se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
17091727
se_cmd->se_tfo->queue_tm_rsp(se_cmd);
17101728

1729+
transport_lun_remove_cmd(se_cmd);
17111730
transport_cmd_check_stop_to_fabric(se_cmd);
17121731
}
17131732

@@ -1898,6 +1917,7 @@ void transport_generic_request_failure(struct se_cmd *cmd,
18981917
goto queue_full;
18991918

19001919
check_stop:
1920+
transport_lun_remove_cmd(cmd);
19011921
transport_cmd_check_stop_to_fabric(cmd);
19021922
return;
19031923

@@ -2195,6 +2215,7 @@ static void transport_complete_qf(struct se_cmd *cmd)
21952215
transport_handle_queue_full(cmd, cmd->se_dev, ret, false);
21962216
return;
21972217
}
2218+
transport_lun_remove_cmd(cmd);
21982219
transport_cmd_check_stop_to_fabric(cmd);
21992220
}
22002221

@@ -2289,6 +2310,7 @@ static void target_complete_ok_work(struct work_struct *work)
22892310
if (ret)
22902311
goto queue_full;
22912312

2313+
transport_lun_remove_cmd(cmd);
22922314
transport_cmd_check_stop_to_fabric(cmd);
22932315
return;
22942316
}
@@ -2314,6 +2336,7 @@ static void target_complete_ok_work(struct work_struct *work)
23142336
if (ret)
23152337
goto queue_full;
23162338

2339+
transport_lun_remove_cmd(cmd);
23172340
transport_cmd_check_stop_to_fabric(cmd);
23182341
return;
23192342
}
@@ -2349,6 +2372,7 @@ static void target_complete_ok_work(struct work_struct *work)
23492372
if (ret)
23502373
goto queue_full;
23512374

2375+
transport_lun_remove_cmd(cmd);
23522376
transport_cmd_check_stop_to_fabric(cmd);
23532377
return;
23542378
}
@@ -2384,6 +2408,7 @@ static void target_complete_ok_work(struct work_struct *work)
23842408
break;
23852409
}
23862410

2411+
transport_lun_remove_cmd(cmd);
23872412
transport_cmd_check_stop_to_fabric(cmd);
23882413
return;
23892414

@@ -2710,6 +2735,9 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
27102735
*/
27112736
if (cmd->state_active)
27122737
target_remove_from_state_list(cmd);
2738+
2739+
if (cmd->se_lun)
2740+
transport_lun_remove_cmd(cmd);
27132741
}
27142742
if (aborted)
27152743
cmd->free_compl = &compl;
@@ -2781,9 +2809,6 @@ static void target_release_cmd_kref(struct kref *kref)
27812809
struct completion *abrt_compl = se_cmd->abrt_compl;
27822810
unsigned long flags;
27832811

2784-
if (se_cmd->lun_ref_active)
2785-
percpu_ref_put(&se_cmd->se_lun->lun_ref);
2786-
27872812
if (se_sess) {
27882813
spin_lock_irqsave(&se_sess->sess_cmd_lock, flags);
27892814
list_del_init(&se_cmd->se_cmd_list);

include/scsi/iscsi_proto.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ struct iscsi_reject {
627627
#define ISCSI_REASON_BOOKMARK_INVALID 9
628628
#define ISCSI_REASON_BOOKMARK_NO_RESOURCES 10
629629
#define ISCSI_REASON_NEGOTIATION_RESET 11
630-
#define ISCSI_REASON_WAITING_FOR_LOGOUT 12
631630

632631
/* Max. number of Key=Value pairs in a text message */
633632
#define MAX_KEY_VALUE_PAIRS 8192

0 commit comments

Comments
 (0)