• Miklos Szeredi's avatar
    fuse: clear PG_uptodate when using a stolen page · 76a51ac0
    Miklos Szeredi authored
    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 413e8f01 ("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: default avatarJürg Billeter <j@bitron.ch>
    Debugged-by: default avatarMatthew Wilcox <willy@infradead.org>
    Fixes: 413e8f01 ("fuse: Convert fuse_readpages_end() to use folio_end_read()")
    Cc: <stable@vger.kernel.org> # v6.10
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    76a51ac0
dev.c 54.9 KB