Blob Blame History Raw
From f6164a5007ea553daf63fb6e661121f11bcdd7d2 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 10 Jul 2018 21:33:41 +0530
Subject: [PATCH 687/689] glusterd: log improvements on brick creation
 validation

Added few log entries in glusterd_is_brickpath_available ().

>Change-Id: I8b758578f9db90d2974f7c79126c50ad3a001d71
>Updates: bz#1193929
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>

upstream patch: https://review.gluster.org/#/c/20493/

Change-Id: I8b758578f9db90d2974f7c79126c50ad3a001d71
BUG: 1599803
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/143749
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-utils.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 8e1048c..794e8e1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1233,7 +1233,8 @@ glusterd_brickinfo_new_from_brick (char *brick,
                                         GD_MSG_BRICKINFO_CREATE_FAIL, "realpath"
                                         " () failed for brick %s. The "
                                         "underlying filesystem may be in bad "
-                                        "state", new_brickinfo->path);
+                                        "state. Error - %s",
+                                        new_brickinfo->path, strerror(errno));
                                 ret = -1;
                                 goto out;
                         }
@@ -1318,6 +1319,12 @@ glusterd_is_brickpath_available (uuid_t uuid, char *path)
         /* path may not yet exist */
         if (!realpath (path, tmp_path)) {
                 if (errno != ENOENT) {
+                        gf_msg (THIS->name, GF_LOG_CRITICAL, errno,
+                                        GD_MSG_BRICKINFO_CREATE_FAIL, "realpath"
+                                        " () failed for brick %s. The "
+                                        "underlying filesystem may be in bad "
+                                        "state. Error - %s",
+                                        path, strerror(errno));
                         goto out;
                 }
                 /* When realpath(3) fails, tmp_path is undefined. */
@@ -1329,8 +1336,14 @@ glusterd_is_brickpath_available (uuid_t uuid, char *path)
                                          brick_list) {
                         if (gf_uuid_compare (uuid, brickinfo->uuid))
                                 continue;
-                        if (_is_prefix (brickinfo->real_path, tmp_path))
+                        if (_is_prefix (brickinfo->real_path, tmp_path)) {
+                                gf_msg (THIS->name, GF_LOG_CRITICAL, 0,
+                                        GD_MSG_BRICKINFO_CREATE_FAIL,
+                                        "_is_prefix call failed for brick %s "
+                                        "against brick %s", tmp_path,
+                                        brickinfo->real_path);
                                 goto out;
+                        }
                 }
         }
         available = _gf_true;
-- 
1.8.3.1