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