Skip to content

Commit 76a51ac

Browse files
author
Miklos Szeredi
committed
fuse: clear PG_uptodate when using a stolen page
Originally when a stolen page was inserted into fuse's page cache by fuse_try_move_page(), it would be marked uptodate. Then fuse_readpages_end() would call SetPageUptodate() again on the already uptodate page. Commit 413e8f0 ("fuse: Convert fuse_readpages_end() to use folio_end_read()") changed that by replacing the SetPageUptodate() + unlock_page() combination with folio_end_read(), which does mostly the same, except it sets the uptodate flag with an xor operation, which in the above scenario resulted in the uptodate flag being cleared, which in turn resulted in EIO being returned on the read. Fix by clearing PG_uptodate instead of setting it in fuse_try_move_page(), conforming to the expectation of folio_end_read(). Reported-by: Jürg Billeter <[email protected]> Debugged-by: Matthew Wilcox <[email protected]> Fixes: 413e8f0 ("fuse: Convert fuse_readpages_end() to use folio_end_read()") Cc: <[email protected]> # v6.10 Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 3002240 commit 76a51ac

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

fs/fuse/dev.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,6 @@ static int fuse_check_folio(struct folio *folio)
775775
(folio->flags & PAGE_FLAGS_CHECK_AT_PREP &
776776
~(1 << PG_locked |
777777
1 << PG_referenced |
778-
1 << PG_uptodate |
779778
1 << PG_lru |
780779
1 << PG_active |
781780
1 << PG_workingset |
@@ -820,9 +819,7 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
820819

821820
newfolio = page_folio(buf->page);
822821

823-
if (!folio_test_uptodate(newfolio))
824-
folio_mark_uptodate(newfolio);
825-
822+
folio_clear_uptodate(newfolio);
826823
folio_clear_mappedtodisk(newfolio);
827824

828825
if (fuse_check_folio(newfolio) != 0)

0 commit comments

Comments
 (0)