xfs
[Top] [All Lists]

[PATCH 2/4] vfs: add __destroy_inode

To: stable@xxxxxxxxxx
Subject: [PATCH 2/4] vfs: add __destroy_inode
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 19 Aug 2009 14:43:00 -0400
Cc: xfs@xxxxxxxxxxx
References: <20090819184258.542698202@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.47-1
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.
    
backport of upstream commit 2e00c97e2c1d2ffc9e26252ca26b237678b0b772

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxxx>

Index: linux-2.6/fs/inode.c
===================================================================
--- linux-2.6.orig/fs/inode.c   2009-08-15 22:27:13.274661514 -0300
+++ linux-2.6/fs/inode.c        2009-08-15 22:28:08.261344721 -0300
@@ -220,18 +220,22 @@ static struct inode *alloc_inode(struct 
        return inode;
 }
 
-void destroy_inode(struct inode *inode)
+void __destroy_inode(struct inode *inode)
 {
        BUG_ON(inode_has_buffers(inode));
        ima_inode_free(inode);
        security_inode_free(inode);
+}
+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: linux-2.6/include/linux/fs.h
===================================================================
--- linux-2.6.orig/include/linux/fs.h   2009-08-15 22:27:13.278697992 -0300
+++ linux-2.6/include/linux/fs.h        2009-08-15 22:27:19.278690522 -0300
@@ -2162,6 +2162,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 *);

<Prev in Thread] Current Thread [Next in Thread>