From 13542be377fb6e7d664d36dc654659ebf2ca6051 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 26 Jun 2014 12:55:39 +0530 Subject: libglusterfs: Ref root inode only once Change-Id: I75f309fc1fabb17c392697205b2b5cae6d855e72 BUG: 1113437 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/8182 Reviewed-by: Raghavendra Bhat Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/inode.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libglusterfs/src') 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; -- cgit