]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
sm-notify: Send fully-qualified and unqualified mon_names
authorChuck Lever <chuck.lever@oracle.com>
Fri, 19 Mar 2010 20:03:45 +0000 (16:03 -0400)
committerSteve Dickson <steved@redhat.com>
Fri, 19 Mar 2010 20:03:45 +0000 (16:03 -0400)
During any file locking interaction between an NFS client and server,
the client tells the server what hostname it will use as the mon_name
argument of the SM_NOTIFY request sent by the client when it reboots.
This is the "caller_name" argument of an NLMPROC_LOCK request.

The server, however, never tells the client what mon_name argument
it will use when sending an SM_NOTIFY request.  In order to recognize
the server, clients usually guess what mon_name the server might
send, by using the server hostname provided by the user on the mount
command line.

Frequently, the user provides an unqualified server name on the mount
command.  The server might then call the client back with a fully
qualified domain name, which might not match in some cases.

Solaris, and perhaps other implementations, attempt to mitigate this
problem by sending two SM_NOTIFY requests to each peer: one with an
unqualified mon_name argument, and one with a fully qualified mon_name.

Implement such a scheme for sm-notify.

Since my_name is almost always the fully-qualified hostname associated
with the local system, just wiping the left-most '.' in the my_name
argument and sending another SM_NOTIFY is nearly always sufficient.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/statd/sm-notify.c

index 2d146687f706dca0a8cc70dc38ebd80405ddcdac..437e37a6b49de679f72b9663324faad4b346723d 100644 (file)
@@ -634,15 +634,28 @@ recv_rpcbind_reply(struct sockaddr *sap, struct nsm_host *host, XDR *xdr)
 }
 
 /*
- * Successful NOTIFY call. Server returns void, so nothing
- * we need to do here.
+ * Successful NOTIFY call. Server returns void.
+ *
+ * Try sending another SM_NOTIFY with an unqualified "my_name"
+ * argument.  Reuse the port number.  If "my_name" is already
+ * unqualified, we're done.
  */
 static void
 recv_notify_reply(struct nsm_host *host)
 {
-       xlog(D_GENERAL, "Host %s notified successfully", host->name);
+       char *dot = strchr(host->my_name, '.');
 
-       smn_forget_host(host);
+       if (dot != NULL) {
+               *dot = '\0';
+               host->send_next = time(NULL);
+               host->xid = 0;
+               if (host->timeout >= NSM_MAX_TIMEOUT / 4)
+                       host->timeout = NSM_MAX_TIMEOUT / 4;
+               insert_host(host);
+       } else {
+               xlog(D_GENERAL, "Host %s notified successfully", host->name);
+               smn_forget_host(host);
+       }
 }
 
 /*