forked from Minki/linux
block: cleanup error handling in sg_io
Make sure we always clean up through the out label and just have a single place to put the request. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
aeac318194
commit
2cada584b2
@ -279,7 +279,6 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
|
|||||||
r = blk_rq_unmap_user(bio);
|
r = blk_rq_unmap_user(bio);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = r;
|
ret = r;
|
||||||
blk_put_request(rq);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -322,10 +321,9 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
blk_rq_set_block_pc(rq);
|
blk_rq_set_block_pc(rq);
|
||||||
|
|
||||||
if (blk_fill_sghdr_rq(q, rq, hdr, mode)) {
|
ret = -EFAULT;
|
||||||
blk_put_request(rq);
|
if (blk_fill_sghdr_rq(q, rq, hdr, mode))
|
||||||
return -EFAULT;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
if (hdr->iovec_count) {
|
if (hdr->iovec_count) {
|
||||||
size_t iov_data_len;
|
size_t iov_data_len;
|
||||||
@ -376,7 +374,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
|
|||||||
|
|
||||||
hdr->duration = jiffies_to_msecs(jiffies - start_time);
|
hdr->duration = jiffies_to_msecs(jiffies - start_time);
|
||||||
|
|
||||||
return blk_complete_sghdr_rq(rq, hdr, bio);
|
ret = blk_complete_sghdr_rq(rq, hdr, bio);
|
||||||
out:
|
out:
|
||||||
blk_put_request(rq);
|
blk_put_request(rq);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user