summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/stack.h1
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c1
-rw-r--r--xlators/storage/posix/src/posix.c23
3 files changed, 24 insertions, 1 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index 87c723112c6..d867a4d5659 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -46,6 +46,7 @@ typedef struct _call_pool_t call_pool_t;
#include "globals.h"
#define NFS_PID 1
+#define SELF_HEAL_PID -1
typedef int32_t (*ret_fn_t) (call_frame_t *frame,
call_frame_t *prev_frame,
xlator_t *this,
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index dc660e19888..568368b9ccd 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -2054,6 +2054,7 @@ afr_self_heal (call_frame_t *frame, xlator_t *this, inode_t *inode)
local->self_heal.need_entry_self_heal);
sh_frame = copy_frame (frame);
+ sh_frame->root->pid = SELF_HEAL_PID;
sh_local = afr_local_copy (local, this);
sh_frame->local = sh_local;
sh = &sh_local->self_heal;
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 69713c5a5f3..7b206390fb8 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -497,6 +497,8 @@ posix_gfid_heal (xlator_t *this, const char *path, dict_t *xattr_req)
ret = sys_lgetxattr (path, GFID_XATTR_KEY, uuid_curr, 16);
if (ret != 16) {
if (is_fresh_file (&stat)) {
+ gf_log (this->name, GF_LOG_DEBUG, "This is a fresh file"
+ " Continue");
ret = -1;
errno = ENOENT;
goto out;
@@ -578,6 +580,18 @@ out:
}
+static inline gf_boolean_t
+posix_is_heal_needed (call_frame_t *frame)
+{
+ return frame->root->pid != SELF_HEAL_PID;
+}
+
+static inline gf_boolean_t
+posix_is_gfid_req_present (dict_t *xattr_req)
+{
+ void *uuid_req = NULL;
+ return !dict_get_ptr (xattr_req, "gfid-req", &uuid_req);
+}
int32_t
posix_lookup (call_frame_t *frame, xlator_t *this,
@@ -600,10 +614,17 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
MAKE_REAL_PATH (real_path, this, loc->path);
- posix_gfid_heal (this, real_path, xattr_req);
+ if (posix_is_heal_needed (frame))
+ posix_gfid_heal (this, real_path, xattr_req);
+ else
+ posix_gfid_set (this, real_path, xattr_req);
op_ret = posix_lstat_with_gfid (this, real_path, &buf);
op_errno = errno;
+ //Afr does lookups without gfid-req, prevent ENODATA in that case
+ if ((op_errno == ENODATA) &&
+ !posix_is_gfid_req_present (xattr_req))
+ op_ret = 0;
if (op_ret == -1) {
if (op_errno != ENOENT) {