summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/statedump.c
diff options
context:
space:
mode:
authorKaushik BV <kaushikbv@gluster.com>2010-09-06 03:28:06 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-15 05:09:22 -0700
commit2ea1c2b68c46b8315790900291b18eb6f04010f9 (patch)
treeacc246e4dc195477bcf8fbc4139cfc9b615824ab /libglusterfs/src/statedump.c
parent703dbf354d53fdcc37851bb71420730675a7e170 (diff)
Deadlock in state dumping while holding the logging lock
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 976 (Deadlock in state dumping while holding the logging lock) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=976
Diffstat (limited to 'libglusterfs/src/statedump.c')
-rw-r--r--libglusterfs/src/statedump.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index 05f1a777f..230e7c2ef 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -66,11 +66,8 @@ gf_proc_dump_open (void)
snprintf (path, sizeof (path), "%s.%d", GF_DUMP_LOGFILE_ROOT, getpid ());
dump_fd = open (path, O_CREAT|O_RDWR|O_TRUNC|O_APPEND, 0600);
- if (dump_fd < 0) {
- gf_log("", GF_LOG_ERROR, "Unable to open file: %s"
- " errno: %d", path, errno);
+ if (dump_fd < 0)
return -1;
- }
gf_dump_fd = dump_fd;
return 0;
@@ -104,8 +101,6 @@ gf_proc_dump_add_section (char *key, ...)
snprintf (buf + strlen(buf),
GF_DUMP_MAX_BUF_LEN - strlen (buf), "]\n");
ret = write (gf_dump_fd, buf, strlen (buf));
- if (ret < 0)
- gf_log("", GF_LOG_ERROR, "write error: %s", strerror(errno));
}
@@ -133,8 +128,6 @@ gf_proc_dump_write (char *key, char *value,...)
offset = strlen (buf);
snprintf (buf + offset, GF_DUMP_MAX_BUF_LEN - offset, "\n");
ret = write (gf_dump_fd, buf, strlen (buf));
- if (ret < 0)
- gf_log("", GF_LOG_ERROR, "write error: %s", strerror(errno));
}
static void
@@ -220,8 +213,7 @@ gf_proc_dump_xlator_info (xlator_t *this_xl)
return;
if (ctx->master){
-
- gf_log ("", GF_LOG_DEBUG, "Dumping Proc for fuse Xlator");
+
fuse_xlator = (xlator_t *) ctx->master;
if (!fuse_xlator->dumpops)
@@ -286,7 +278,7 @@ gf_proc_dump_parse_set_option (char *key, char *value)
{
gf_boolean_t *opt_key = NULL;
gf_boolean_t opt_value = _gf_false;
-
+ char buf[GF_DUMP_MAX_BUF_LEN];
if (!strncasecmp (key, "mem", 3)) {
opt_key = &dump_options.dump_mem;
@@ -304,8 +296,10 @@ gf_proc_dump_parse_set_option (char *key, char *value)
if (!opt_key) {
//None of dump options match the key, return back
- gf_log ("", GF_LOG_WARNING, "None of the options matched key"
- ": %s", key);
+ snprintf (buf, sizeof (buf), "[Warning]:None of the options "
+ "matched key : %s\n", key);
+ write (gf_dump_fd, buf, strlen (buf));
+
return -1;
}
@@ -353,6 +347,7 @@ gf_proc_dump_options_init ()
int ret = -1;
FILE *fp = NULL;
char buf[256];
+ char dumpbuf[GF_DUMP_MAX_BUF_LEN];
char *key = NULL, *value = NULL;
char *saveptr = NULL;
@@ -384,8 +379,8 @@ gf_proc_dump_options_init ()
continue;
}
- gf_log ("", GF_LOG_DEBUG, "key = %s, value = %s",
- key, value);
+ snprintf (dumpbuf, sizeof (dumpbuf), "[Debug]:key=%s, value=%s\n",key,value);
+ write (gf_dump_fd, dumpbuf, strlen (dumpbuf));
gf_proc_dump_parse_set_option (key, value);