summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/nufa.c
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-07-29 15:28:44 +0530
committerAnand Avati <avati@redhat.com>2013-07-29 06:27:47 -0700
commitc2064eff8919af6afdb38dbdb059bfc099e0afd9 (patch)
tree8b4357277e36c19b2c7d70cd16cd2047ae84581f /xlators/cluster/dht/src/nufa.c
parent355ff31dff9713319a1d2663e5f8d3d386c1b938 (diff)
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 <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/5414 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/dht/src/nufa.c')
-rw-r--r--xlators/cluster/dht/src/nufa.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 5fae5262676..e934acdf00a 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;
}