diff -ruN openafs.submit/Makefile openafs.submit2/Makefile --- openafs.submit/Makefile 2011-11-26 21:55:30.000000000 -0500 +++ openafs.submit2/Makefile 2011-12-09 01:57:19.000000000 -0500 @@ -8,7 +8,7 @@ PORTNAME= openafs DISTVERSION= ${AFS_DISTVERSION}.${DBVERSION:S/-//g} -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net kld MASTER_SITES= http://dl.central.org/dl/openafs/${AFS_DISTVERSION}/:openafs \ http://dl.openafs.org/dl/openafs/${AFS_DISTVERSION}/:openafs \ diff -ruN openafs.submit/files/patch-src__afs__FBSD__osi_vnodeops.c openafs.submit2/files/patch-src__afs__FBSD__osi_vnodeops.c --- openafs.submit/files/patch-src__afs__FBSD__osi_vnodeops.c 1969-12-31 19:00:00.000000000 -0500 +++ openafs.submit2/files/patch-src__afs__FBSD__osi_vnodeops.c 2011-12-09 02:01:31.000000000 -0500 @@ -0,0 +1,51 @@ +commit 8e14168c9c77850ce0603d56f8aa280f73cb3114 +Author: Ben Kaduk +Date: Sun Nov 13 13:12:50 2011 -0500 + + FBSD: cleanup dvp locking for ISDOTDOT + + This is a more correct version of + c2ed2577f9c16df3088158fb593d7aab6e8690d0, which was reverted since + it caused build issues on some versions and kernel panics on others. + + We do want to always unlock dvp before calling over the network + in the ISDOTDOT case, but be sure to use the proper spelling + for this operation (as the syntax has changed between FreeBSD versions). + This requires not unlocking dvp right after the afs_lookup() call if + it succeeds, letting us just lock the "child" vp (which is actually + the parent starting from '/') first, and then re-lock dvp. + + The error case of afs_lookup() was already handled correctly in + this logic, which is to say that it was incorrect before this change, + attempting to recursively lock dvp which causes a panic. + + Change-Id: Ide29e47991413dadc3a2b5948f0f6c5bfa2911c4 + Reviewed-on: http://gerrit.openafs.org/6127 + Tested-by: BuildBot + Reviewed-by: Derrick Brashear + +diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c +index 311b5a9..a9be0c3 100644 +--- a/src/afs/FBSD/osi_vnodeops.c ++++ b/src/afs/FBSD/osi_vnodeops.c +@@ -503,10 +503,8 @@ afs_vop_lookup(ap) + + cnp->cn_flags |= MPSAFE; /* steel */ + +-#ifndef AFS_FBSD70_ENV + if (flags & ISDOTDOT) +- VOP_UNLOCK(dvp, 0, p); +-#endif ++ MA_VOP_UNLOCK(dvp, 0, p); + + AFS_GLOCK(); + error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred); +@@ -531,7 +529,7 @@ afs_vop_lookup(ap) + * we also always return the vnode locked. */ + + if (flags & ISDOTDOT) { +- MA_VOP_UNLOCK(dvp, 0, p); ++ /* vp before dvp since we go root to leaf, and .. comes first */ + ma_vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + ma_vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + /* always return the child locked */ diff -ruN openafs.submit/files/patch-src__afs__afs_server.c openafs.submit2/files/patch-src__afs__afs_server.c --- openafs.submit/files/patch-src__afs__afs_server.c 2011-11-26 21:55:22.000000000 -0500 +++ openafs.submit2/files/patch-src__afs__afs_server.c 2011-12-09 02:00:38.000000000 -0500 @@ -1,13 +1,64 @@ +commit 1ef8dc3dfbddcbe5610c276afc627c9fcfe30a65 +Author: Ben Kaduk +Date: Sat Dec 3 14:37:09 2011 -0500 + + FBSD: switch afsi_SetServerIPRank implementation + + Upstream has removed the ia_net{,mask} elements from + struct in_ifaddr, so we can no longer use them directly. + Switch to passing an rx_ifaddr_t (i.e. struct ifaddr*) in instead, + as that uses a slightly different codepath which still works + for our purposes. + + We compile the kernel module with -Werror, so storing a pointer + (memcpy return value) in an int is forbidden, hence the conditional + declaration of 't'. + + Change-Id: Ifefef88a353f4bd50a714ad88afa3a6f012fa3a1 + Reviewed-on: http://gerrit.openafs.org/6203 + Tested-by: BuildBot + Reviewed-by: Derrick Brashear + diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c -index ad28100..cafd355 100644 +index ad28100..3f4e8d2 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c -@@ -1032,7 +1032,7 @@ afsi_SetServerIPRank(struct srvAddr *sa, struct in_ifaddr *ifa) +@@ -1025,7 +1025,7 @@ afsi_SetServerIPRank(struct srvAddr *sa, afs_int32 addr, + return; + } + #else /* AFS_USERSPACE_IP_ADDR */ +-#if (! defined(AFS_SUN5_ENV)) && (! defined(AFS_DARWIN_ENV)) && (! defined(AFS_OBSD47_ENV)) && defined(USEIFADDR) ++#if (! defined(AFS_SUN5_ENV)) && (! defined(AFS_DARWIN_ENV)) && (! defined(AFS_OBSD47_ENV)) && (! defined(AFS_FBSD_ENV)) && defined(USEIFADDR) + void + afsi_SetServerIPRank(struct srvAddr *sa, struct in_ifaddr *ifa) + { +@@ -1062,7 +1062,7 @@ afsi_SetServerIPRank(struct srvAddr *sa, struct in_ifaddr *ifa) + #endif /* IFF_POINTTOPOINT */ + } + #endif /*(!defined(AFS_SUN5_ENV)) && defined(USEIFADDR) */ +-#if (defined(AFS_DARWIN_ENV) || defined(AFS_OBSD47_ENV)) && defined(USEIFADDR) ++#if (defined(AFS_DARWIN_ENV) || defined(AFS_OBSD47_ENV) || defined(AFS_FBSD_ENV)) && defined(USEIFADDR) + #ifndef afs_min + #define afs_min(A,B) ((A)<(B)) ? (A) : (B) + #endif +@@ -1071,7 +1071,11 @@ afsi_SetServerIPRank(struct srvAddr *sa, rx_ifaddr_t ifa) + { + struct sockaddr sout; struct sockaddr_in *sin; ++#if defined(AFS_DARWIN80_ENV) && !defined(UKERNEL) int t; ++#else ++ void *t; ++#endif -- if ((ntohl(sa->sa_ip) & ifa->ia_netmask) == ifa->ia_net) { -+ if (1) { - if ((ntohl(sa->sa_ip) & ifa->ia_subnetmask) == ifa->ia_subnet) { - sin = IA_SIN(ifa); - if (SA2ULONG(sin) == ntohl(sa->sa_ip)) { /* ie, ME!!! */ + afs_uint32 subnetmask, myAddr, myNet, myDstaddr, mySubnet, netMask; + afs_uint32 serverAddr; +@@ -1393,7 +1397,7 @@ afs_SetServerPrefs(struct srvAddr *sa) + #else + TAILQ_FOREACH(ifa, &in_ifaddrhead, ia_link) { + #endif +- afsi_SetServerIPRank(sa, ifa); ++ afsi_SetServerIPRank(sa, &ifa->ia_ifa); + }} + #elif defined(AFS_OBSD_ENV) + { diff -ruN openafs.submit/files/patch-src__rx__FBSD__rx_knet.c openafs.submit2/files/patch-src__rx__FBSD__rx_knet.c --- openafs.submit/files/patch-src__rx__FBSD__rx_knet.c 2011-10-14 20:37:24.000000000 -0400 +++ openafs.submit2/files/patch-src__rx__FBSD__rx_knet.c 2011-12-09 01:57:28.000000000 -0500 @@ -6,7 +6,7 @@ p = pfind(rxk_ListenerPid); if (p) { afs_warn("osi_StopListener: rxk_ListenerPid %u\n", rxk_ListenerPid); -+#if (__FreeBSD_version >= 90004) ++#if (__FreeBSD_version >= 900044) + kern_psignal(p, SIGUSR1); +#else psignal(p, SIGUSR1);