summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-helpers.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2017-07-19 16:14:59 +0530
committerNiels de Vos <ndevos@redhat.com>2017-08-10 16:41:37 +0000
commit982480ecbc0085d4e6bbbc976d2549abbd5f3e61 (patch)
tree7ddef6d15c9cf24d135a00f1ed68ab5e467177aa /xlators/storage/posix/src/posix-helpers.c
parent117daf0c792f52b4c3fbc685b2f6b15841c81772 (diff)
storage/posix: Use the ret value of posix_gfid_heal()
... to make the change in commit acf8cfdf truly useful. Without this, a race between entry creation fops and lookup at posix layer can cause lookups to fail with ENODATA, as opposed to ENOENT. Backport of: > Change-Id: I44a226872283a25f1f4812f03f68921c5eb335bb > Reviewed-on: https://review.gluster.org/17821 > BUG: 1472758 > cherry-picked from 669868d23eaeba42809fca7be134137c607d64ed Change-Id: I44a226872283a25f1f4812f03f68921c5eb335bb BUG: 1480193 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: https://review.gluster.org/18015 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-helpers.c')
-rw-r--r--xlators/storage/posix/src/posix-helpers.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 678e3770769..76e32a31594 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1531,23 +1531,21 @@ posix_gfid_heal (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req
struct stat stat = {0, };
if (!xattr_req)
- goto out;
+ return 0;
- if (sys_lstat (path, &stat) != 0)
- goto out;
+ if (sys_lstat (path, &stat) != 0) {
+ return -errno;
+ }
ret = sys_lgetxattr (path, GFID_XATTR_KEY, uuid_curr, 16);
if (ret != 16) {
if (is_fresh_file (&stat)) {
- ret = -1;
- errno = ENOENT;
- goto out;
+ return -ENOENT;
}
}
- ret = posix_gfid_set (this, path, loc, xattr_req);
-out:
- return ret;
+ posix_gfid_set (this, path, loc, xattr_req);
+ return 0;
}