17b94a
From 0864f1ad12394a5748d92aa0ed5b455135426bc3 Mon Sep 17 00:00:00 2001
17b94a
From: Ashish Pandey <aspandey@redhat.com>
17b94a
Date: Tue, 30 Jul 2019 10:32:39 +0530
17b94a
Subject: [PATCH 275/276] cluster/ec: Create heal task with heal process id
17b94a
17b94a
Problem:
17b94a
ec_data_undo_pending calls syncop_fxattrop->SYNCOP without
17b94a
a frame. In this case SYNCOP gets the frame of the task.
17b94a
However, when we create a synctask for heal we provide
17b94a
frame as NULL.
17b94a
Now, if the read-only feature is ON, it will receive the
17b94a
process ID of the shd as 0 and will consider that it as
17b94a
not an internal process. This will prevent healing of a
17b94a
file with "Read-only file system" error message log.
17b94a
17b94a
Solution:
17b94a
While launching heal, create a synctask using frame and set
17b94a
process id of the SHD which is -6.
17b94a
17b94a
> upstream patch : https://review.gluster.org/#/c/glusterfs/+/23129/
17b94a
17b94a
>Change-Id: I37195399c85de322cbcac75633888922c4e3db4a
17b94a
>Fixes: bz#1734252
17b94a
17b94a
BUG: 1733531
17b94a
Change-Id: I37195399c85de322cbcac75633888922c4e3db4a
17b94a
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/178038
17b94a
Tested-by: RHGS Build Bot <nigelb@redhat.com>
17b94a
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
17b94a
---
17b94a
 xlators/cluster/ec/src/ec-heal.c | 20 +++++++++++++++++++-
17b94a
 1 file changed, 19 insertions(+), 1 deletion(-)
17b94a
17b94a
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
17b94a
index 2fa1f11..0f0f398 100644
17b94a
--- a/xlators/cluster/ec/src/ec-heal.c
17b94a
+++ b/xlators/cluster/ec/src/ec-heal.c
17b94a
@@ -2647,13 +2647,31 @@ void
17b94a
 ec_launch_heal(ec_t *ec, ec_fop_data_t *fop)
17b94a
 {
17b94a
     int ret = 0;
17b94a
+    call_frame_t *frame = NULL;
17b94a
+
17b94a
+    frame = create_frame(ec->xl, ec->xl->ctx->pool);
17b94a
+    if (!frame) {
17b94a
+        goto out;
17b94a
+        ret = -1;
17b94a
+    }
17b94a
+
17b94a
+    ec_owner_set(frame, frame->root);
17b94a
+    /*Do heal as root*/
17b94a
+    frame->root->uid = 0;
17b94a
+    frame->root->gid = 0;
17b94a
+    /*Mark the fops as internal*/
17b94a
+    frame->root->pid = GF_CLIENT_PID_SELF_HEALD;
17b94a
 
17b94a
     ret = synctask_new(ec->xl->ctx->env, ec_synctask_heal_wrap, ec_heal_done,
17b94a
-                       NULL, fop);
17b94a
+                       frame, fop);
17b94a
+out:
17b94a
     if (ret < 0) {
17b94a
         ec_fop_set_error(fop, ENOMEM);
17b94a
         ec_heal_fail(ec, fop);
17b94a
     }
17b94a
+
17b94a
+    if (frame)
17b94a
+        STACK_DESTROY(frame->root);
17b94a
 }
17b94a
 
17b94a
 void
17b94a
-- 
17b94a
1.8.3.1
17b94a