]> Pileus Git - ~andy/linux/commitdiff
vfs: add __destroy_inode
authorChristoph Hellwig <hch@lst.de>
Fri, 7 Aug 2009 17:38:29 +0000 (14:38 -0300)
committerChristoph Hellwig <hch@brick.lst.de>
Fri, 7 Aug 2009 17:38:29 +0000 (14:38 -0300)
When we want to tear down an inode that lost the add to the cache race
in XFS we must not call into ->destroy_inode because that would delete
the inode that won the race from the inode cache radix tree.

This patch provides the __destroy_inode helper needed to fix this,
the actual fix will be in th next patch.  As XFS was the only reason
destroy_inode was exported we shift the export to the new __destroy_inode.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
fs/inode.c
include/linux/fs.h

index af2c05235cc80c4c6025740804e320bb4b5febcc..ae7b67e48661b0f078679a67d6f0c1d40847bf06 100644 (file)
@@ -229,7 +229,7 @@ static struct inode *alloc_inode(struct super_block *sb)
        return inode;
 }
 
-void destroy_inode(struct inode *inode)
+void __destroy_inode(struct inode *inode)
 {
        BUG_ON(inode_has_buffers(inode));
        ima_inode_free(inode);
@@ -241,13 +241,17 @@ void destroy_inode(struct inode *inode)
        if (inode->i_default_acl && inode->i_default_acl != ACL_NOT_CACHED)
                posix_acl_release(inode->i_default_acl);
 #endif
+}
+EXPORT_SYMBOL(__destroy_inode);
+
+void destroy_inode(struct inode *inode)
+{
+       __destroy_inode(inode);
        if (inode->i_sb->s_op->destroy_inode)
                inode->i_sb->s_op->destroy_inode(inode);
        else
                kmem_cache_free(inode_cachep, (inode));
 }
-EXPORT_SYMBOL(destroy_inode);
-
 
 /*
  * These are initializations that only need to be done
index 0c3b5e58a986f35372ec13c48b3a949dcfd87eee..67888a9e06558d45d0ff0fc2fd97072af9aed5c8 100644 (file)
@@ -2164,6 +2164,7 @@ extern void __iget(struct inode * inode);
 extern void iget_failed(struct inode *);
 extern void clear_inode(struct inode *);
 extern void destroy_inode(struct inode *);
+extern void __destroy_inode(struct inode *);
 extern struct inode *new_inode(struct super_block *);
 extern int should_remove_suid(struct dentry *);
 extern int file_remove_suid(struct file *);