From a139e43f484d1b434c9120f9fb99bf5ff33fb51d Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Ahmed Date: Fri, 4 Feb 2011 02:12:19 +0000 Subject: marker: Updating the xtime marks on both the paths in rename fop. Signed-off-by: Junaid Signed-off-by: Anand V. Avati BUG: 2372 (marker: time stamp not updated with rename) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2372 --- xlators/features/marker/src/marker.c | 28 +++++++++++++++++++++++++--- xlators/features/marker/src/marker.h | 3 +++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index a66b0fd03e0..47ce20f861a 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -143,6 +143,10 @@ marker_free_local (marker_local_t *local) { loc_wipe (&local->loc); + if (local->oplocal) { + loc_wipe (&local->oplocal->loc); + GF_FREE (local->oplocal); + } GF_FREE (local); return 0; @@ -696,6 +700,7 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { int32_t ret = 0; marker_local_t *local = NULL; + marker_local_t *oplocal = NULL; if (op_ret == -1) { gf_log (this->name, GF_LOG_ERROR, "%s occured while " @@ -710,6 +715,11 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf, preoldparent, postoldparent, prenewparent, postnewparent); + oplocal = local->oplocal; + local->oplocal = NULL; + + //update marks on oldpath + update_marks (this, oplocal, ret); update_marks (this, local, ret); return 0; @@ -717,17 +727,29 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t marker_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, - loc_t *newloc) + loc_t *newloc) { - int32_t ret = 0; - marker_local_t *local = NULL; + int32_t ret = 0; + marker_local_t *local = NULL; + marker_local_t *oplocal = NULL; ALLOCATE_OR_GOTO (local, marker_local_t, err); MARKER_INIT_LOCAL (frame, local); + ALLOCATE_OR_GOTO (oplocal, marker_local_t, err); + + MARKER_INIT_LOCAL (frame, oplocal); + + frame->local = local; + + local->oplocal = oplocal; + ret = loc_copy (&local->loc, newloc); + if (ret == -1) + goto err; + ret = loc_copy (&oplocal->loc, oldloc); if (ret == -1) goto err; diff --git a/xlators/features/marker/src/marker.h b/xlators/features/marker/src/marker.h index 60567c3b828..eeb64a16a87 100644 --- a/xlators/features/marker/src/marker.h +++ b/xlators/features/marker/src/marker.h @@ -36,6 +36,7 @@ _frame->local = _local; \ _local->pid = _frame->root->pid; \ memset (&_local->loc, 0, sizeof (loc_t)); \ + _local->oplocal = NULL; \ } while (0) /* try alloc and if it fails, goto label */ @@ -53,6 +54,8 @@ struct marker_local{ uint32_t timebuf[2]; pid_t pid; loc_t loc; + + struct marker_local *oplocal; }; typedef struct marker_local marker_local_t; -- cgit