diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-03-20 11:39:01 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-03-20 19:51:05 -0700 |
commit | f325551e4c56f743cd1e2b9174d8b7dc9f861675 (patch) | |
tree | 455148bf8528f1540c4f3bf8249601cacc700a37 | |
parent | 1cc57ff832cc48634cd697b828551f4cc3ee42b8 (diff) |
nfs, afr: Fail lookup only on split-brain
Change-Id: Icee9772f1f1bf5336eb82a4dc13e198424cd4a65
BUG: 921996
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4699
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 4 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs-fops.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 537b9c2062a..4157174e40c 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1630,6 +1630,7 @@ afr_self_heal_lookup_unwind (call_frame_t *frame, xlator_t *this, afr_local_t *local = NULL; int ret = -1; dict_t *xattr = NULL; + int32_t spb = 0; local = frame->local; @@ -1661,6 +1662,9 @@ afr_self_heal_lookup_unwind (call_frame_t *frame, xlator_t *this, local->self_heal.actual_sh_started); } + if (local->loc.inode) + spb = afr_is_split_brain (this, local->loc.inode); + ret = dict_set_int32 (xattr, "split-brain", spb); } out: AFR_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno, diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index df09d22bb02..f85f6b2c471 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -385,15 +385,15 @@ nfs_fop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { struct nfs_fop_local *local = NULL; fop_lookup_cbk_t progcbk; - char *sh_fail_val = NULL; + int32_t spb = 0; /* * With native protocol, self-heal failures would be detected during * open. NFS doesn't issue that open when revalidating cache, so we * have to check for failures here instead. */ - if (dict_get_str(xattr,"sh-failed",&sh_fail_val) == 0) { - if (strcmp(sh_fail_val,"1") == 0) { + if (dict_get_int32(xattr, "split-brain", &spb) == 0) { + if (spb) { op_ret = -1; op_errno = EIO; } |