summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-08-11 04:33:07 +0300
committerDarrick J. Wong <djwong@kernel.org>2021-08-17 07:26:33 +0300
commit740499c78408f75c4e76feac848177cb0d0ccf4f (patch)
treeb2c9ee0b1dfe2a18145ddb4985049c56dd819906
parent1acd9e9c015b389aa3201a977454efb92e36806c (diff)
downloadlinux-740499c78408f75c4e76feac848177cb0d0ccf4f.tar.xz
iomap: fix the iomap_readpage_actor return value for inline data
The actor should never return a larger value than the length that was passed in. The current code handles this gracefully, but the opcoming iter model will be more picky. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r--fs/iomap/buffered-io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 0273aede8b1d..8418dffe8acf 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -205,7 +205,7 @@ struct iomap_readpage_ctx {
struct readahead_control *rac;
};
-static int iomap_read_inline_data(struct inode *inode, struct page *page,
+static loff_t iomap_read_inline_data(struct inode *inode, struct page *page,
const struct iomap *iomap)
{
size_t size = i_size_read(inode) - iomap->offset;
@@ -253,7 +253,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
sector_t sector;
if (iomap->type == IOMAP_INLINE)
- return iomap_read_inline_data(inode, page, iomap);
+ return min(iomap_read_inline_data(inode, page, iomap), length);
/* zero post-eof blocks as the page may be mapped */
iop = iomap_page_create(inode, page);