diff options
| author | Pranith Kumar K <pranithk@gluster.com> | 2012-09-12 14:06:53 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2012-09-17 19:27:11 -0700 | 
| commit | b3c6ee00f9fdc80330979e62fbd7f9bec9440b35 (patch) | |
| tree | 0965c34aaaeeba304a1d84d7b90911d0fca92daa | |
| parent | 8f9e94c65516662ff49926203a73b3a0166c087e (diff) | |
features/quota: Avoid mem_put on null local
Problem:
QUOTA_STACK_UNWIND does not check if local is NULL before mem_put.
This leads to a callingfn log for every setxattr in quota.
Fix:
Made sure the mem_put happens only on non-null local in quota.
Additional changes:
Removed unused QUOTA_STACK_DESTROY macro.
Tests:
Peformed setfattr on the mount point and the Invalid argument
logs don't come anymore. Checked that the change does not introduce
any memory leak in quota.
Change-Id: Ie4534c7af0fff80e35d8510311055f930262594f
BUG: 856541
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Reviewed-on: http://review.gluster.org/3936
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
| -rw-r--r-- | xlators/features/quota/src/quota.c | 1 | ||||
| -rw-r--r-- | xlators/features/quota/src/quota.h | 11 | 
2 files changed, 1 insertions, 11 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index cea9a9a0e2b..b60e37d9c80 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -126,6 +126,7 @@ quota_local_cleanup (xlator_t *this, quota_local_t *local)          inode_unref (local->inode);          LOCK_DESTROY (&local->lock); +        mem_put (local);  out:          return 0;  } diff --git a/xlators/features/quota/src/quota.h b/xlators/features/quota/src/quota.h index fe3f46ea010..2b4e9a015ff 100644 --- a/xlators/features/quota/src/quota.h +++ b/xlators/features/quota/src/quota.h @@ -26,16 +26,6 @@  #define VAL_LENGTH              8  #define READDIR_BUF             4096 -#define QUOTA_STACK_DESTROY(_frame, _this)              \ -        do {                                            \ -                quota_local_t *_local = NULL;           \ -                _local = _frame->local;                 \ -                _frame->local = NULL;                   \ -                STACK_DESTROY (_frame->root);           \ -                quota_local_cleanup (_this, _local);    \ -                GF_FREE (_local);                       \ -        } while (0) -  #define QUOTA_SAFE_INCREMENT(lock, var)         \          do {                                    \                  LOCK (lock);                    \ @@ -73,7 +63,6 @@                  }                                                       \                  STACK_UNWIND_STRICT (fop, frame, params);               \                  quota_local_cleanup (_this, _local);                    \ -                mem_put (_local);                                       \          } while (0)  #define QUOTA_FREE_CONTRIBUTION_NODE(_contribution)     \  | 
