diff options
author | Mohit Agrawal <moagrawal@redhat.com> | 2019-03-01 13:41:24 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2019-03-12 20:52:59 +0000 |
commit | 36c75523c1f0545f32db4b807623a8f94df98ca7 (patch) | |
tree | 9cf152a85381e38400da01094213c34d07443f17 /glusterfsd | |
parent | 9b58cfc83c26aa09eb1de8187cc65ed0c3390e97 (diff) |
glusterfsd: Multiple shd processes are spawned on brick_mux environment
Problem: Multiple shd processes are spawned while starting volumes
in the loop on brick_mux environment.glusterd spawn a process
based on a pidfile and shd daemon is taking some time to
update pid in pidfile due to that glusterd is not able to
get shd pid
Solution: Commit cd249f4cb783f8d79e79468c455732669e835a4f changed
the code to update pidfile in parent for any gluster daemon
after getting the status of forking child in parent.To resolve
the same correct the condition update pidfile in parent only
for glusterd and for rest of the daemon pidfile is updated in
child
> Change-Id: Ifd14797fa949562594a285ec82d58384ad717e81
> fixes: bz#1684404
> (Cherry pick from commit 66986594a9023c49e61b32769b7e6b260b600626)
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/22290/)
Change-Id: I9a68064d2da1acd0ec54b4071a9995ece0c3320c
fixes: bz#1683880
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index ae74de73f29..5d46b3d9f45 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -2474,9 +2474,6 @@ daemonize(glusterfs_ctx_t *ctx) goto out; if (cmd_args->no_daemon_mode) { - ret = glusterfs_pidfile_update(ctx, getpid()); - if (ret) - goto out; goto postfork; } @@ -2532,13 +2529,26 @@ daemonize(glusterfs_ctx_t *ctx) will be available to parent process on calling exit() */ if (err) _exit(abs(err)); - ret = glusterfs_pidfile_update(ctx, child_pid); - if (ret) - _exit(1); + + /* Update pid in parent only for glusterd process */ + if (ctx->process_mode == GF_GLUSTERD_PROCESS) { + ret = glusterfs_pidfile_update(ctx, child_pid); + if (ret) + exit(1); + } _exit(0); } postfork: + /* Update pid in child either process_mode is not belong to glusterd + or process is spawned in no daemon mode + */ + if ((ctx->process_mode != GF_GLUSTERD_PROCESS) || + (cmd_args->no_daemon_mode)) { + ret = glusterfs_pidfile_update(ctx, getpid()); + if (ret) + goto out; + } ret = gf_log_inject_timer_event(ctx); glusterfs_signals_setup(ctx); |