Skip to content

Commit 0033dfd

Browse files
kot-begemot-ukaxboe
authored andcommitted
ubd: fix missing initialization of io_req
The SYNC path doesn't initialize io_req->error, which can cause random errors. Before the conversion to blk-mq, we always completed requests with BLK_STS_OK status, but now we actually look at the error field and this issue becomes apparent. Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> [axboe: fixed up commit message to explain what is actually going on] Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent f3587d7 commit 0033dfd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/um/drivers/ubd_kern.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
13051305
io_req->fds[0] = dev->cow.fd;
13061306
else
13071307
io_req->fds[0] = dev->fd;
1308+
io_req->error = 0;
13081309

13091310
if (req_op(req) == REQ_OP_FLUSH) {
13101311
io_req->op = UBD_FLUSH;
@@ -1313,9 +1314,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
13131314
io_req->cow_offset = -1;
13141315
io_req->offset = off;
13151316
io_req->length = bvec->bv_len;
1316-
io_req->error = 0;
13171317
io_req->sector_mask = 0;
1318-
13191318
io_req->op = rq_data_dir(req) == READ ? UBD_READ : UBD_WRITE;
13201319
io_req->offsets[0] = 0;
13211320
io_req->offsets[1] = dev->cow.data_offset;

0 commit comments

Comments
 (0)