Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36ffc6c1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

block_dev: propagate bio_iov_iter_get_pages error in __blkdev_direct_IO



Once we move the block layer to its own status code we'll still want to
propagate the bio_iov_iter_get_pages, so restructure __blkdev_direct_IO
to take ret into account when returning the errno.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent d5245d76
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
	bool is_read = (iov_iter_rw(iter) == READ), is_sync;
	loff_t pos = iocb->ki_pos;
	blk_qc_t qc = BLK_QC_T_NONE;
	int ret;
	int ret = 0;

	if ((pos | iov_iter_alignment(iter)) &
	    (bdev_logical_block_size(bdev) - 1))
@@ -363,7 +363,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)

		ret = bio_iov_iter_get_pages(bio, iter);
		if (unlikely(ret)) {
			bio->bi_error = ret;
			bio->bi_error = -EIO;
			bio_endio(bio);
			break;
		}
@@ -412,6 +412,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
	}
	__set_current_state(TASK_RUNNING);

	if (!ret)
		ret = dio->bio.bi_error;
	if (likely(!ret))
		ret = dio->size;