aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-12 04:08:12 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-12 04:08:12 +0200
commit597099c664c9c00f485b088b5f29161b343fea0f (patch)
treec091abc9b34854f119b47d6c9010a636b692b1bb /src/mds-server
parentm (diff)
downloadmds-597099c664c9c00f485b088b5f29161b343fea0f.tar.gz
mds-597099c664c9c00f485b088b5f29161b343fea0f.tar.bz2
mds-597099c664c9c00f485b088b5f29161b343fea0f.tar.xz
m fix
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-server/mds-server.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c
index 9879579..3bf3cd7 100644
--- a/src/mds-server/mds-server.c
+++ b/src/mds-server/mds-server.c
@@ -211,7 +211,10 @@ int main(int argc_, char** argv_)
}
unparsed_args[unparsed_args_ptr] = NULL;
if (reexec)
- is_respawn = 1;
+ {
+ is_respawn = 1;
+ eprint("re-exec:ing done.");
+ }
/* Check that manditory arguments have been specified. */
@@ -248,7 +251,6 @@ int main(int argc_, char** argv_)
}
}
-
#define __free(I) \
if (I <= 0) fd_table_destroy(&client_map, NULL, NULL); \
if (I <= 1) linked_list_destroy(&client_list); \
@@ -329,19 +331,19 @@ int main(int argc_, char** argv_)
pid_t pid = getpid();
int reexec_fd, r;
char shm_path[NAME_MAX + 1];
+
+ /* Acquire access to marshalled data. */
xsnprintf(shm_path, SHM_PATH_PATTERN, (unsigned long int)pid);
- reexec_fd = shm_open(shm_path, O_RDWR | O_CREAT | O_EXCL, S_IRWXU);
+ reexec_fd = shm_open(shm_path, O_RDONLY, S_IRWXU);
if (reexec_fd < 0)
{
perror(*argv);
- r = -1;
- }
- else
- {
- r = unmarshal_server(reexec_fd);
- close(reexec_fd);
- shm_unlink(shm_path);
+ abort(); /* Critical. */
}
+ /* Unmarshal state. */
+ r = unmarshal_server(reexec_fd);
+ close(reexec_fd);
+ shm_unlink(shm_path);
if (r < 0)
{
/* Close all files (hopefully sockets) we do not know what they are. */
@@ -447,11 +449,11 @@ int main(int argc_, char** argv_)
client_t* client = (client_t*)(void*)(client_list.values[node]);
client_destroy(client);
}
+ fd_table_destroy(&client_map, NULL, NULL);
+ linked_list_destroy(&client_list);
/* Re-exec the server. */
reexec_server(argc, argv, reexec);
- fd_table_destroy(&client_map, NULL, NULL);
- linked_list_destroy(&client_list);
reexec_fail:
perror(*argv);
@@ -1526,6 +1528,8 @@ void sigusr1_trap(int signo)
reexecing = 1;
current_thread = pthread_self();
+ eprint("re-exec:ing queue.");
+
if (pthread_equal(current_thread, master_thread) == 0)
pthread_kill(master_thread, signo);