From c2064eff8919af6afdb38dbdb059bfc099e0afd9 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Mon, 29 Jul 2013 15:28:44 +0530 Subject: cluster/dht: Allow non-local clients to function with nufa volumes. nufa fails to init if a local brick is not found as of today. With this patch, if a local brick is not found, nufa switches over to dht mode of operations. Change-Id: I50ac1af37621b1e776c8c00a772b8e3dfb3691df BUG: 980838 Signed-off-by: Vijay Bellur Reviewed-on: http://review.gluster.org/5414 Reviewed-by: Jeff Darcy Tested-by: Gluster Build System --- xlators/cluster/dht/src/nufa.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 5fae5262..e934acdf 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -528,6 +528,17 @@ nufa_find_local_brick (xlator_t *xl, void *data) } +static void +nufa_to_dht (xlator_t *this) +{ + GF_ASSERT (this); + GF_ASSERT (this->fops); + + this->fops->lookup = dht_lookup; + this->fops->create = dht_create; + this->fops->mknod = dht_mknod; +} + int nufa_find_local_subvol (xlator_t *this, void (*fn) (xlator_t *each, void* data), void *data) @@ -601,13 +612,13 @@ nufa_init (xlator_t *this) args.volname = local_volname; args.addr_match = addr_match; ret = nufa_find_local_subvol (this, nufa_find_local_brick, &args); - if (ret) - goto err; + if (ret) { + gf_log (this->name, GF_LOG_INFO, + "Unable to find local subvolume, switching " + "to dht mode"); + nufa_to_dht (this); + } return 0; - -err: - dht_fini(this); - return -1; } -- cgit