diff options
author | Susant Palai <spalai@redhat.com> | 2017-01-11 16:04:47 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2017-04-29 14:28:38 +0000 |
commit | 8b2ef5076284e44a87698393c8094c925fa863fa (patch) | |
tree | 5b1aac4eb14aef35494e9b5fc157cc18be49afa7 /libglusterfs | |
parent | bff6b7b1d75b55bfdc11a6aac613b51bdafee989 (diff) |
dht: send lookup on old name inside rename with bname and pargfid
Inside rename, a lookup is done on the source name to make sure that
the file is there. But we used to do a gfid based lookup and hence,
even if the source name was renamed to a new name from some other client,
lookup will be successful as server3_3_lookup will fetch the new path
based on the gfid.
So even if the source file does not exist any more rename will carry on,
and as server3_3_link(destination is hashed to a different brick other
than source cached scenario) also does gfid based resolve, it wont
detect that the source name does not exist and hardlink creation will be
successful (since gfid based resolve will get the new dentry).
To solve this problem, do a name based lookup inside rename. So that
rename will fail right away if the source does not exist.
Change-Id: Ieba8bdd6675088dbf18de90ed4622df043d163bd
BUG: 1412135
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: https://review.gluster.org/16375
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/xlator.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index b1ed094e0ae..ec7cbe08ad3 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -939,7 +939,11 @@ loc_copy (loc_t *dst, loc_t *src) GF_VALIDATE_OR_GOTO ("xlator", dst, err); GF_VALIDATE_OR_GOTO ("xlator", src, err); - gf_uuid_copy (dst->gfid, src->gfid); + if (!gf_uuid_is_null (src->gfid)) + gf_uuid_copy (dst->gfid, src->gfid); + else if (src->inode && !gf_uuid_is_null (src->inode->gfid)) + gf_uuid_copy (dst->gfid, src->inode->gfid); + gf_uuid_copy (dst->pargfid, src->pargfid); if (src->inode) |