From 94196dee1f1b0e22faab69cd9b1b1c70ba3d2f6f Mon Sep 17 00:00:00 2001 From: Poornima G Date: Thu, 13 Apr 2017 16:20:29 +0530 Subject: dht: Add readdir-ahead in rebalance graph if parallel-readdir is on Issue: The value of linkto xattr is generally the name of the dht's next subvol, this requires that the next subvol of dht is not changed for the life time of the volume. But with parallel readdir enabled, the readdir-ahead loaded below dht, is optional. The linkto xattr for first subvol, when: - parallel readdir is enabled : "-readdir-head-0" - plain distribute volume : "-client-0" - distribute replicate volume : "-afr-0" The value of linkto xattr is "-readdir-head-0" when parallel readdir is enabled, and is "-client-0" if its disabled. But the dht_lookup takes care of healing if it cannot identify which linkto subvol, the xattr points to. In dht_lookup_cbk, if linkto xattr is found to be "-client-0" and parallel readdir is enabled, then it cannot understand the value "-client-0" as it expects "-readdir-head-0". In that case, dht_lookup_everywhere is issued and then the linkto file is unlinked and recreated with the right linkto xattr. The issue is when parallel readdir is enabled, mount point accesses the file that is currently being migrated. Since rebalance process doesn't have parallel-readdir feature, it expects "-client-0" where as mount expects "-readdir-head-0". Thus at some point either the mount or rebalance will fail. Solution: Enable parallel-readdir for rebalance as well and then do not allow enabling/disabling parallel-readdir if rebalance is in progress. Change-Id: I241ab966bdd850e667f7768840540546f5289483 BUG: 1436090 Signed-off-by: Poornima G Reviewed-on: https://review.gluster.org/17056 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Raghavendra G --- xlators/mgmt/glusterd/src/glusterd-volume-set.c | 26 ++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-set.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index e5818a1aa15..8d944a546b2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -954,6 +954,30 @@ out: } +static int +validate_parallel_readdir (glusterd_volinfo_t *volinfo, dict_t *dict, + char *key, char *value, char **op_errstr) +{ + int ret = -1; + + ret = validate_boolean (volinfo, dict, key, value, op_errstr); + if (ret) + goto out; + + ret = glusterd_is_defrag_on (volinfo); + if (ret) { + gf_asprintf (op_errstr, "%s option should be set " + "after rebalance is complete", key); + gf_msg ("glusterd", GF_LOG_ERROR, 0, + GD_MSG_INVALID_ENTRY, "%s", *op_errstr); + } +out: + gf_msg_debug ("glusterd", 0, "Returning %d", ret); + + return ret; +} + + static int validate_worm_period (glusterd_volinfo_t *volinfo, dict_t *dict, char *key, char *value, char **op_errstr) @@ -3191,7 +3215,7 @@ struct volopt_map_entry glusterd_volopt_map[] = { .value = "off", .type = DOC, .op_version = GD_OP_VERSION_3_10_0, - .validate_fn = validate_boolean, + .validate_fn = validate_parallel_readdir, .description = "If this option is enabled, the readdir operation is " "performed parallely on all the bricks, thus improving" " the performance of readdir. Note that the performance" -- cgit