diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-12-21 04:44:50 +0000 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2021-12-23 14:04:11 -0800 |
commit | 9e05e95ca8dae8de4a7a1645014e1bbd9c8a4dab (patch) | |
tree | 8119f6030c2d07823cec9b9d5d4f6676a9dd9c20 /fs/iomap | |
parent | abc14eb1e01286819a671019e78a23542685eee2 (diff) |
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: c6f40468657d ("fsdax: decouple zeroing from the iomap buffered I/O code")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211221044450.517558-1-willy@infradead.org
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'fs/iomap')
-rw-r--r-- | fs/iomap/buffered-io.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index ac040d607f4f..49279dfa73c9 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -895,8 +895,8 @@ static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero) mark_page_accessed(page); bytes = iomap_write_end(iter, pos, bytes, bytes, page); - if (bytes < 0) - return bytes; + if (WARN_ON_ONCE(bytes == 0)) + return -EIO; pos += bytes; length -= bytes; |