f338ef
From 4d0b11088c4a3a630d71acf902064d1ed10412e8 Mon Sep 17 00:00:00 2001
f338ef
From: Atin Mukherjee <amukherj@redhat.com>
f338ef
Date: Tue, 25 Jun 2019 11:11:10 +0530
f338ef
Subject: [PATCH 204/221] glusterd: conditionally clear txn_opinfo in stage op
f338ef
f338ef
...otherwise this leads to a crash when volume status is run on a
f338ef
heterogeneous mode.
f338ef
f338ef
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/22939/
f338ef
f338ef
>Fixes: bz#1723658
f338ef
>Change-Id: I0d39f412b2e5e9d3ef0a3462b90b38bb5364b09d
f338ef
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
f338ef
f338ef
BUG: 1722131
f338ef
Change-Id: I0d39f412b2e5e9d3ef0a3462b90b38bb5364b09d
f338ef
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
f338ef
Reviewed-on: https://code.engineering.redhat.com/gerrit/174566
f338ef
Tested-by: RHGS Build Bot <nigelb@redhat.com>
f338ef
---
f338ef
 xlators/mgmt/glusterd/src/glusterd-op-sm.c | 12 ++++++++++--
f338ef
 1 file changed, 10 insertions(+), 2 deletions(-)
f338ef
f338ef
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
f338ef
index d0c1a2c..9ea695e 100644
f338ef
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
f338ef
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
f338ef
@@ -5714,9 +5714,14 @@ glusterd_op_ac_stage_op(glusterd_op_sm_event_t *event, void *ctx)
f338ef
     glusterd_op_info_t txn_op_info = {
f338ef
         {0},
f338ef
     };
f338ef
+    glusterd_conf_t *priv = NULL;
f338ef
 
f338ef
     this = THIS;
f338ef
     GF_ASSERT(this);
f338ef
+
f338ef
+    priv = this->private;
f338ef
+    GF_ASSERT(priv);
f338ef
+
f338ef
     GF_ASSERT(ctx);
f338ef
 
f338ef
     req_ctx = ctx;
f338ef
@@ -5768,9 +5773,12 @@ out:
f338ef
     gf_msg_debug(this->name, 0, "Returning with %d", ret);
f338ef
 
f338ef
     /* for no volname transactions, the txn_opinfo needs to be cleaned up
f338ef
-     * as there's no unlock event triggered
f338ef
+     * as there's no unlock event triggered. However if the originator node of
f338ef
+     * this transaction is still running with a version lower than 60000,
f338ef
+     * txn_opinfo can't be cleared as that'll lead to a race of referring op_ctx
f338ef
+     * after it's being freed.
f338ef
      */
f338ef
-    if (txn_op_info.skip_locking)
f338ef
+    if (txn_op_info.skip_locking && priv->op_version >= GD_OP_VERSION_6_0)
f338ef
         ret = glusterd_clear_txn_opinfo(txn_id);
f338ef
 
f338ef
     if (rsp_dict)
f338ef
-- 
f338ef
1.8.3.1
f338ef