From 420f85c39baff0e77b84e2f6c88cfec1cae0d16d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 7 Apr 2012 07:30:52 +0000 Subject: [PATCH] fcst: Handle exchange timeout gracefully This is a backport of commit e1c4038282c7586c3544542b37872c434669d3ac by Mark Rustad . This patch avoids that unregistering a session hangs after an exchange timeout occurred. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4194 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/ft_cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fcst/ft_cmd.c b/fcst/ft_cmd.c index c8943dfc8..86da44c09 100644 --- a/fcst/ft_cmd.c +++ b/fcst/ft_cmd.c @@ -325,7 +325,9 @@ static void ft_recv_seq(struct fc_seq *sp, struct fc_frame *fp, void *arg) * the session and all pending commands, so we ignore this response. */ if (IS_ERR(fp)) { - FT_IO_DBG("exchange error %ld - not handled\n", -PTR_ERR(fp)); + FT_IO_DBG("exchange error %ld - aborting cmd\n", -PTR_ERR(fp)); + scst_rx_mgmt_fn_tag(cmd->sess, SCST_ABORT_TASK, cmd->tag, + SCST_ATOMIC, NULL); return; } @@ -486,6 +488,8 @@ void ft_cmd_tm_done(struct scst_mgmt_cmd *mcmd) ft_cmd_tm_dump(mcmd, __func__); fcmd = scst_mgmt_cmd_get_tgt_priv(mcmd); + if (!fcmd) + return; switch (scst_mgmt_cmd_get_status(mcmd)) { case SCST_MGMT_STATUS_SUCCESS: code = FCP_TMF_CMPL;