[PATCH] swap 09/13 tmpfs truncation

From: Hugh Dickins (hugh@veritas.com)
Date: Tue Mar 25 2003 - 17:19:47 EST


Recent testing has shown that swapoff can sneak a page back into the
tmpfs page cache after truncate_inode_pages has cleaned it, before
shmem_truncate resets next_index to stop that: BUG_ON(inode->i_blocks)
in shmem_delete_inode. So call truncate_inode_pages again to be safe.

--- swap08/mm/shmem.c Sun Mar 23 10:30:15 2003
+++ swap09/mm/shmem.c Tue Mar 25 20:44:24 2003
@@ -486,6 +486,16 @@
         }
 done2:
         BUG_ON(info->swapped > info->next_index);
+ if (inode->i_mapping->nrpages) {
+ /*
+ * Call truncate_inode_pages again: racing shmem_unuse_inode
+ * may have swizzled a page in from swap since vmtruncate or
+ * generic_delete_inode did it, before we lowered next_index.
+ */
+ spin_unlock(&info->lock);
+ truncate_inode_pages(inode->i_mapping, inode->i_size);
+ spin_lock(&info->lock);
+ }
         shmem_recalc_inode(inode);
         spin_unlock(&info->lock);
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:21 EST