diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2014-09-10 16:51:19 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-15 11:24:03 -0700 |
commit | 3e1935c8141c4f0ff3ee5af30c62a02da772666b (patch) | |
tree | bf32363443a8fa65372f9a7d8a26adc10777c1bf /xlators | |
parent | 245eec73fb26654608b2524317f4a4af5f9ef61c (diff) |
features/quota: fixes to dentry management code in rename.
1. After a successful rename (src, dst), the dentry
<dst-parent, dst-basename> would be associated with src-inode.
2. Its src inode that survives if both of src and dst are present.
The fixes are done based on the above two observation.
Change-Id: I7492a512e3732b1455c243b02fae12d489532bfb
BUG: 1140084
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/8687
Reviewed-by: susant palai <spalai@redhat.com>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/quota/src/quota.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 7b2e83189d4..3c1b8e09c5c 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -1913,12 +1913,6 @@ quota_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&ctx->lock); { - /* decision of whether to create a context in newloc->inode - * depends on fuse_rename_cbk's choice of inode it retains - * after rename. currently it just associates oldloc->inode - * with new parent and name. If this changes, following code - * should be changed to set a new context in newloc->inode. - */ list_for_each_entry (dentry, &ctx->parents, next) { if ((strcmp (dentry->name, local->oldloc.name) == 0) && (uuid_compare (local->oldloc.parent->gfid, @@ -1926,16 +1920,18 @@ quota_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, old_dentry = dentry; } else if ((strcmp (dentry->name, local->newloc.name) == 0) && - (uuid_compare (local->oldloc.parent->gfid, + (uuid_compare (local->newloc.parent->gfid, dentry->par) == 0)) { new_dentry_found = 1; gf_log (this->name, GF_LOG_WARNING, "new entry being linked (name:%s) for " "inode (gfid:%s) is already present " "in inode-dentry-list", dentry->name, - uuid_utoa (local->newloc.inode->gfid)); - break; + uuid_utoa (local->oldloc.inode->gfid)); } + + if (old_dentry && new_dentry_found) + break; } if (old_dentry != NULL) { @@ -1955,7 +1951,7 @@ quota_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "cannot create a new dentry (name:%s) " "for inode(gfid:%s)", local->newloc.name, - uuid_utoa (local->newloc.inode->gfid)); + uuid_utoa (local->oldloc.inode->gfid)); op_ret = -1; op_errno = ENOMEM; goto unlock; |