summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-06-26 12:55:39 +0530
committerVijay Bellur <vbellur@redhat.com>2014-06-30 02:58:05 -0700
commit13542be377fb6e7d664d36dc654659ebf2ca6051 (patch)
tree114cb185fc84a83960c6754d5dc36cdfb70e5425 /libglusterfs/src
parent13f942f95505c12d8675902f91a70050be97bf8e (diff)
libglusterfs: Ref root inode only once
Change-Id: I75f309fc1fabb17c392697205b2b5cae6d855e72 BUG: 1113437 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8182 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/inode.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 373ba9beb39..b06ebe9f8a1 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -389,6 +389,10 @@ __inode_unref (inode_t *inode)
if (!inode)
return NULL;
+ /*
+ * Root inode should always be in active list of inode table. So unrefs
+ * on root inode are no-ops.
+ */
if (__is_root_gfid(inode->gfid))
return inode;
@@ -419,6 +423,18 @@ __inode_ref (inode_t *inode)
inode->table->lru_size--;
__inode_activate (inode);
}
+
+ /*
+ * Root inode should always be in active list of inode table. So unrefs
+ * on root inode are no-ops. If we do not allow unrefs but allow refs,
+ * it leads to refcount overflows and deleting and adding the inode
+ * to active-list, which is ugly. active_size (check __inode_activate)
+ * in inode table increases which is wrong. So just keep the ref
+ * count as 1 always
+ */
+ if (__is_root_gfid(inode->gfid) && inode->ref)
+ return inode;
+
inode->ref++;
return inode;