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