From d6a7e92da11663cdb6068466f22e230ceb0dc31d Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Thu, 7 Apr 2011 23:57:58 +0000 Subject: features/quota: Add checks for any of the parents of file being NULL while checking limits. Signed-off-by: Raghavendra G Signed-off-by: Vijay Bellur BUG: 2685 (nfs server crashed in quota_check_limit) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2685 --- xlators/features/quota/src/quota.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index ad06409412e..131a6ed0190 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -301,8 +301,6 @@ quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, call_stub_t *stub = NULL; int32_t validate_count = 0, link_count = 0; uint64_t value = 0; - char *tmp_name = NULL; - ino_t tmp_par = 0; GF_VALIDATE_OR_GOTO ("quota", this, out); GF_VALIDATE_OR_GOTO (this->name, frame, out); @@ -320,8 +318,6 @@ quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, inode_ctx_get (inode, this, &value); ctx = (quota_inode_ctx_t *)(unsigned long)value; - tmp_name = name; - tmp_par = par; _inode = inode_ref (inode); do { @@ -358,23 +354,37 @@ quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, break; } - parent = inode_parent (_inode, tmp_par, tmp_name); + parent = inode_parent (_inode, par, name); - if (tmp_name != NULL) { - tmp_name = NULL; - tmp_par = 0; + if (name != NULL) { + name = NULL; + par = 0; + } + + if (parent == NULL) { + gf_log (this->name, GF_LOG_DEBUG, + "cannot find parent for inode (ino:%"PRId64", " + "gfid:%s)", _inode->ino, + uuid_utoa (_inode->gfid)); } inode_unref (_inode); _inode = parent; + if (_inode == NULL) { + break; + } + value = 0; inode_ctx_get (_inode, this, &value); ctx = (quota_inode_ctx_t *)(unsigned long)value; } while (1); ret = 0; - inode_unref (_inode); + + if (_inode != NULL) { + inode_unref (_inode); + } LOCK (&local->lock); { -- cgit