summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/statedump.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2013-01-24 11:39:48 +0530
committerAnand Avati <avati@redhat.com>2013-01-29 15:27:29 -0800
commitb8d5fd2b88db7e18a10e57a0edf1a41eda4f5314 (patch)
tree7fb29a1060e0fc802f81473114117aabec4db507 /libglusterfs/src/statedump.c
parent326a47939dabff218205ca2959b9701e2e0ce47c (diff)
glusterfs : Moved option files, and statedumps from /tmp
Change-Id: Ibdede396c4d6859225937316b7a59a661bcaf9f5 BUG: 764890 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/4422 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/statedump.c')
-rw-r--r--libglusterfs/src/statedump.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index b8ba882f..8175faba 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -541,7 +541,7 @@ out:
return all_disabled;
}
-/* These options are dumped by default if /tmp/glusterdump.options
+/* These options are dumped by default if glusterdump.options
file exists and it is emtpty
*/
static int
@@ -635,21 +635,22 @@ gf_proc_dump_options_init ()
char *saveptr = NULL;
char dump_option_file[PATH_MAX];
- /* glusterd will create a file /tmp/glusterdump.<pid>.options and
+ /* glusterd will create a file glusterdump.<pid>.options and
sets the statedump options for the process and the file is removed
after the statedump is taken. Direct issue of SIGUSR1 does not have
mechanism for considering the statedump options. So to have a way
of configuring the statedump of all the glusterfs processes through
- both cli command and SIGUSR1, /tmp/glusterdump.options file
- is searched and the options mentioned in it are given the higher
- priority.
+ both cli command and SIGUSR1, glusterdump.options file is searched
+ and the options mentioned in it are given the higher priority.
*/
snprintf (dump_option_file, sizeof (dump_option_file),
- "/tmp/glusterdump.options");
+ DEFAULT_VAR_RUN_DIRECTORY
+ "/glusterdump.options");
fp = fopen (dump_option_file, "r");
if (!fp) {
snprintf (dump_option_file, sizeof (dump_option_file),
- "/tmp/glusterdump.%d.options", getpid ());
+ DEFAULT_VAR_RUN_DIRECTORY
+ "/glusterdump.%d.options", getpid ());
fp = fopen (dump_option_file, "r");
@@ -696,15 +697,15 @@ gf_proc_dump_options_init ()
void
gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx)
{
- int i = 0;
- int ret = -1;
- glusterfs_graph_t *trav = NULL;
- char brick_name[PATH_MAX] = {0,};
- struct timeval tv = {0,};
- char timestr[256] = {0,};
- char sign_string[512] = {0,};
- char tmp_dump_name[] = "/tmp/dumpXXXXXX";
- char path[PATH_MAX] = {0,};
+ int i = 0;
+ int ret = -1;
+ glusterfs_graph_t *trav = NULL;
+ char brick_name[PATH_MAX] = {0,};
+ char timestr[256] = {0,};
+ char sign_string[512] = {0,};
+ char tmp_dump_name[PATH_MAX] = {0,};
+ char path[PATH_MAX] = {0,};
+ struct timeval tv = {0,};
gf_proc_dump_lock ();
@@ -722,8 +723,14 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx)
snprintf (path, sizeof (path), "%s/%s.%d.dump.%"PRIu64,
((dump_options.dump_path != NULL)?dump_options.dump_path:
- ((ctx->statedump_path != NULL)?ctx->statedump_path:"/tmp")),
- brick_name, getpid(), (uint64_t) time (NULL));
+ ((ctx->statedump_path != NULL)?ctx->statedump_path:
+ DEFAULT_VAR_RUN_DIRECTORY)), brick_name, getpid(),
+ (uint64_t) time (NULL));
+
+ snprintf (tmp_dump_name, PATH_MAX, "%s/dumpXXXXXX",
+ ((dump_options.dump_path != NULL)?dump_options.dump_path:
+ ((ctx->statedump_path != NULL)?ctx->statedump_path:
+ DEFAULT_VAR_RUN_DIRECTORY)));
ret = gf_proc_dump_open (tmp_dump_name);
if (ret < 0)