On Fri, Sep 15, 2023 at 09:51:26AM +0000, Daniel Gomez wrote: > @@ -1810,13 +1815,14 @@ static void shmem_set_folio_swapin_error(struct inode *inode, pgoff_t index, > return; > > folio_wait_writeback(folio); > + num_swap_pages = folio_nr_pages(folio); > delete_from_swap_cache(folio); > /* > * Don't treat swapin error folio as alloced. Otherwise inode->i_blocks > * won't be 0 when inode is released and thus trigger WARN_ON(i_blocks) > * in shmem_evict_inode(). > */ > - shmem_recalc_inode(inode, -1, -1); > + shmem_recalc_inode(inode, num_swap_pages, num_swap_pages); Shouldn't that be -num_swap_pages? > swap_free(swap); > } > > @@ -1903,7 +1909,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index, > if (error) > goto failed; > > - shmem_recalc_inode(inode, 0, -1); > + shmem_recalc_inode(inode, 0, folio_nr_pages(folio)); > > if (sgp == SGP_WRITE) > folio_mark_accessed(folio); Also here.