summaryrefslogtreecommitdiffstats
path: root/glusterfsd/src
diff options
context:
space:
mode:
authorKaushal M <kaushal@gluster.com>2011-08-17 10:44:17 +0530
committerAnand Avati <avati@gluster.com>2011-08-17 02:23:56 -0700
commitadc1ccf1f7ff7b8c25849bfc4a36f3708829a4db (patch)
tree9ea3549f283c728dcc76428f13dbef18876678bf /glusterfsd/src
parent276142d543f6129623e40e7c93a23353c1f4eac3 (diff)
glusterd: fix for volume stop causing inconsistent volume status
This fixes problem caused by race between glusterd and glusterfsd occuring when they try to unlink pidfile during volume stop, which led to the volume being stopped, but the status of the volume remained in started state. Change-Id: Ibf88b61dc66be4ddff9050a0359636675de558a2 BUG: 3147 Reviewed-on: http://review.gluster.com/246 Reviewed-by: Vijay Bellur <vijay@gluster.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'glusterfsd/src')
-rw-r--r--glusterfsd/src/glusterfsd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index bbd9515df1a..057f8909b91 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1162,7 +1162,7 @@ glusterfs_pidfile_setup (glusterfs_ctx_t *ctx)
int
glusterfs_pidfile_cleanup (glusterfs_ctx_t *ctx)
{
- cmd_args_t *cmd_args = NULL;
+ cmd_args_t *cmd_args = NULL;
cmd_args = &ctx->cmd_args;
@@ -1170,18 +1170,18 @@ glusterfs_pidfile_cleanup (glusterfs_ctx_t *ctx)
return 0;
gf_log ("glusterfsd", GF_LOG_TRACE,
- "pidfile %s unlocking",
+ "pidfile %s cleanup",
cmd_args->pid_file);
- lockf (fileno (ctx->pidfp), F_ULOCK, 0);
- fclose (ctx->pidfp);
- ctx->pidfp = NULL;
-
if (ctx->cmd_args.pid_file) {
unlink (ctx->cmd_args.pid_file);
ctx->cmd_args.pid_file = NULL;
}
+ lockf (fileno (ctx->pidfp), F_ULOCK, 0);
+ fclose (ctx->pidfp);
+ ctx->pidfp = NULL;
+
return 0;
}