Skip to content

Commit 9e05e95

Browse files
Matthew Wilcox (Oracle)djbw
authored andcommitted
iomap: Fix error handling in iomap_zero_iter()
iomap_write_end() does not return a negative errno to indicate an error, but the number of bytes successfully copied. It cannot return an error today, so include a debugging assertion like the one in iomap_unshare_iter(). Fixes: c6f4046 ("fsdax: decouple zeroing from the iomap buffered I/O code") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent abc14eb commit 9e05e95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/iomap/buffered-io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,8 @@ static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero)
895895
mark_page_accessed(page);
896896

897897
bytes = iomap_write_end(iter, pos, bytes, bytes, page);
898-
if (bytes < 0)
899-
return bytes;
898+
if (WARN_ON_ONCE(bytes == 0))
899+
return -EIO;
900900

901901
pos += bytes;
902902
length -= bytes;

0 commit comments

Comments
 (0)