diff options
| author | Ravishankar N <ravishankar@redhat.com> | 2017-03-04 01:04:10 +0530 |
|---|---|---|
| committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-03-06 10:45:47 -0500 |
| commit | e46cb08e9d381c46277631fa266751cd63f3823c (patch) | |
| tree | c96c84b41260bdfadf819802e86f34ab85b64ae9 /xlators/cluster/afr/src/afr-self-heal-common.c | |
| parent | 4713b9a74879ecc2b3d5c96987609c09497bd005 (diff) | |
afr: restore atime/mtime for non-regular files
AFR restores atime/mtime only as a part of data heal. For non-regular
files (dirs, symlinks, char/block/socket files etc) which do not undergo
data-heal, atime/mtime is not restored.
This patch restores atime/mtime as a part of metadata heal for such
files.
> Reviewed-on: https://review.gluster.org/16844
> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
(cherry picked from commit 804a65f07ea8e2093f781807651d0d07513b2627)
Change-Id: Id8da885fc93fdf65c2f4bae2af3605b146ac1f16
BUG: 1429402
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: https://review.gluster.org/16851
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c')
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 2a7e688d5a3..69d1fd72e01 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -87,6 +87,49 @@ afr_check_stale_error (struct afr_reply *replies, afr_private_t *priv) return -op_errno; } +int +afr_sh_generic_fop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, struct iatt *pre, struct iatt *post, + dict_t *xdata) +{ + int i = (long) cookie; + afr_local_t *local = NULL; + + local = frame->local; + + local->replies[i].valid = 1; + local->replies[i].op_ret = op_ret; + local->replies[i].op_errno = op_errno; + if (pre) + local->replies[i].prestat = *pre; + if (post) + local->replies[i].poststat = *post; + if (xdata) + local->replies[i].xdata = dict_ref (xdata); + + syncbarrier_wake (&local->barrier); + + return 0; +} + +int +afr_selfheal_restore_time (call_frame_t *frame, xlator_t *this, inode_t *inode, + int source, unsigned char *healed_sinks, + struct afr_reply *replies) +{ + loc_t loc = {0, }; + + loc.inode = inode_ref (inode); + gf_uuid_copy (loc.gfid, inode->gfid); + + AFR_ONLIST (healed_sinks, frame, afr_sh_generic_fop_cbk, setattr, &loc, + &replies[source].poststat, + (GF_SET_ATTR_ATIME|GF_SET_ATTR_MTIME), NULL); + + loc_wipe (&loc); + + return 0; +} dict_t * afr_selfheal_output_xattr (xlator_t *this, gf_boolean_t is_full_crawl, |
