diff options
author | Vijay Bellur <vijay@gluster.com> | 2012-02-11 22:25:09 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-14 01:57:30 -0800 |
commit | b0e28fe22293b6b9811094f4048c84a8383e8c8d (patch) | |
tree | 912a839561f2b676f4f6294653c86cac854bfe29 /xlators/features | |
parent | 0e6df0100e13123fe38f28c5a090777e894d8f52 (diff) |
features/marker: set loc->gfid in setxattr initiated from marker.
Change-Id: I7abb62272b7c8bb25ad37cbc13da7b4713924b7a
BUG: 787151
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Reviewed-on: http://review.gluster.com/2736
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/marker/src/marker.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 0a99740e9..06f8c9668 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -371,7 +371,7 @@ out: int32_t marker_start_setxattr (call_frame_t *frame, xlator_t *this) { - int32_t ret = 0; + int32_t ret = -1; dict_t *dict = NULL; marker_local_t *local = NULL; marker_conf_t *priv = NULL; @@ -380,20 +380,36 @@ marker_start_setxattr (call_frame_t *frame, xlator_t *this) local = (marker_local_t*) frame->local; + if (!local) + goto out; + dict = dict_new (); + if (!dict) + goto out; + + if (local->loc.inode && uuid_is_null (local->loc.gfid)) + uuid_copy (local->loc.gfid, local->loc.inode->gfid); + + GF_UUID_ASSERT (local->loc.gfid); + ret = dict_set_static_bin (dict, priv->marker_xattr, (void *)local->timebuf, 8); - if (ret) + if (ret) { gf_log (this->name, GF_LOG_WARNING, "failed to set marker xattr (%s)", local->loc.path); + goto out; + } STACK_WIND (frame, marker_specific_setxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr, &local->loc, dict, 0); - dict_unref (dict); + ret = 0; +out: + if (dict) + dict_unref (dict); - return 0; + return ret; } void @@ -1128,6 +1144,7 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->feature_enabled & GF_XTIME) { //update marks on oldpath + uuid_copy (local->loc.gfid, oplocal->loc.inode->gfid); marker_xtime_update_marks (this, oplocal); marker_xtime_update_marks (this, local); } @@ -1811,8 +1828,8 @@ marker_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, marker_conf_t *priv = NULL; if (op_ret == -1) { - gf_log (this->name, GF_LOG_TRACE, "%s occurred while " - "creating symlinks ", strerror (op_errno)); + gf_log (this->name, GF_LOG_TRACE, "%s occurred in " + "setxattr ", strerror (op_errno)); } local = (marker_local_t *) frame->local; |