summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/inode.c
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2012-07-24 02:31:05 +0530
committerAnand Avati <avati@redhat.com>2012-07-24 11:53:29 -0700
commit7ab25973f11cf4eedcf3cf1a628f03937536391b (patch)
tree46c2c6eabdf3cf73f9694195492218a38504f343 /libglusterfs/src/inode.c
parent18950598bef63c11237e7cdc959442e524a74061 (diff)
libglusterfs: fix creation of spurious root inodes
Suppose lookup is sent on a newly created inode (gfid is root gfid), and in the call back inode_link is done, where if there is an inode already present in the inode table for that gfid, then we start using the present inode and the newly created inode supposedly gets destroyed when refcount comes down to zero through inode_unref calls. But inodes with root gfid are not unrefed. Now since in inode_link, the gfid has already been copied to the new inode and later the actual inode is found from the inode table, the new inode does not gets unrefed if its gfid is root gfid. Thus those spurious inodes with root gfid will be present throughout the lifetime of the filesystem. To fix this first search the inode table for an inode, with the gfid, present in the stat structure received as an argument. If the inode is not found, then copy the gfid to the newly created inode. Now whenever unref is called on on the new inode it gets unrefed and thus eventually gets destroyed Change-Id: I0f25f0a8dca3245abda1c322c216f063b52cf842 BUG: 841188 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3716 Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/inode.c')
-rw-r--r--libglusterfs/src/inode.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 2efcd89cc..886491292 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -829,14 +829,13 @@ __inode_link (inode_t *inode, inode_t *parent, const char *name,
if (uuid_is_null (iatt->ia_gfid))
return NULL;
- uuid_copy (inode->gfid, iatt->ia_gfid);
- inode->ia_type = iatt->ia_type;
-
- old_inode = __inode_find (table, inode->gfid);
+ old_inode = __inode_find (table, iatt->ia_gfid);
if (old_inode) {
link_inode = old_inode;
} else {
+ uuid_copy (inode->gfid, iatt->ia_gfid);
+ inode->ia_type = iatt->ia_type;
__inode_hash (inode);
}
}
@@ -1300,8 +1299,8 @@ __inode_table_init_root (inode_table_t *table)
iatt.ia_ino = 1;
iatt.ia_type = IA_IFDIR;
- table->root = root;
__inode_link (root, NULL, NULL, &iatt);
+ table->root = root;
}