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