diff options
author | vmallika <vmallika@redhat.com> | 2015-07-17 12:50:59 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-07-21 02:35:34 -0700 |
commit | c5ba8c0c02309a05e2a4fe7e59990144fcccb6dc (patch) | |
tree | a55a4dc8cda51bfed9e1509bc8239ea75a2e6965 /xlators/features | |
parent | c19cefebf85dee4c81ed7ae2ef8f050920d73b39 (diff) |
quota/marker: contribution with list_del can cause mem corruption
This is a backport review.gluster.org/#/c/11706/
There is a possibility that contribution is removed twice from list
during unlink operation (with hard links) or during rename operation
Use list_del_init for a thread safe deltion of member from list
> Change-Id: Iff5e0c03cc8f0ed85da0db1739b84b695abf9ea6
> BUG: 1244109
> Signed-off-by: vmallika <vmallika@redhat.com>
Change-Id: I79770c7e31a1d27e0fdfa6d1b0e28c8b03ba3329
BUG: 1244116
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/11707
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/marker/src/marker-quota-helper.h | 16 | ||||
-rw-r--r-- | xlators/features/marker/src/marker-quota.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/xlators/features/marker/src/marker-quota-helper.h b/xlators/features/marker/src/marker-quota-helper.h index f69447b0071..1f9faf5a369 100644 --- a/xlators/features/marker/src/marker-quota-helper.h +++ b/xlators/features/marker/src/marker-quota-helper.h @@ -18,14 +18,14 @@ #include "marker.h" -#define QUOTA_FREE_CONTRIBUTION_NODE(ctx, _contribution) \ - do { \ - LOCK (&ctx->lock); \ - { \ - list_del (&_contribution->contri_list); \ - GF_REF_PUT (_contribution); \ - } \ - UNLOCK (&ctx->lock); \ +#define QUOTA_FREE_CONTRIBUTION_NODE(ctx, _contribution) \ + do { \ + LOCK (&ctx->lock); \ + { \ + list_del_init (&_contribution->contri_list); \ + GF_REF_PUT (_contribution); \ + } \ + UNLOCK (&ctx->lock); \ } while (0) #define QUOTA_SAFE_INCREMENT(lock, var) \ diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c index b7a6efffd55..532c476a24e 100644 --- a/xlators/features/marker/src/marker-quota.c +++ b/xlators/features/marker/src/marker-quota.c @@ -4178,7 +4178,7 @@ mq_forget (xlator_t *this, quota_inode_ctx_t *ctx) list_for_each_entry_safe (contri, next, &ctx->contribution_head, contri_list) { - list_del (&contri->contri_list); + list_del_init (&contri->contri_list); GF_REF_PUT (contri); } |