From: Paul Clements <paul.clements@steeleye.com>
To: Neil Brown <neilb@cse.unsw.edu.au>
Cc: nfs@lists.sourceforge.net
Subject: [PATCH] nfs-utils: High Availability NFS bugfixes
Date: Mon, 25 Oct 2004 19:47:39 -0400 [thread overview]
Message-ID: <417D909B.8080304@steeleye.com> (raw)
In-Reply-To: <16699.51390.633644.1498@cse.unsw.edu.au>
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
A couple of bugfixes to go on top of the HA NFS patch that I sent a
while back:
* avoid call to waitpid() with SIGCHLD set to SIG_IGN -- we'll set
SIGCHLD to SIG_DFL before calling the HA callout and then switch it back
to its old value afterward
* fix arguments to waitpid() so that correct return value is reported in
debug message
* fix signal handler for statd to additionally do a change_state() --
this is required to ensure that clients see a state change, else they
may ignore the notification
Thanks,
Paul
[-- Attachment #2: nfs-utils-1.0.6-ha_bugfix.diff --]
[-- Type: text/plain, Size: 2197 bytes --]
diff -pur nfs-utils-1.0.6/support/include/ha-callout.h nfs-utils-1.0.6-ha_bugfix/support/include/ha-callout.h
--- nfs-utils-1.0.6/support/include/ha-callout.h 2004-10-25 12:09:37.000000000 -0400
+++ nfs-utils-1.0.6-ha_bugfix/support/include/ha-callout.h 2004-10-25 12:17:53.000000000 -0400
@@ -14,6 +14,7 @@
#define HA_CALLOUT_H
#include <sys/wait.h>
+#include <signal.h>
extern char *ha_callout_prog;
@@ -23,12 +24,18 @@ ha_callout(char *event, char *arg1, char
char buf[16]; /* should be plenty */
pid_t pid;
int ret = -1;
+ struct sigaction oldact, newact;
if (!ha_callout_prog) /* HA callout is not enabled */
return;
sprintf(buf, "%d", arg3);
+ newact.sa_handler = SIG_DFL;
+ newact.sa_flags = 0;
+ sigemptyset(&newact.sa_mask);
+ sigaction(SIGCHLD, &newact, &oldact);
+
pid = fork();
switch (pid) {
case 0: execl(ha_callout_prog, ha_callout_prog,
@@ -39,7 +46,8 @@ ha_callout(char *event, char *arg1, char
exit(2);
case -1: perror("fork");
break;
- default: ret = waitpid(pid, NULL, 0);
+ default: pid = waitpid(pid, &ret, 0);
+ sigaction(SIGCHLD, &oldact, &newact);
}
#ifdef dprintf
diff -pur nfs-utils-1.0.6/utils/statd/statd.c nfs-utils-1.0.6-ha_bugfix/utils/statd/statd.c
--- nfs-utils-1.0.6/utils/statd/statd.c 2004-10-25 12:09:37.000000000 -0400
+++ nfs-utils-1.0.6-ha_bugfix/utils/statd/statd.c 2004-10-25 12:17:53.000000000 -0400
@@ -111,7 +111,8 @@ killer (int sig)
static void
sigusr (int sig)
{
- dprintf (N_DEBUG, "Caught signal %d, re-reading notify list.", sig);
+ dprintf (N_DEBUG, "Caught signal %d, re-notifying (state %d).", sig,
+ MY_STATE);
re_notify = 1;
}
Only in nfs-utils-1.0.6-ha_bugfix/utils/statd: statd.c.orig
diff -pur nfs-utils-1.0.6/utils/statd/svc_run.c nfs-utils-1.0.6-ha_bugfix/utils/statd/svc_run.c
--- nfs-utils-1.0.6/utils/statd/svc_run.c 2004-10-25 12:09:37.000000000 -0400
+++ nfs-utils-1.0.6-ha_bugfix/utils/statd/svc_run.c 2004-10-25 12:17:53.000000000 -0400
@@ -88,6 +88,9 @@ my_svc_run(void)
if (svc_stop)
return;
if (re_notify) {
+ change_state();
+ dprintf(N_DEBUG, "Notifying...(new state %d)",
+ MY_STATE);
notify_hosts();
re_notify = 0;
}
prev parent reply other threads:[~2004-10-25 23:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4124DB86.9060505@steeleye.com>
[not found] ` <16677.22269.988036.787320@cse.unsw.edu.au>
2004-08-26 17:21 ` [PATCH / RFC] nfs-utils: High Availability NFS Paul Clements
2004-08-26 18:43 ` Paul Clements
2004-08-27 7:30 ` Olaf Kirch
2004-08-27 13:13 ` Paul Clements
2004-08-30 8:25 ` Olaf Kirch
2004-08-30 10:19 ` Greg Banks
2004-08-30 15:03 ` Paul Clements
2004-09-03 7:28 ` Kedar Sovani
2004-09-06 1:47 ` Neil Brown
2004-09-06 12:47 ` Kedar Sovani
2004-08-31 6:51 ` Neil Brown
2004-08-31 16:26 ` Paul Clements
2004-08-31 20:46 ` Paul Clements
2004-08-31 23:56 ` Neil Brown
2004-09-01 3:49 ` Paul Clements
2004-09-06 2:17 ` Neil Brown
2004-09-06 15:42 ` Paul Clements
2004-10-25 23:47 ` Paul Clements [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=417D909B.8080304@steeleye.com \
--to=paul.clements@steeleye.com \
--cc=neilb@cse.unsw.edu.au \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.