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