glusterd: Propagate EADDRINUSE correctly to parent process
exit()/_exit(): Only the least significant 8 bits i.e (err & 255) shall be available to the waiting parent process on calling _exit() or exit() with an integer exit status. If this number is negative, the parent process doesn't readily get what it's really looking forward to handle. For example: EADDRINUSE is 98 and if exit status code is set to -98, the waiting parent process shall get 158 (= -98 & 255) as exit status. BUG: 1193929 Change-Id: Idc6b0f40c2332e087e584b4b40cbf0d29168c9cd Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: https://review.gluster.org/16200 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
This commit is contained in:
parent
b4beaa0505
commit
94afe2ca98
@ -2255,7 +2255,6 @@ glusterfs_listener_init (glusterfs_ctx_t *ctx)
|
||||
|
||||
ret = rpcsvc_create_listeners (rpc, options, "glusterfsd");
|
||||
if (ret < 1) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -1380,7 +1380,9 @@ cleanup_and_exit (int signum)
|
||||
trav = trav->next;
|
||||
}
|
||||
|
||||
exit(signum);
|
||||
/* NOTE: Only the least significant 8 bits i.e (signum & 255)
|
||||
will be available to parent process on calling exit() */
|
||||
exit(abs(signum));
|
||||
}
|
||||
|
||||
|
||||
@ -2237,7 +2239,9 @@ daemonize (glusterfs_ctx_t *ctx)
|
||||
}
|
||||
}
|
||||
sys_read (ctx->daemon_pipe[0], (void *)&err, sizeof (err));
|
||||
_exit (err);
|
||||
/* NOTE: Only the least significant 8 bits i.e (err & 255)
|
||||
will be available to parent process on calling exit() */
|
||||
_exit (abs(err));
|
||||
}
|
||||
|
||||
postfork:
|
||||
@ -2301,7 +2305,6 @@ glusterfs_process_volfp (glusterfs_ctx_t *ctx, FILE *fp)
|
||||
glusterfs_graph_t *graph = NULL;
|
||||
int ret = -1;
|
||||
xlator_t *trav = NULL;
|
||||
int err = 0;
|
||||
|
||||
graph = glusterfs_graph_construct (fp);
|
||||
if (!graph) {
|
||||
@ -2343,9 +2346,8 @@ out:
|
||||
if (ret && !ctx->active) {
|
||||
glusterfs_graph_destroy (graph);
|
||||
/* there is some error in setting up the first graph itself */
|
||||
err = -ret;
|
||||
sys_write (ctx->daemon_pipe[1], (void *) &err, sizeof (err));
|
||||
cleanup_and_exit (err);
|
||||
emancipate (ctx, ret);
|
||||
cleanup_and_exit (ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -1989,7 +1989,7 @@ retry:
|
||||
ret = runner_run (&runner);
|
||||
synclock_lock (&priv->big_lock);
|
||||
|
||||
if (ret == -EADDRINUSE) {
|
||||
if (ret == EADDRINUSE) {
|
||||
/* retry after getting a new port */
|
||||
gf_msg (this->name, GF_LOG_WARNING, -ret,
|
||||
GD_MSG_SRC_BRICK_PORT_UNAVAIL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user