summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage/posix/src/posix-helpers.c')
-rw-r--r--xlators/storage/posix/src/posix-helpers.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 3dfae4df684..bdd6d5a98f8 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -679,6 +679,7 @@ posix_pstat (xlator_t *this, uuid_t gfid, const char *path,
struct stat lstatbuf = {0, };
struct iatt stbuf = {0, };
int ret = 0;
+ int op_errno = 0;
struct posix_private *priv = NULL;
@@ -690,22 +691,12 @@ posix_pstat (xlator_t *this, uuid_t gfid, const char *path,
posix_fill_gfid_path (this, path, &stbuf);
ret = sys_lstat (path, &lstatbuf);
-
- if (ret != 0) {
- if (ret == -1) {
- if (errno != ENOENT)
- gf_msg (this->name, GF_LOG_WARNING, errno,
- P_MSG_LSTAT_FAILED,
- "lstat failed on %s",
- path);
- } else {
- // may be some backend filesytem issue
- gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_LSTAT_FAILED,
- "lstat failed on %s and return value is %d "
- "instead of -1. Please see dmesg output to "
- "check whether the failure is due to backend "
- "filesystem issue", path, ret);
- ret = -1;
+ if (ret == -1) {
+ if (errno != ENOENT) {
+ op_errno = errno;
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_LSTAT_FAILED, "lstat failed on %s", path);
+ errno = op_errno;/*gf_msg could have changed errno*/
}
goto out;
}