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