diff options
| author | Christoph Hellwig <hch@lst.de> | 2015-09-27 15:01:50 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@fb.com> | 2015-10-01 04:10:55 -0400 |
| commit | f4829a9b7a61e159367350008a608b062c4f6840 (patch) | |
| tree | a2f488a95324e0c0b558273f48b18413ab2fa221 /drivers/scsi | |
| parent | 60de074ba1e8f327db19bc33d8530131ac01695d (diff) | |
blk-mq: fix racy updates of rq->errors
blk_mq_complete_request may be a no-op if the request has already
been completed by others means (e.g. a timeout or cancellation), but
currently drivers have to set rq->errors before calling
blk_mq_complete_request, which might leave us with the wrong error value.
Add an error parameter to blk_mq_complete_request so that we can
defer setting rq->errors until we known we won the race to complete the
request.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/scsi')
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index cbfc5990052b..126a48c6431e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -1957,7 +1957,7 @@ static int scsi_mq_prep_fn(struct request *req) | |||
| 1957 | static void scsi_mq_done(struct scsi_cmnd *cmd) | 1957 | static void scsi_mq_done(struct scsi_cmnd *cmd) |
| 1958 | { | 1958 | { |
| 1959 | trace_scsi_dispatch_cmd_done(cmd); | 1959 | trace_scsi_dispatch_cmd_done(cmd); |
| 1960 | blk_mq_complete_request(cmd->request); | 1960 | blk_mq_complete_request(cmd->request, cmd->request->errors); |
| 1961 | } | 1961 | } |
| 1962 | 1962 | ||
| 1963 | static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, | 1963 | static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, |
