Skip to content
/ linux Public

Commit 8f3d79a

Browse files
Christoph HellwigSasha Levin
authored andcommitted
iomap: fix submission side handling of completion side errors
[ Upstream commit 4ad357e ] The "if (dio->error)" in iomap_dio_bio_iter exists to stop submitting more bios when a completion already return an error. Commit cfe057f ("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: cfe057f ("iomap_dio_actor(): fix iov_iter bugs") Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 597ec9e commit 8f3d79a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fs/iomap/direct-io.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,13 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
381381
nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter, BIO_MAX_VECS);
382382
do {
383383
size_t n;
384-
if (dio->error) {
385-
iov_iter_revert(dio->submit.iter, copied);
386-
copied = ret = 0;
384+
385+
/*
386+
* If completions already occurred and reported errors, give up now and
387+
* don't bother submitting more bios.
388+
*/
389+
if (unlikely(data_race(dio->error))) {
390+
ret = 0;
387391
goto out;
388392
}
389393

0 commit comments

Comments
 (0)