a3470f
From 7dd1fe266d8c908e8196c93fc371cf205a3d57cb Mon Sep 17 00:00:00 2001
a3470f
From: Amar Tumballi <amarts@redhat.com>
a3470f
Date: Sun, 4 Feb 2018 10:04:29 +0530
a3470f
Subject: [PATCH 143/148] glusterd/store: handle the case of fsid being set to
a3470f
 0
a3470f
a3470f
Generally this would happen when a system gets upgraded from an
a3470f
version which doesn't have fsid details, to a version with fsid
a3470f
values. Without this change, after upgrade, people would see reduced
a3470f
'df ' output, causing lot of confusions.
a3470f
a3470f
Debugging Credits: Nithya B <nbalacha@redhat.com>
a3470f
a3470f
>upstream mainline patch : https://review.gluster.org/#/c/19484/
a3470f
a3470f
Change-Id: Id718127ddfb69553b32770b25021290bd0e7c49a
a3470f
BUG: 1541830
a3470f
Signed-off-by: Amar Tumballi <amarts@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/129739
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
a3470f
---
a3470f
 xlators/mgmt/glusterd/src/glusterd-store.c | 19 +++++++++++++++++++
a3470f
 1 file changed, 19 insertions(+)
a3470f
a3470f
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
a3470f
index e35fcde..6bb7372 100644
a3470f
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
a3470f
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
a3470f
@@ -2632,6 +2632,25 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
a3470f
                                          strlen(abspath));
a3470f
                         }
a3470f
                 }
a3470f
+
a3470f
+                /* Handle upgrade case of shared_brick_count 'fsid' */
a3470f
+                /* Ideally statfs_fsid should never be 0 if done right */
a3470f
+                if (!gf_uuid_compare(brickinfo->uuid, MY_UUID) &&
a3470f
+                    brickinfo->statfs_fsid == 0) {
a3470f
+                        struct statvfs brickstat = {0,};
a3470f
+                        ret = sys_statvfs (brickinfo->path, &brickstat);
a3470f
+                        if (ret) {
a3470f
+                                gf_msg (this->name, GF_LOG_WARNING,
a3470f
+                                        errno,
a3470f
+                                        GD_MSG_BRICKINFO_CREATE_FAIL,
a3470f
+                                        "failed to get statfs() call on brick %s",
a3470f
+                                        brickinfo->path);
a3470f
+                                /* No need for treating it as an error, lets continue
a3470f
+                                   with just a message */
a3470f
+                        }
a3470f
+                        brickinfo->statfs_fsid = brickstat.f_fsid;
a3470f
+                }
a3470f
+
a3470f
                 cds_list_add_tail (&brickinfo->brick_list, &volinfo->bricks);
a3470f
                 brick_count++;
a3470f
         }
a3470f
-- 
a3470f
1.8.3.1
a3470f