summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2015-09-11 08:52:44 -0400
committerRaghavendra G <rgowdapp@redhat.com>2015-09-13 22:48:48 -0700
commitc31ac73cd8e9ca4b872a48667e09019991dea00b (patch)
treee890181d53ef8191b5907f0d42eef5f966abac8a /xlators/cluster
parent605e47fe69a7e11f09f95699348dfab4bbab03ff (diff)
dht/cluster: Avoid crash if local is NULL
This patch addresses crash handling if local is NULL. In addition to that, we were not unwinding if no lock is taken in dht_linkfile_create_cbk(create/mknod). This patch handles that also. Change-Id: Ibcff317f10d60e7865fd7ffb9479b3af53c9ef17 BUG: 1260051 Signed-off-by: Susant Palai <spalai@redhat.com> Reviewed-on: http://review.gluster.org/12160 Reviewed-by: N Balachandran <nbalacha@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-common.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index c056872d7b4..9dc065617e9 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -5046,12 +5046,15 @@ dht_mknod_linkfile_create_cbk (call_frame_t *frame, void *cookie,
goto err;
}
- if (op_ret == -1)
+ if (op_ret == -1) {
+ local->op_errno = op_errno;
goto err;
+ }
conf = this->private;
if (!conf) {
local->op_errno = EINVAL;
+ op_errno = EINVAL;
goto err;
}
@@ -5069,9 +5072,13 @@ dht_mknod_linkfile_create_cbk (call_frame_t *frame, void *cookie,
return 0;
err:
- if (local->lock.locks)
+ if (local && local->lock.locks) {
local->refresh_layout_unlock (frame, this, -1, 0);
-
+ } else {
+ DHT_STACK_UNWIND (mknod, frame, -1,
+ op_errno, NULL, NULL, NULL,
+ NULL, NULL);
+ }
return 0;
}
@@ -5864,6 +5871,7 @@ dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie,
conf = this->private;
if (!conf) {
local->op_errno = EINVAL;
+ op_errno = EINVAL;
goto err;
}
@@ -5881,9 +5889,13 @@ dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie,
return 0;
err:
- if (local->lock.locks)
+ if (local && local->lock.locks) {
local->refresh_layout_unlock (frame, this, -1, 0);
-
+ } else {
+ DHT_STACK_UNWIND (create, frame, -1,
+ op_errno, NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ }
return 0;
}