On Tue, Nov 08, 2022 at 02:30:09PM +0100, Lukas Czerner wrote: > + err = shmem_get_folio(inode, index, &folio, SGP_WRITE); > + if (err) > + return err; > + > + page = folio_file_page(folio, index); > + if (PageHWPoison(page)) { > + folio_unlock(folio); > + folio_put(folio); > + return -EIO; > + } > + > + /* Write data, or zeroout the portion of the page */ > + if (data) > + memcpy(page_address(page) + offset, data, len); > + else > + memset(page_address(page) + offset, 0, len); > + > + SetPageUptodate(page); This is suspicious. There is no per-page Uptodate bit, there is only a per-folio Uptodate bit. So this should be folio_mark_uptodate(). Except that you've only done one of the pages in the folio, so you have no business setting the uptodate bit at all.