From 90df37558d488f9a794f62ed74ec6d72879ed895 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Wed, 24 May 2017 03:17:33 -0400 Subject: features/dht: Initialize local hashed_subvol Self heal directory code path doesn't always have local->hashed_subvol populated. Populating the same which otherwise would fail the self heal. Change-Id: I03b64709fd7a68e28f9e7438243e817c53c6ef5d BUG: 1455104 Signed-off-by: Kotresh HR Reviewed-on: https://review.gluster.org/17381 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: N Balachandran Reviewed-by: Raghavendra G --- xlators/cluster/dht/src/dht-selfheal.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'xlators/cluster/dht/src/dht-selfheal.c') diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 1dd5823b0b5..1577d03e728 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -1501,8 +1501,10 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, int i = 0; int ret = -1; dht_local_t *local = NULL; + xlator_t *this = NULL; local = frame->local; + this = frame->this; local->selfheal.force_mkdir = force; local->selfheal.hole_cnt = 0; @@ -1518,6 +1520,19 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc, return 0; } + if (local->hashed_subvol == NULL) + local->hashed_subvol = dht_subvol_get_hashed (this, loc); + + if (local->hashed_subvol == NULL) { + local->op_errno = EINVAL; + gf_msg (this->name, GF_LOG_WARNING, local->op_errno, + DHT_MSG_HASHED_SUBVOL_GET_FAILED, + "(%s/%s) (path: %s): " + "hashed subvolume not found", loc->pargfid, loc->name, + loc->path); + goto err; + } + local->current = &local->lock[0]; ret = dht_protect_namespace (frame, loc, local->hashed_subvol, &local->current->ns, -- cgit