Commit 4ad357e3 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

iomap: fix submission side handling of completion side errors



The "if (dio->error)" in iomap_dio_bio_iter exists to stop submitting
more bios when a completion already return an error.  Commit cfe057f7
("iomap_dio_actor(): fix iov_iter bugs") made it revert the iov by
"copied", which is very wrong given that we've already consumed that
range and submitted a bio for it.

Fixes: cfe057f7 ("iomap_dio_actor(): fix iov_iter bugs")
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8dd5e7c7
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -443,9 +443,13 @@ static int iomap_dio_bio_iter(struct iomap_iter *iter, struct iomap_dio *dio)
	nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter, BIO_MAX_VECS);
	do {
		size_t n;
		if (dio->error) {
			iov_iter_revert(dio->submit.iter, copied);
			copied = ret = 0;

		/*
		 * If completions already occurred and reported errors, give up now and
		 * don't bother submitting more bios.
		 */
		if (unlikely(data_race(dio->error))) {
			ret = 0;
			goto out;
		}