From 215b9be74d80b0bf77b4eb50aa4e4f62b9bda593 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 2 Apr 2012 16:53:22 +0000 Subject: [PATCH] fcst: Handle command timeouts properly git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4178 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/ft_cmd.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/fcst/ft_cmd.c b/fcst/ft_cmd.c index f2968d982..3945c2433 100644 --- a/fcst/ft_cmd.c +++ b/fcst/ft_cmd.c @@ -345,13 +345,27 @@ static void ft_recv_seq(struct fc_seq *sp, struct fc_frame *fp, void *arg) } } +static void ft_abort_cmd(struct scst_cmd *cmd, enum scst_exec_context context) +{ + scst_data_direction dir; + + dir = scst_cmd_get_data_direction(cmd); + if (dir & SCST_DATA_WRITE) + scst_rx_data(cmd, SCST_RX_STATUS_ERROR, context); + if (dir & SCST_DATA_READ) { + scst_set_delivery_status(cmd, SCST_CMD_DELIVERY_ABORTED); + scst_tgt_cmd_done(cmd, context); + } +} + /* * Command timeout. * SCST calls this when the command has taken too long in the device handler. */ void ft_cmd_timeout(struct scst_cmd *cmd) { - FT_IO_DBG("timeout not implemented\n"); /* XXX TBD */ + FT_IO_DBG("%p: timeout\n", cmd); + ft_abort_cmd(cmd, SCST_CONTEXT_DIRECT); } /*