summaryrefslogtreecommitdiff
path: root/drivers/block/loop.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-10-09 10:40:29 -0600
committerJens Axboe <axboe@fb.com>2015-10-09 10:40:29 -0600
commit54ef2b96879334caf8803fdd93b4c556d709d6fd (patch)
tree05cfeb36feeb4451f8f4c7069a86ae3490027daf /drivers/block/loop.c
parentf7e7868b4743f1cc5e59e6e0ddd3ccf9cfe53a1b (diff)
parentfd48ca384960c831d4fae4636282e422e140ca7c (diff)
Merge branch 'for-4.4/core' into for-4.4/drivers
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r--drivers/block/loop.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 23376084a5cb..423f4ca7d712 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -470,8 +470,7 @@ static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2)
else if (ret < 0)
ret = -EIO;
- rq->errors = ret;
- blk_mq_complete_request(rq);
+ blk_mq_complete_request(rq, ret);
}
static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
@@ -1669,19 +1668,18 @@ static void loop_handle_cmd(struct loop_cmd *cmd)
{
const bool write = cmd->rq->cmd_flags & REQ_WRITE;
struct loop_device *lo = cmd->rq->q->queuedata;
- int ret = -EIO;
+ int ret = 0;
- if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY))
+ if (write && (lo->lo_flags & LO_FLAGS_READ_ONLY)) {
+ ret = -EIO;
goto failed;
+ }
ret = do_req_filebacked(lo, cmd->rq);
-
failed:
- if (ret)
- cmd->rq->errors = -EIO;
/* complete non-aio request */
if (!cmd->use_aio || ret)
- blk_mq_complete_request(cmd->rq);
+ blk_mq_complete_request(cmd->rq, ret ? -EIO : 0);
}
static void loop_queue_work(struct kthread_work *work)