|
|
cb8e9e |
From 63bd03660e88fe2aab59b0c3d86e079855cf87c1 Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: vmallika <vmallika@redhat.com>
|
|
|
cb8e9e |
Date: Thu, 13 Aug 2015 14:11:59 +0530
|
|
|
cb8e9e |
Subject: [PATCH 257/279] quota/marker: contribution with list_del can cause mem corruption
|
|
|
cb8e9e |
|
|
|
cb8e9e |
This is a backport of http://review.gluster.org/11706
|
|
|
cb8e9e |
|
|
|
cb8e9e |
There is a possibility that contribution is removed twice from list
|
|
|
cb8e9e |
during unlink operation (with hard links) or during rename operation
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Use list_del_init for a thread safe deltion of member from list
|
|
|
cb8e9e |
|
|
|
cb8e9e |
> Change-Id: Iff5e0c03cc8f0ed85da0db1739b84b695abf9ea6
|
|
|
cb8e9e |
> BUG: 1244109
|
|
|
cb8e9e |
> Signed-off-by: vmallika <vmallika@redhat.com>
|
|
|
cb8e9e |
> Reviewed-on: http://review.gluster.org/11706
|
|
|
cb8e9e |
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
|
|
|
cb8e9e |
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
cb8e9e |
> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
|
|
|
cb8e9e |
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
cb8e9e |
|
|
|
cb8e9e |
BUG: 1236672
|
|
|
cb8e9e |
Change-Id: Ic40d7342039a0512345418ab146d67682b87be21
|
|
|
cb8e9e |
Signed-off-by: vmallika <vmallika@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/55061
|
|
|
cb8e9e |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
xlators/features/marker/src/marker-quota-helper.h | 16 ++++++++--------
|
|
|
cb8e9e |
xlators/features/marker/src/marker-quota.c | 2 +-
|
|
|
cb8e9e |
2 files changed, 9 insertions(+), 9 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/xlators/features/marker/src/marker-quota-helper.h b/xlators/features/marker/src/marker-quota-helper.h
|
|
|
cb8e9e |
index f69447b..1f9faf5 100644
|
|
|
cb8e9e |
--- a/xlators/features/marker/src/marker-quota-helper.h
|
|
|
cb8e9e |
+++ b/xlators/features/marker/src/marker-quota-helper.h
|
|
|
cb8e9e |
@@ -18,14 +18,14 @@
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#include "marker.h"
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-#define QUOTA_FREE_CONTRIBUTION_NODE(ctx, _contribution) \
|
|
|
cb8e9e |
- do { \
|
|
|
cb8e9e |
- LOCK (&ctx->lock); \
|
|
|
cb8e9e |
- { \
|
|
|
cb8e9e |
- list_del (&_contribution->contri_list); \
|
|
|
cb8e9e |
- GF_REF_PUT (_contribution); \
|
|
|
cb8e9e |
- } \
|
|
|
cb8e9e |
- UNLOCK (&ctx->lock); \
|
|
|
cb8e9e |
+#define QUOTA_FREE_CONTRIBUTION_NODE(ctx, _contribution) \
|
|
|
cb8e9e |
+ do { \
|
|
|
cb8e9e |
+ LOCK (&ctx->lock); \
|
|
|
cb8e9e |
+ { \
|
|
|
cb8e9e |
+ list_del_init (&_contribution->contri_list); \
|
|
|
cb8e9e |
+ GF_REF_PUT (_contribution); \
|
|
|
cb8e9e |
+ } \
|
|
|
cb8e9e |
+ UNLOCK (&ctx->lock); \
|
|
|
cb8e9e |
} while (0)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
#define QUOTA_SAFE_INCREMENT(lock, var) \
|
|
|
cb8e9e |
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
|
|
|
cb8e9e |
index ca59c1b..f65ed77 100644
|
|
|
cb8e9e |
--- a/xlators/features/marker/src/marker-quota.c
|
|
|
cb8e9e |
+++ b/xlators/features/marker/src/marker-quota.c
|
|
|
cb8e9e |
@@ -4178,7 +4178,7 @@ mq_forget (xlator_t *this, quota_inode_ctx_t *ctx)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
list_for_each_entry_safe (contri, next, &ctx->contribution_head,
|
|
|
cb8e9e |
contri_list) {
|
|
|
cb8e9e |
- list_del (&contri->contri_list);
|
|
|
cb8e9e |
+ list_del_init (&contri->contri_list);
|
|
|
cb8e9e |
GF_REF_PUT (contri);
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|