Skip to content

Commit 637d337

Browse files
Andreas GruenbacherDarrick J. Wong
authored andcommitted
iomap: Don't create iomap_page objects for inline files
In iomap_readpage_actor, don't create iop objects for inline inodes. Otherwise, iomap_read_inline_data will set PageUptodate without setting iop->uptodate, and iomap_page_release will eventually complain. To prevent this kind of bug from occurring in the future, make sure the page doesn't have private data attached in iomap_read_inline_data. Signed-off-by: Andreas Gruenbacher <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 8e1bcef commit 637d337

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/iomap/buffered-io.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ iomap_read_inline_data(struct inode *inode, struct page *page,
215215
if (PageUptodate(page))
216216
return;
217217

218+
BUG_ON(page_has_private(page));
218219
BUG_ON(page->index);
219220
BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
220221

@@ -239,7 +240,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
239240
{
240241
struct iomap_readpage_ctx *ctx = data;
241242
struct page *page = ctx->cur_page;
242-
struct iomap_page *iop = iomap_page_create(inode, page);
243+
struct iomap_page *iop;
243244
bool same_page = false, is_contig = false;
244245
loff_t orig_pos = pos;
245246
unsigned poff, plen;
@@ -252,6 +253,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
252253
}
253254

254255
/* zero post-eof blocks as the page may be mapped */
256+
iop = iomap_page_create(inode, page);
255257
iomap_adjust_read_range(inode, iop, &pos, length, &poff, &plen);
256258
if (plen == 0)
257259
goto done;

0 commit comments

Comments
 (0)