summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2016-04-26 15:27:43 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-05-02 04:40:53 -0700
commit45f6b416be0a8daeca9752910a332201bc17d851 (patch)
tree0e0fcc9716375e7dd82888ee431803ef11479e11 /xlators/mgmt/glusterd/src/glusterd-utils.c
parentf58fb8821d1c5d96a8f1eb83930a33a4379196e2 (diff)
glusterd: persist brickinfo->real_path
Backport of http://review.gluster.org/14075 Since real_path was not persisted and gets constructed at every glusterd restart, glusterd will fail to come up if one of the brick's underlying file system is crashed. Solution is to construct real_path only once and get it persisted. Change-Id: I97abc30372c1ffbbb2d43b716d7af09172147b47 BUG: 1331934 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/14075 CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaushal M <kaushal@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-on: http://review.gluster.org/14124 Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index aebfb2c70c7..baa4e3dab3a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1113,7 +1113,7 @@ glusterd_brickinfo_new_from_brick (char *brick,
strncpy (new_brickinfo->hostname, hostname, 1024);
strncpy (new_brickinfo->path, path, 1024);
- if (construct_real_path) {
+ if (construct_real_path && new_brickinfo->real_path[0] == '\0') {
if (!realpath (new_brickinfo->path, abspath)) {
/* ENOENT indicates that brick path has not been created
* which is a valid scenario */
@@ -3106,17 +3106,19 @@ glusterd_import_new_brick (dict_t *peer_data, int32_t vol_count,
gf_uuid_parse (brick_uuid_str, new_brickinfo->uuid);
if (!gf_uuid_compare(new_brickinfo->uuid, MY_UUID)) {
- if (!realpath (new_brickinfo->path, abspath)) {
- gf_msg (this->name, GF_LOG_CRITICAL, errno,
- GD_MSG_BRICKINFO_CREATE_FAIL, "realpath() "
- "failed for brick %s. The underlying file "
- "system may be in bad state",
- new_brickinfo->path);
- ret = -1;
- goto out;
+ if (new_brickinfo->real_path[0] == '\0') {
+ if (!realpath (new_brickinfo->path, abspath)) {
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
+ GD_MSG_BRICKINFO_CREATE_FAIL,
+ "realpath() failed for brick %s. The "
+ "underlying file system may be in bad "
+ "state", new_brickinfo->path);
+ ret = -1;
+ goto out;
+ }
+ strncpy (new_brickinfo->real_path, abspath,
+ strlen(abspath));
}
- strncpy (new_brickinfo->real_path, abspath,
- strlen(abspath));
}
*brickinfo = new_brickinfo;