256ebe
From 310e09d46cdb293e4af2df0085b8ac45d5c17933 Mon Sep 17 00:00:00 2001
256ebe
From: Atin Mukherjee <amukherj@redhat.com>
256ebe
Date: Tue, 16 Apr 2019 17:20:34 +0530
256ebe
Subject: [PATCH 111/124] glusterd: fix loading ctime in client graph logic
256ebe
256ebe
Commit efbf8ab wasn't handling all the scenarios of toggling ctime
256ebe
option correctly and more over a ! had completely tossed up the logic.
256ebe
256ebe
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/22578/
256ebe
256ebe
>Fixes: bz#1697907
256ebe
>Change-Id: If12e2f69045e59878992ee2cd0518cc0eabcce0d
256ebe
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
256ebe
256ebe
BUG: 1697820
256ebe
Change-Id: If12e2f69045e59878992ee2cd0518cc0eabcce0d
256ebe
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
256ebe
Reviewed-on: https://code.engineering.redhat.com/gerrit/168048
256ebe
Tested-by: RHGS Build Bot <nigelb@redhat.com>
256ebe
---
256ebe
 xlators/mgmt/glusterd/src/glusterd-volgen.c | 12 +++++++++---
256ebe
 1 file changed, 9 insertions(+), 3 deletions(-)
256ebe
256ebe
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
256ebe
index 324ec2f..da877aa 100644
256ebe
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
256ebe
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
256ebe
@@ -4358,9 +4358,15 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
256ebe
             goto out;
256ebe
         }
256ebe
     }
256ebe
-
256ebe
-    if (conf->op_version >= GD_OP_VERSION_5_0 &&
256ebe
-        !dict_get_str_boolean(set_dict, "features.ctime", _gf_false)) {
256ebe
+    /* a. ret will be -1 if features.ctime is not set in the volinfo->dict which
256ebe
+     * means ctime should be loaded into the graph.
256ebe
+     * b. ret will be 1 if features.ctime is explicitly turned on through
256ebe
+     * volume set and in that case ctime should be loaded into the graph.
256ebe
+     * c. ret will be 0 if features.ctime is explicitly turned off and in that
256ebe
+     * case ctime shouldn't be loaded into the graph.
256ebe
+     */
256ebe
+    ret = dict_get_str_boolean(set_dict, "features.ctime", -1);
256ebe
+    if (conf->op_version >= GD_OP_VERSION_5_0 && ret) {
256ebe
         xl = volgen_graph_add(graph, "features/utime", volname);
256ebe
         if (!xl) {
256ebe
             ret = -1;
256ebe
-- 
256ebe
1.8.3.1
256ebe