cead9d
From f30fa3938f980f03d08479776037090e7fc11f42 Mon Sep 17 00:00:00 2001
cead9d
From: Ashish Pandey <aspandey@redhat.com>
cead9d
Date: Tue, 5 May 2020 18:17:49 +0530
cead9d
Subject: [PATCH 369/375] cluster/ec: Return correct error code and log message
cead9d
cead9d
In case of readdir was send with an FD on which opendir
cead9d
was failed, this FD will be useless and we return it with error.
cead9d
For now, we are returning it with EINVAL without logging any
cead9d
message in log file.
cead9d
cead9d
Return a correct error code and also log the message to improve thing to debug.
cead9d
cead9d
>fixes: #1220
cead9d
>Change-Id: Iaf035254b9c5aa52fa43ace72d328be622b06169
cead9d
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
cead9d
(Backport of https://review.gluster.org/#/c/glusterfs/+/24407/)
cead9d
cead9d
BUG: 1831403
cead9d
Change-Id: Ib5bf30c47b7491abd0ad5ca0ce52ec77945b2e53
cead9d
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
cead9d
Reviewed-on: https://code.engineering.redhat.com/gerrit/200209
cead9d
Tested-by: RHGS Build Bot <nigelb@redhat.com>
cead9d
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
cead9d
---
cead9d
 xlators/cluster/ec/src/ec-dir-read.c | 11 +++++++++--
cead9d
 1 file changed, 9 insertions(+), 2 deletions(-)
cead9d
cead9d
diff --git a/xlators/cluster/ec/src/ec-dir-read.c b/xlators/cluster/ec/src/ec-dir-read.c
cead9d
index 8310d4a..9924425 100644
cead9d
--- a/xlators/cluster/ec/src/ec-dir-read.c
cead9d
+++ b/xlators/cluster/ec/src/ec-dir-read.c
cead9d
@@ -388,9 +388,16 @@ ec_manager_readdir(ec_fop_data_t *fop, int32_t state)
cead9d
             /* Return error if opendir has not been successfully called on
cead9d
              * any subvolume. */
cead9d
             ctx = ec_fd_get(fop->fd, fop->xl);
cead9d
-            if ((ctx == NULL) || (ctx->open == 0)) {
cead9d
-                fop->error = EINVAL;
cead9d
+            if (ctx == NULL) {
cead9d
+                fop->error = ENOMEM;
cead9d
+            } else if (ctx->open == 0) {
cead9d
+                fop->error = EBADFD;
cead9d
+            }
cead9d
 
cead9d
+            if (fop->error) {
cead9d
+                gf_msg(fop->xl->name, GF_LOG_ERROR, fop->error,
cead9d
+                       EC_MSG_INVALID_REQUEST, "EC is not winding readdir: %s",
cead9d
+                       ec_msg_str(fop));
cead9d
                 return EC_STATE_REPORT;
cead9d
             }
cead9d
 
cead9d
-- 
cead9d
1.8.3.1
cead9d