summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorMohammed Junaid Ahmed <junaid@gluster.com>2011-02-04 02:12:19 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-04 00:39:30 -0800
commita139e43f484d1b434c9120f9fb99bf5ff33fb51d (patch)
treef555e0543e3e674389ea9d95616a79ce99391592 /xlators
parent5f8e2cab86eab7f5ee5b4bb9b649376e476c740c (diff)
marker: Updating the xtime marks on both the paths in rename fop.
Signed-off-by: Junaid <junaid@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2372 (marker: time stamp not updated with rename) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2372
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/marker/src/marker.c28
-rw-r--r--xlators/features/marker/src/marker.h3
2 files changed, 28 insertions, 3 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index a66b0fd03..47ce20f86 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 60567c3b8..eeb64a16a 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;