21ab4e
From ffc56620e9f6352a5dd4c3fcadcfc3006f67bd60 Mon Sep 17 00:00:00 2001
21ab4e
From: Ravishankar N <ravishankar@redhat.com>
21ab4e
Date: Mon, 19 Jun 2017 13:45:55 +0530
21ab4e
Subject: [PATCH 516/525] posix: Revert modifying op_errno in
21ab4e
 __posix_fd_ctx_get
21ab4e
21ab4e
Backport of: https://review.gluster.org/17565
21ab4e
21ab4e
https://review.gluster.org/#/c/17414/ converted ENOENT to EBADFD because
21ab4e
ENOENT is not a valid error for fd based operations, but this apparently
21ab4e
breaks dht rebalance behaviour (see comments in the backport 17517. So
21ab4e
reverting that part of the change.
21ab4e
21ab4e
Change-Id: I305e5b46595febe360fb78f9938d25b535fd6a41
21ab4e
BUG: 1454689
21ab4e
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/109378
21ab4e
---
21ab4e
 xlators/storage/posix/src/posix-helpers.c | 16 ++++++----------
21ab4e
 1 file changed, 6 insertions(+), 10 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
21ab4e
index b5961db..fb6b7d0 100644
21ab4e
--- a/xlators/storage/posix/src/posix-helpers.c
21ab4e
+++ b/xlators/storage/posix/src/posix-helpers.c
21ab4e
@@ -1697,13 +1697,11 @@ __posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd_p,
21ab4e
         if (fd->inode->ia_type == IA_IFDIR) {
21ab4e
                 dir = sys_opendir (real_path);
21ab4e
                 if (!dir) {
21ab4e
-                        (errno == ENOENT) ? (op_errno = EBADF) :
21ab4e
-                                            (op_errno = errno);
21ab4e
-                        gf_msg (this->name, GF_LOG_ERROR, errno,
21ab4e
+                        op_errno = errno;
21ab4e
+                        gf_msg (this->name, GF_LOG_ERROR, op_errno,
21ab4e
                                 P_MSG_READ_FAILED,
21ab4e
                                 "Failed to get anonymous fd for "
21ab4e
-                                "real_path: %s. Returning %s.", real_path,
21ab4e
-                                strerror(op_errno));
21ab4e
+                                "real_path: %s.", real_path);
21ab4e
                         GF_FREE (pfd);
21ab4e
                         pfd = NULL;
21ab4e
                         goto out;
21ab4e
@@ -1724,13 +1722,11 @@ __posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd_p,
21ab4e
                         _fd = open (unlink_path, fd->flags);
21ab4e
                 }
21ab4e
                 if (_fd == -1) {
21ab4e
-                        (errno == ENOENT) ? (op_errno = EBADF) :
21ab4e
-                                            (op_errno = errno);
21ab4e
-                        gf_msg (this->name, GF_LOG_ERROR, errno,
21ab4e
+                        op_errno = errno;
21ab4e
+                        gf_msg (this->name, GF_LOG_ERROR, op_errno,
21ab4e
                                 P_MSG_READ_FAILED,
21ab4e
                                 "Failed to get anonymous fd for "
21ab4e
-                                "real_path: %s. Returning %s.", real_path,
21ab4e
-                                strerror(op_errno));
21ab4e
+                                "real_path: %s.", real_path);
21ab4e
                         GF_FREE (pfd);
21ab4e
                         pfd = NULL;
21ab4e
                         goto out;
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e