summaryrefslogtreecommitdiffstats
path: root/utils/statd/callback.c
diff options
context:
space:
mode:
authorRong Zeng <rongzeng@us.ibm.com>2014-06-01 13:04:48 -0400
committerSteve Dickson <steved@redhat.com>2014-06-01 13:10:02 -0400
commita126e718ab931963ca877fd11203f873fd50811f (patch)
treebc445e1cdf15217adfce6b0257720fc4850e162a /utils/statd/callback.c
parent548bbdc49b1f5dfbe7ba75d20c5791652dfeb125 (diff)
downloadnfs-utils-a126e718ab931963ca877fd11203f873fd50811f.tar.gz
nfs-utils-a126e718ab931963ca877fd11203f873fd50811f.tar.xz
nfs-utils-a126e718ab931963ca877fd11203f873fd50811f.zip
statd: Adding callback on sm_notify
This patch adds a callback for incoming sm_notify to better handle stale lock issue in client crash recovery in HA-NFS environment 1. "sm-notify" - callout name 2. monitored client name as in the SM_NOTIFY request 3. IP of the sender of the SM_NOITFY request. 4. state value in the SM_NOTIFY request This new interface can be used by different HA-NFS product in its specific configuration and environment to recover from the client crash and stale lock scenarios. Signed-off-by: Rong Zeng <rongzeng@us.ibm.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/statd/callback.c')
-rw-r--r--utils/statd/callback.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/utils/statd/callback.c b/utils/statd/callback.c
index d1cc139..bb7c590 100644
--- a/utils/statd/callback.c
+++ b/utils/statd/callback.c
@@ -10,11 +10,13 @@
#include <config.h>
#endif
+#include <unistd.h>
#include <netdb.h>
#include "rpcmisc.h"
#include "statd.h"
#include "notlist.h"
+#include "ha-callout.h"
/* Callback notify list. */
/* notify_list *cbnl = NULL; ... never used */
@@ -87,6 +89,13 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
xlog(D_CALL, "Received SM_NOTIFY from %s, state: %d",
argp->mon_name, argp->state);
+ if (!statd_present_address(sap, ip_addr, sizeof(ip_addr))) {
+ xlog_warn("Unrecognized sender address");
+ return ((void *) &result);
+ }
+
+ ha_callout("sm-notify", argp->mon_name, ip_addr, argp->state);
+
/* quick check - don't bother if we're not monitoring anyone */
if (rtnl == NULL) {
xlog_warn("SM_NOTIFY from %s while not monitoring any hosts",
@@ -94,11 +103,6 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
return ((void *) &result);
}
- if (!statd_present_address(sap, ip_addr, sizeof(ip_addr))) {
- xlog_warn("Unrecognized sender address");
- return ((void *) &result);
- }
-
/* okir change: statd doesn't remove the remote host from its
* internal monitor list when receiving an SM_NOTIFY call from
* it. Lockd will want to continue monitoring the remote host