We just need to free the request here. Additionally, this is
currently wrong for a queue that's using MQ currently, it'll
crash.

Cc: Doug Gilbert <dgilb...@interlog.com>
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Jens Axboe <ax...@kernel.dk>
---
 drivers/scsi/sg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 8a254bb46a9b..c6ad00703c5b 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -822,7 +822,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
        if (atomic_read(&sdp->detaching)) {
                if (srp->bio) {
                        scsi_req_free_cmd(scsi_req(srp->rq));
-                       blk_end_request_all(srp->rq, BLK_STS_IOERR);
+                       blk_put_request(srp->rq);
                        srp->rq = NULL;
                }
 
-- 
2.17.1

-- 
Jens Axboe

Reply via email to