diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2014-09-16 13:58:17 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-16 21:25:37 -0700 |
commit | 11d222932d8c52a5d734cb4d33804a98ded89c92 (patch) | |
tree | 25bf3fe8cf7143c29aba47273b49b0c3d1475b9e /xlators/features | |
parent | a6123ebfdb67e71eab859f94fb14660e9e3701c6 (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: 1142411
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on-master: 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>
Reviewed-on: http://review.gluster.org/8752
Diffstat (limited to 'xlators/features')
-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 afdade1432a..5aee09d0d59 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -1912,12 +1912,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, @@ -1925,16 +1919,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) { @@ -1954,7 +1950,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; |