From 2f64e61a507ee4c1a8e2fcdbc2ce0ec89fcb7902 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 12 Jul 2008 20:27:40 +1000 Subject: [PATCH] Remove mon_pipe for communicating from monitor to manager The returned value was never used, and we don't really want this return path anyway as writing to a pipe could conceivably block, and the monitor must not block. --- managemon.c | 1 - mdadm.h | 1 - mdmon.c | 6 ------ monitor.c | 5 ++--- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/managemon.c b/managemon.c index 569449b5..e7c60aa9 100644 --- a/managemon.c +++ b/managemon.c @@ -152,7 +152,6 @@ static void write_wakeup(struct supertype *c) /* send the monitor thread a pointer to the ping action */ write(c->mgr_pipe[1], &err, 1); - read(c->mon_pipe[0], &err, 1); } static void remove_old(void) diff --git a/mdadm.h b/mdadm.h index ba9174ea..c0cad433 100644 --- a/mdadm.h +++ b/mdadm.h @@ -583,7 +583,6 @@ struct supertype { struct active_array *arrays; int sock; /* listen to external programs */ int mgr_pipe[2]; /* communicate between threads */ - int mon_pipe[2]; /* communicate between threads */ int devnum; char *devname; /* e.g. md0. This appears in metadata_verison: * external:/md0/12 diff --git a/mdmon.c b/mdmon.c index b980083c..bb0c4f75 100644 --- a/mdmon.c +++ b/mdmon.c @@ -66,9 +66,6 @@ int clone_monitor(struct supertype *container) rv = pipe(container->mgr_pipe); if (rv < 0) return rv; - rv = pipe(container->mon_pipe); - if (rv < 0) - goto err_mon_pipe; rv = clone(run_child, stack+4096-64, CLONE_FS|CLONE_FILES|CLONE_VM|CLONE_SIGHAND|CLONE_THREAD, @@ -79,9 +76,6 @@ int clone_monitor(struct supertype *container) return rv; err_clone: - close(container->mon_pipe[0]); - close(container->mon_pipe[1]); - err_mon_pipe: close(container->mgr_pipe[0]); close(container->mgr_pipe[1]); diff --git a/monitor.c b/monitor.c index 5bb25596..0d85d32f 100644 --- a/monitor.c +++ b/monitor.c @@ -408,7 +408,7 @@ static void dprint_wake_reasons(fd_set *fds) #endif static int wait_and_act(struct supertype *container, int pfd, - int monfd, int nowait) + int nowait) { fd_set rfds; int maxfd = 0; @@ -477,7 +477,6 @@ static int wait_and_act(struct supertype *container, int pfd, if (read(pfd, &err, 1) > 0) err = handle_pipe(active_cmd, *aap); - write(monfd, &err, 1); } } @@ -528,7 +527,7 @@ void do_monitor(struct supertype *container) int first = 1; do { rv = wait_and_act(container, container->mgr_pipe[0], - container->mon_pipe[1], first); + first); first = 0; } while (rv >= 0); } -- 2.39.2