diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-10-01 06:59:04 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-01 07:23:50 -0700 |
commit | 25217d43f9786b71de4d86cae122403f2cbaf1e5 (patch) | |
tree | 0ba064fd8cc1b7518beb4757918d1d64d588f959 /xlators/cluster/dht/src/dht-rename.c | |
parent | 398de05aeba82ddfa055e8696521f3d5a4cbabe5 (diff) |
distribute: NFS-friendly logic changes
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 145 (NFSv3 related additions to 2.1 task list)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=145
Diffstat (limited to 'xlators/cluster/dht/src/dht-rename.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-rename.c | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index f91d1983d..d4031c1e9 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -57,13 +57,35 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; } else { /* TODO: construct proper stbuf for dir */ - local->stbuf = *stbuf; + /* + * FIXME: is this the correct way to build stbuf and + * parent bufs? + */ + dht_stat_merge (this, &local->stbuf, stbuf, prev->this); + dht_stat_merge (this, &local->preoldparent, preoldparent, + prev->this); + dht_stat_merge (this, &local->postoldparent, postoldparent, + prev->this); + dht_stat_merge (this, &local->preparent, prenewparent, + prev->this); + dht_stat_merge (this, &local->postparent, postnewparent, + prev->this); } this_call_cnt = dht_frame_return (frame); if (is_last_call (this_call_cnt)) { + local->stbuf.st_ino = local->loc.inode->ino; + + local->preoldparent.st_ino = local->loc.parent->ino; + local->postoldparent.st_ino = local->loc.parent->ino; + + local->preparent.st_ino = local->loc2.parent->ino; + local->postparent.st_ino = local->loc2.parent->ino; + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno, - &local->stbuf); + &local->stbuf, &local->preoldparent, + &local->postoldparent, + &local->preparent, local->postparent); } return 0; @@ -97,7 +119,8 @@ dht_rename_dir_do (call_frame_t *frame, xlator_t *this) return 0; err: - DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno); + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno, NULL, NULL, + NULL, NULL, NULL); return 0; } @@ -208,7 +231,7 @@ dht_rename_dir (call_frame_t *frame, xlator_t *this) err: op_errno = (op_errno == -1) ? errno : op_errno; - DHT_STACK_UNWIND (frame, -1, op_errno, NULL); + DHT_STACK_UNWIND (frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } @@ -235,7 +258,9 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (is_last_call (this_call_cnt)) DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno, - &local->stbuf); + &local->stbuf, &local->preoldparent, + &local->postoldparent, &local->preparent, + &local->postparent); return 0; } @@ -271,6 +296,20 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; goto unwind; } + + dht_stat_merge (this, &local->stbuf, stbuf, prev->this); + dht_stat_merge (this, &local->preoldparent, preoldparent, prev->this); + dht_stat_merge (this, &local->postoldparent, postoldparent, prev->this); + dht_stat_merge (this, &local->preparent, prenewparent, prev->this); + dht_stat_merge (this, &local->postparent, postnewparent, prev->this); + + local->stbuf.st_ino = local->loc.inode->ino; + + local->preoldparent.st_ino = local->loc.parent->ino; + local->postoldparent.st_ino = local->loc.parent->ino; + + local->preparent.st_ino = local->loc2.parent->ino; + local->postparent.st_ino = local->loc2.parent->ino; /* NOTE: rename_subvol is the same subvolume from which dht_rename_cbk * is called. since rename has already happened on rename_subvol, @@ -330,7 +369,9 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, unwind: DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno, - &local->stbuf); + &local->stbuf, &local->preoldparent, + &local->postoldparent, &local->preparent, + &local->postparent); return 0; } @@ -405,7 +446,9 @@ dht_rename_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this, unwind: DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno, - &local->stbuf); + &local->stbuf, &local->preoldparent, + &local->postoldparent, &local->preparent, + &local->postparent); return 0; } @@ -562,7 +605,7 @@ dht_rename (call_frame_t *frame, xlator_t *this, err: op_errno = (op_errno == -1) ? errno : op_errno; - DHT_STACK_UNWIND (frame, -1, op_errno, NULL, NULL); + DHT_STACK_UNWIND (frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); return 0; } |