summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-10-18 13:31:35 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-19 02:28:25 -0700
commiteab187ce06f6d72aeba297604e132d181da4c502 (patch)
treed5153648ab1c3e281866846ee5347d27661ecc77 /xlators/storage/posix/src/posix.c
parent94943e213a61c83481308dba6adc6b23c3581d2e (diff)
storage/posix: posix changes to handle gfid/conflicts self-heal
Change-Id: Ib759befe1800bc6fd93bdf44f3a7f89bfffff46e BUG: 3734 Reviewed-on: http://review.gluster.com/612 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c23
1 files changed, 22 insertions, 1 deletions
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) {