Skip to contentSkip to conversation

mpol_free_shared_poliy() is not called for non-inline symlink under tmpfs

PATCH New Nobuhiro Tachino 1 participant 1 message Jul 26, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpol_free_shared_poliy() is not called for non-inline symlink under tmpfs

Hi,

If the inode is non-inline symbolic link under tmpfs, shmem_destroy_inode() always skips to call mpol_free_shared_policy(). However the policy field of non-inline symbolic link inode is intact and I think it is better to be freed by mpol_free_shared_policy(). I'm not sure this actually causes any serious problem, but the following patch fixes it anyway.

mm/shmem.c +2 -2
diff -Npur linux.org/mm/shmem.c linux/mm/shmem.c
@@ -2032,8 +2032,8 @@ static struct inode *shmem_alloc_inode(s
 
 static void shmem_destroy_inode(struct inode *inode)
 {
-	if ((inode->i_mode & S_IFMT) == S_IFREG) {
-		/* only struct inode is valid if it's an inline symlink */
+	if ((inode->i_mode & S_IFMT) == S_IFREG ||
+	    inode->i_op == &shmem_symlink_inode_operations) {
 		mpol_free_shared_policy(&SHMEM_I(inode)->policy);
 	}
 	kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));