Blob Blame History Raw
From ffc56620e9f6352a5dd4c3fcadcfc3006f67bd60 Mon Sep 17 00:00:00 2001
From: Ravishankar N <ravishankar@redhat.com>
Date: Mon, 19 Jun 2017 13:45:55 +0530
Subject: [PATCH 516/525] posix: Revert modifying op_errno in
 __posix_fd_ctx_get

Backport of: https://review.gluster.org/17565

https://review.gluster.org/#/c/17414/ converted ENOENT to EBADFD because
ENOENT is not a valid error for fd based operations, but this apparently
breaks dht rebalance behaviour (see comments in the backport 17517. So
reverting that part of the change.

Change-Id: I305e5b46595febe360fb78f9938d25b535fd6a41
BUG: 1454689
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/109378
---
 xlators/storage/posix/src/posix-helpers.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index b5961db..fb6b7d0 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1697,13 +1697,11 @@ __posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd_p,
         if (fd->inode->ia_type == IA_IFDIR) {
                 dir = sys_opendir (real_path);
                 if (!dir) {
-                        (errno == ENOENT) ? (op_errno = EBADF) :
-                                            (op_errno = errno);
-                        gf_msg (this->name, GF_LOG_ERROR, errno,
+                        op_errno = errno;
+                        gf_msg (this->name, GF_LOG_ERROR, op_errno,
                                 P_MSG_READ_FAILED,
                                 "Failed to get anonymous fd for "
-                                "real_path: %s. Returning %s.", real_path,
-                                strerror(op_errno));
+                                "real_path: %s.", real_path);
                         GF_FREE (pfd);
                         pfd = NULL;
                         goto out;
@@ -1724,13 +1722,11 @@ __posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd_p,
                         _fd = open (unlink_path, fd->flags);
                 }
                 if (_fd == -1) {
-                        (errno == ENOENT) ? (op_errno = EBADF) :
-                                            (op_errno = errno);
-                        gf_msg (this->name, GF_LOG_ERROR, errno,
+                        op_errno = errno;
+                        gf_msg (this->name, GF_LOG_ERROR, op_errno,
                                 P_MSG_READ_FAILED,
                                 "Failed to get anonymous fd for "
-                                "real_path: %s. Returning %s.", real_path,
-                                strerror(op_errno));
+                                "real_path: %s.", real_path);
                         GF_FREE (pfd);
                         pfd = NULL;
                         goto out;
-- 
1.8.3.1