aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/ubd_kern.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/ubd_kern.c')
-rw-r--r--arch/um/drivers/ubd_kern.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 74c002ddc0ce..28c40624bcb6 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1305,6 +1305,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
1305 io_req->fds[0] = dev->cow.fd; 1305 io_req->fds[0] = dev->cow.fd;
1306 else 1306 else
1307 io_req->fds[0] = dev->fd; 1307 io_req->fds[0] = dev->fd;
1308 io_req->error = 0;
1308 1309
1309 if (req_op(req) == REQ_OP_FLUSH) { 1310 if (req_op(req) == REQ_OP_FLUSH) {
1310 io_req->op = UBD_FLUSH; 1311 io_req->op = UBD_FLUSH;
@@ -1313,9 +1314,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
1313 io_req->cow_offset = -1; 1314 io_req->cow_offset = -1;
1314 io_req->offset = off; 1315 io_req->offset = off;
1315 io_req->length = bvec->bv_len; 1316 io_req->length = bvec->bv_len;
1316 io_req->error = 0;
1317 io_req->sector_mask = 0; 1317 io_req->sector_mask = 0;
1318
1319 io_req->op = rq_data_dir(req) == READ ? UBD_READ : UBD_WRITE; 1318 io_req->op = rq_data_dir(req) == READ ? UBD_READ : UBD_WRITE;
1320 io_req->offsets[0] = 0; 1319 io_req->offsets[0] = 0;
1321 io_req->offsets[1] = dev->cow.data_offset; 1320 io_req->offsets[1] = dev->cow.data_offset;
@@ -1341,11 +1340,14 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
1341static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx, 1340static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx,
1342 const struct blk_mq_queue_data *bd) 1341 const struct blk_mq_queue_data *bd)
1343{ 1342{
1343 struct ubd *ubd_dev = hctx->queue->queuedata;
1344 struct request *req = bd->rq; 1344 struct request *req = bd->rq;
1345 int ret = 0; 1345 int ret = 0;
1346 1346
1347 blk_mq_start_request(req); 1347 blk_mq_start_request(req);
1348 1348
1349 spin_lock_irq(&ubd_dev->lock);
1350
1349 if (req_op(req) == REQ_OP_FLUSH) { 1351 if (req_op(req) == REQ_OP_FLUSH) {
1350 ret = ubd_queue_one_vec(hctx, req, 0, NULL); 1352 ret = ubd_queue_one_vec(hctx, req, 0, NULL);
1351 } else { 1353 } else {
@@ -1361,9 +1363,11 @@ static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx,
1361 } 1363 }
1362 } 1364 }
1363out: 1365out:
1364 if (ret < 0) { 1366 spin_unlock_irq(&ubd_dev->lock);
1367
1368 if (ret < 0)
1365 blk_mq_requeue_request(req, true); 1369 blk_mq_requeue_request(req, true);
1366 } 1370
1367 return BLK_STS_OK; 1371 return BLK_STS_OK;
1368} 1372}
1369 1373