@@ -460,7 +460,7 @@ static void lo_complete_rq(struct request *rq)
zero_fill_bio(bio);
}
- blk_mq_end_request(rq, cmd->ret < 0 ? BLK_STS_IOERR : BLK_STS_OK);
+ blk_mq_end_request(rq, errno_to_blk_status(cmd->ret));
}
static void lo_rw_aio_do_completion(struct loop_cmd *cmd)
@@ -478,7 +478,7 @@ static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2)
if (cmd->css)
css_put(cmd->css);
- cmd->ret = ret;
+ cmd->ret = ret > 0 ? 0 : ret;
lo_rw_aio_do_completion(cmd);
}
@@ -1719,7 +1719,7 @@ static void loop_handle_cmd(struct loop_cmd *cmd)
failed:
/* complete non-aio request */
if (!cmd->use_aio || ret) {
- cmd->ret = ret ? -EIO : 0;
+ cmd->ret = ret;
blk_mq_complete_request(cmd->rq);
}
}