diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2011-04-07 23:57:58 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2011-04-08 03:26:51 -0700 | 
| commit | d6a7e92da11663cdb6068466f22e230ceb0dc31d (patch) | |
| tree | 13143b45767137f3dc1eff7da9b6c9c0e8e15c32 | |
| parent | 25837b52939398bf3964d20301f0e641033c5c68 (diff) | |
features/quota: Add checks for any of the parents of file being NULL while checking limits.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Vijay Bellur <vijay@gluster.com>
BUG: 2685 (nfs server crashed in quota_check_limit)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2685
| -rw-r--r-- | xlators/features/quota/src/quota.c | 28 | 
1 files 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);          {  | 
