Linux compatible rpc.lockd

Björn Grönvall bg at sics.se
Thu Dec 9 07:19:14 PST 2004


On Thu, 25 Nov 2004 13:52:25 -0800
Bruce M Simpson <bms at spc.org> wrote:

Hi all,

> On Thu, Nov 25, 2004 at 08:18:12PM +0100, Björn Grönvall wrote:
> > I have made a patch to address PR kern/56461, in short the patch
> > provides two different options to be compatible with Linux lockd
> > implementations. It can also serve as a basis for a future more robust
> > rpc.lockd.
> 
> Thank you for this. I looked at this around 8 months ago but abandoned
> further work on it because the approach I was taking required that
> nfs be refactored to use the nmount() API, and because I am not currently
> using NFS. It looks as though the two options implemented here helps to
> address the problems I was having with making sure Linux servers got
> the right lock cookie response.
> 
> Have you tested this in production and does it work well? If so I believe
> it should be committed, but I'd defer to Alfred for further review.

I now believe that the patch has been tested enough. Its been running
on a rather busy fileserver for almost 3 weeks now and we have
observed no problems this far.

To ensure that rpc.lockd works correctly on 64 bit machines I think
this patch should also be applied.

Cheers,
Björn

--- kern.c~	Thu Nov 25 19:43:44 2004
+++ kern.c	Fri Nov 26 14:16:17 2004
@@ -44,6 +44,7 @@
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 #include <string.h>
 #include <syslog.h>
 #include <unistd.h>
@@ -290,6 +291,12 @@
 	} res;
 	int cookie_len;
 
+	/* union XXX */
+	assert((void *)&res.res.cookie == &res.res4.cookie);
+	assert((void *)&res.res.stat.stat == &res.res4.stat.stat);
+	assert((void *)&res.res.stat.nlm_testrply_u.holder.svid ==
+	       &res.res4.stat.nlm4_testrply_u.holder.svid);
+
 	if (asynchronous_client_rpc)
 		cookie_len = client_cookie_len;	/* Long cookies */
 	else
@@ -388,6 +395,10 @@
 	} res;
 	int cookie_len;
 
+	/* union XXX */
+	assert((void *)&res.res.cookie == &res.res4.cookie);
+	assert((void *)&res.res.stat.stat == &res.res4.stat.stat);
+
 	if (asynchronous_client_rpc)
 		cookie_len = client_cookie_len;	/* Long cookies */
 	else
@@ -493,6 +504,10 @@
 	} res;
 	int cookie_len;
 
+	/* union XXX */
+	assert((void *)&res.res.cookie == &res.res4.cookie);
+	assert((void *)&res.res.stat.stat == &res.res4.stat.stat);
+
 	if (asynchronous_client_rpc)
 		cookie_len = client_cookie_len;	/* Long cookies */
 	else
@@ -560,7 +575,7 @@
 		} else {
 			touch_client(cli);
 			lock_answer(msg->lm_msg_ident.pid,
-				    &res.res.cookie,
+				    &res.res.cookie,	/* union XXX */
 				    res.res.stat.stat,
 				    NULL,
 				    nlm_version);



-- 
  _     _                                           ,_______________.
Bjorn Gronvall (Björn Grönvall)                    /_______________/|
Swedish Institute of Computer Science              |               ||
PO Box 1263, S-164 29 Kista, Sweden                | Schroedingers ||
Email: bg at sics.se, Phone +46 -8 633 15 25          |      Cat      |/
Cellular +46 -70 768 06 35, Fax +46 -8 751 72 30   '---------------'


More information about the freebsd-net mailing list