[OpenAFS] Re: HOWTO: multiple cells on a single machine

Adam Megacz megacz@cs.berkeley.edu
Sun, 28 May 2006 12:18:42 -0700


--=-=-=


>>> Okay, so, it looks like this might be a problem; although fileserver
>>> has been working great for me, the "vos" suite of commands just hangs

>>> Is the -rxbind patch expected to solve this problem?

>> Still curious about this.

> Doubt it.

The enclosed patch is a hideous workaround for this.

It forces fssync to use a unix domain socket with the hardcoded
filename "/var/lib/openafs/fssync.sock".  It appears to be working
right now ("vos create/remove").

  - a


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=domainsocket.patch

--- ../openafs-1.4.1/src/vol/fssync.c	2006-05-28 12:02:38.000000000 -0700
+++ openafs-1.4.1.orig/src/vol/fssync.c	2005-07-20 22:08:03.000000000 -0700
@@ -94,8 +94,6 @@
 #include "volume.h"
 #include "partition.h"
 
-#include <sys/un.h>
-
 /*@printflike@*/ extern void Log(const char *format, ...);
 
 #ifdef osi_Assert
@@ -161,7 +159,7 @@
 int
 FSYNC_clientInit(void)
 {
-    struct sockaddr_un addr;
+    struct sockaddr_in addr;
     /* I can't believe the following is needed for localhost connections!! */
     static time_t backoff[] =
 	{ 3, 3, 3, 5, 5, 5, 7, 15, 16, 24, 32, 40, 48, 0 };
@@ -262,23 +260,19 @@
 #endif /* AFS_PTHREAD_ENV */
 }
 
-
-#define UNIX_SOCKNAME "/var/lib/openafs/fssync.sock"
 static int
-getport(struct sockaddr_un *sa)
+getport(struct sockaddr_in *addr)
 {
     int sd;
 
-    memset(sa, 0, sizeof(*sa));
-    sa->sun_family = AF_UNIX;
-    strncpy(sa->sun_path, UNIX_SOCKNAME, (sizeof(struct sockaddr_un) - sizeof(short)));
-    assert((sd = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0);
-    //#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
-    //    addr->sin_len = sizeof(struct sockaddr_in);
-    //#endif
-    //    addr->sin_addr.s_addr = htonl(0x7f000001);
-    //    addr->sin_family = AF_INET;	/* was localhost->h_addrtype */
-    //    addr->sin_port = htons(2040);	/* XXXX htons not _really_ neccessary */
+    memset(addr, 0, sizeof(*addr));
+    assert((sd = socket(AF_INET, SOCK_STREAM, 0)) >= 0);
+#ifdef STRUCT_SOCKADDR_HAS_SA_LEN
+    addr->sin_len = sizeof(struct sockaddr_in);
+#endif
+    addr->sin_addr.s_addr = htonl(0x7f000001);
+    addr->sin_family = AF_INET;	/* was localhost->h_addrtype */
+    addr->sin_port = htons(2040);	/* XXXX htons not _really_ neccessary */
 
     return sd;
 }
@@ -288,7 +282,7 @@
 static void
 FSYNC_sync()
 {
-    struct sockaddr_un addr;
+    struct sockaddr_in addr;
     int on = 1;
     extern VInit;
     int code;
@@ -319,16 +313,11 @@
 	LWP_DispatchProcess();
 #endif /* AFS_PTHREAD_ENV */
     }
-
-    /* ignore errors */
-    remove(UNIX_SOCKNAME);
-
     AcceptSd = getport(&addr);
     /* Reuseaddr needed because system inexplicably leaves crud lying around */
     code =
 	setsockopt(AcceptSd, SOL_SOCKET, SO_REUSEADDR, (char *)&on,
 		   sizeof(on));
-
     if (code)
 	Log("FSYNC_sync: setsockopt failed with (%d)\n", errno);
 

--=-=-=--