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