Commit a4467018 authored by Nicholas Bellinger's avatar Nicholas Bellinger

iscsi-target: Propigate queue_data_in + queue_status errors

This patch changes iscsi-target to propagate iscsit_transport
->iscsit_queue_data_in() and ->iscsit_queue_status() callback
errors, back up into target-core.

This allows target-core to retry failed iscsit_transport
callbacks using internal queue-full logic.
Reported-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
Reviewed-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
Tested-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
Cc: Potnuri Bharat Teja <bharat@chelsio.com>
Reported-by: default avatarSteve Wise <swise@opengridcomputing.com>
Cc: Steve Wise <swise@opengridcomputing.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent fa7e25cf
...@@ -485,8 +485,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *); ...@@ -485,8 +485,7 @@ static void iscsit_get_rx_pdu(struct iscsi_conn *);
int iscsit_queue_rsp(struct iscsi_conn *conn, struct iscsi_cmd *cmd) int iscsit_queue_rsp(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
{ {
iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state); return iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state);
return 0;
} }
EXPORT_SYMBOL(iscsit_queue_rsp); EXPORT_SYMBOL(iscsit_queue_rsp);
......
...@@ -1398,11 +1398,10 @@ static u32 lio_sess_get_initiator_sid( ...@@ -1398,11 +1398,10 @@ static u32 lio_sess_get_initiator_sid(
static int lio_queue_data_in(struct se_cmd *se_cmd) static int lio_queue_data_in(struct se_cmd *se_cmd)
{ {
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
struct iscsi_conn *conn = cmd->conn;
cmd->i_state = ISTATE_SEND_DATAIN; cmd->i_state = ISTATE_SEND_DATAIN;
cmd->conn->conn_transport->iscsit_queue_data_in(cmd->conn, cmd); return conn->conn_transport->iscsit_queue_data_in(conn, cmd);
return 0;
} }
static int lio_write_pending(struct se_cmd *se_cmd) static int lio_write_pending(struct se_cmd *se_cmd)
...@@ -1431,16 +1430,14 @@ static int lio_write_pending_status(struct se_cmd *se_cmd) ...@@ -1431,16 +1430,14 @@ static int lio_write_pending_status(struct se_cmd *se_cmd)
static int lio_queue_status(struct se_cmd *se_cmd) static int lio_queue_status(struct se_cmd *se_cmd)
{ {
struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd);
struct iscsi_conn *conn = cmd->conn;
cmd->i_state = ISTATE_SEND_STATUS; cmd->i_state = ISTATE_SEND_STATUS;
if (cmd->se_cmd.scsi_status || cmd->sense_reason) { if (cmd->se_cmd.scsi_status || cmd->sense_reason) {
iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state); return iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
return 0;
} }
cmd->conn->conn_transport->iscsit_queue_status(cmd->conn, cmd); return conn->conn_transport->iscsit_queue_status(conn, cmd);
return 0;
} }
static void lio_queue_tm_rsp(struct se_cmd *se_cmd) static void lio_queue_tm_rsp(struct se_cmd *se_cmd)
......
...@@ -567,7 +567,7 @@ static void iscsit_remove_cmd_from_immediate_queue( ...@@ -567,7 +567,7 @@ static void iscsit_remove_cmd_from_immediate_queue(
} }
} }
void iscsit_add_cmd_to_response_queue( int iscsit_add_cmd_to_response_queue(
struct iscsi_cmd *cmd, struct iscsi_cmd *cmd,
struct iscsi_conn *conn, struct iscsi_conn *conn,
u8 state) u8 state)
...@@ -578,7 +578,7 @@ void iscsit_add_cmd_to_response_queue( ...@@ -578,7 +578,7 @@ void iscsit_add_cmd_to_response_queue(
if (!qr) { if (!qr) {
pr_err("Unable to allocate memory for" pr_err("Unable to allocate memory for"
" struct iscsi_queue_req\n"); " struct iscsi_queue_req\n");
return; return -ENOMEM;
} }
INIT_LIST_HEAD(&qr->qr_list); INIT_LIST_HEAD(&qr->qr_list);
qr->cmd = cmd; qr->cmd = cmd;
...@@ -590,6 +590,7 @@ void iscsit_add_cmd_to_response_queue( ...@@ -590,6 +590,7 @@ void iscsit_add_cmd_to_response_queue(
spin_unlock_bh(&conn->response_queue_lock); spin_unlock_bh(&conn->response_queue_lock);
wake_up(&conn->queues_wq); wake_up(&conn->queues_wq);
return 0;
} }
struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn) struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn)
......
...@@ -31,7 +31,7 @@ extern int iscsit_find_cmd_for_recovery(struct iscsi_session *, struct iscsi_cmd ...@@ -31,7 +31,7 @@ extern int iscsit_find_cmd_for_recovery(struct iscsi_session *, struct iscsi_cmd
struct iscsi_conn_recovery **, itt_t); struct iscsi_conn_recovery **, itt_t);
extern void iscsit_add_cmd_to_immediate_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); extern void iscsit_add_cmd_to_immediate_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *); extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *);
extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); extern int iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *);
extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *);
extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment