From f3f053fc574e38a612d8d780f4e4e25f1285007f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 24 Feb 2019 05:18:58 +0000 Subject: [PATCH] vdisk_fileio: Fix asynchronous I/O handling This patch avoids that SCSI WRITEs trigger weird errors with async=1. Reported-by: Sietse van Zanen git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7982 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 5a2c38011..ca297625e 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3239,7 +3239,7 @@ static void fileio_async_complete(struct kiocb *iocb, long ret, long ret2) scst_set_busy(cmd); } } else { - scst_set_resp_data_len(cmd, ret); + WARN_ON_ONCE(ret < scst_cmd_get_data_len(cmd)); } cmd->completed = 1; cmd->scst_cmd_done(cmd, SCST_CMD_STATE_DEFAULT, SCST_CONTEXT_SAME);