From 3e1935c8141c4f0ff3ee5af30c62a02da772666b Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 10 Sep 2014 16:51:19 +0530 Subject: features/quota: fixes to dentry management code in rename. 1. After a successful rename (src, dst), the dentry 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 Reviewed-on: http://review.gluster.org/8687 Reviewed-by: susant palai Reviewed-by: Shyamsundar Ranganathan Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/features/quota/src/quota.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'xlators/features/quota') 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; -- cgit