DEVEL15-linux-nfstrans-20071024
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Wed, 24 Oct 2007 16:45:01 +0000 (16:45 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 24 Oct 2007 16:45:01 +0000 (16:45 +0000)
FIXES 75233

better track changes so we can build an nfstranslator module for new linux kernels

(cherry picked from commit d78b844133549b530273fc7ad1ea376d582985d9)

acinclude.m4
src/afs/LINUX/osi_export.c
src/afs/LINUX/osi_nfssrv.c
src/afs/afs_prototypes.h
src/cf/linux-test4.m4

index 9aebfc2..5f7b9ad 100644 (file)
@@ -601,6 +601,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_KMEM_CACHE_CREATE_TAKES_DTOR
                 LINUX_CONFIG_H_EXISTS
                 LINUX_COMPLETION_H_EXISTS
+                LINUX_EXPORTFS_H_EXISTS
                 LINUX_DEFINES_FOR_EACH_PROCESS
                 LINUX_DEFINES_PREV_TASK
                 LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE
@@ -652,6 +653,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_GET_SB_HAS_STRUCT_VFSMOUNT
                 LINUX_STATFS_TAKES_DENTRY
                 LINUX_FREEZER_H_EXISTS
+                LINUX_HAVE_SVC_ADDR_IN
                 if test "x$ac_cv_linux_freezer_h_exists" = "xyes" ; then
                  AC_DEFINE(FREEZER_H_EXISTS, 1, [define if you have linux/freezer.h])
                 fi
@@ -735,6 +737,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test "x$ac_cv_linux_config_h_exists" = "xyes" ; then
                  AC_DEFINE(CONFIG_H_EXISTS, 1, [define if config.h exists])
                 fi
+                if test "x$ac_cv_linux_exportfs_h_exists" = "xyes"; then
+                 AC_DEFINE(EXPORTFS_H_EXISTS, 1, [define if linux/exportfs.h exists])
+                fi
                 if test "x$ac_cv_linux_defines_for_each_process" = "xyes" ; then
                  AC_DEFINE(DEFINED_FOR_EACH_PROCESS, 1, [define if for_each_process defined])
                 fi
@@ -893,6 +898,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 else
                  AC_MSG_WARN([your kernel does not have a usable symlink cache API])
                 fi
+                if test "x$ac_cv_linux_have_svc_addr_in" = "xyes"; then
+                 AC_DEFINE(HAVE_SVC_ADDR_IN, 1, [define if svc_add_in exists])
+                 fi
                 :
                fi
 esac
index 5de06a1..24d5063 100644 (file)
@@ -18,6 +18,10 @@ RCSID
     ("$Header$");
 
 #include <linux/module.h> /* early to avoid printf->printk mapping */
+#include <linux/fs.h>
+#ifdef EXPORTFS_H_EXISTS
+#include <linux/exportfs.h>
+#endif
 #include "afs/sysincludes.h"
 #include "afsincludes.h"
 #include "afs/afs_dynroot.h"
index 1ae6c9c..a2c2e05 100644 (file)
@@ -19,6 +19,7 @@ RCSID
 
 #if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV)
 #include <linux/module.h> /* early to avoid printf->printk mapping */
+#include <linux/fs.h>
 #include "afs/sysincludes.h"
 #include "afsincludes.h"
 #include "nfsclient.h"
@@ -96,6 +97,7 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
     struct nfs_server_thread *ns;
     struct afs_exporter *outexp;
     struct AFS_UCRED *credp;
+    struct sockaddr_in *addr;
     int code;
 
     code = afs_orig_authtab[rqstp->rq_authop->flavour]->accept(rqstp, authp);
@@ -109,11 +111,16 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
        /* XXX maybe we should fail this with rpc_system_err? */
        return SVC_OK;
     }
+#if HAVE_SVC_ADDR_IN
+    addr = svc_addr_in(rqstp);
+#else
+    addr = &rqstp->rq_addr;
+#endif
 
     ns->active         = 1;
     ns->flavor         = rqstp->rq_authop->flavour;
     ns->code           = EACCES;
-    ns->client_addr    = rqstp->rq_addr;
+    ns->client_addr    = *addr;
     ns->client_addrlen = rqstp->rq_addrlen;
     ns->client_uid     = rqstp->rq_cred.cr_uid;
     ns->client_gid     = rqstp->rq_cred.cr_gid;
@@ -126,10 +133,9 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
     else
        ns->client_g1   = -1;
 
-    /* NB: Don't check the length; it's not always filled in! */
-    if (rqstp->rq_addr.sin_family != AF_INET) {
+    if (addr->sin_family != AF_INET) {
        printk("afs: NFS request from non-IPv4 client (family %d len %d)\n",
-              rqstp->rq_addr.sin_family, rqstp->rq_addrlen);
+              addr->sin_family, rqstp->rq_addrlen);
        goto done;
     }
 
@@ -143,7 +149,7 @@ svcauth_afs_accept(struct svc_rqst *rqstp, u32 *authp)
      * clients to afs_nobody */
     if (credp->cr_uid == -1)
        credp->cr_uid = -2;
-    code = afs_nfsclient_reqhandler(0, &credp, rqstp->rq_addr.sin_addr.s_addr,
+    code = afs_nfsclient_reqhandler(0, &credp, addr->sin_addr.s_addr,
                                    &ns->uid, &outexp);
     if (!code && outexp) EXP_RELE(outexp);
     if (!code) ns->code = 0;
index 203eada..1dd1d4d 100644 (file)
@@ -528,6 +528,7 @@ extern void osi_FreeLargeSpace(void *adata);
 extern void osi_FreeSmallSpace(void *adata);
 extern void *osi_AllocLargeSpace(size_t size);
 extern void *osi_AllocSmallSpace(size_t size);
+extern void shutdown_osinet(void);
 
 /* afs_osi_pag.c */
 extern int afs_setpag();
index 4827ab4..0d9af92 100644 (file)
@@ -41,6 +41,15 @@ lose
       ac_cv_linux_completion_h_exists=no)])
   AC_MSG_RESULT($ac_cv_linux_completion_h_exists)])
 
+AC_DEFUN([LINUX_EXPORTFS_H_EXISTS], [
+  AC_MSG_CHECKING([for linux/exportfs.h existence])
+  AC_CACHE_VAL([ac_cv_linux_exportfs_h_exists], [
+    AC_TRY_KBUILD(
+[#include <linux/exportfs.h>],
+[return;],
+      ac_cv_linux_exportfs_h_exists=yes,
+      ac_cv_linux_exportfs_h_exists=no)])
+  AC_MSG_RESULT($ac_cv_linux_exportfs_h_exists)])
 
 AC_DEFUN([LINUX_DEFINES_FOR_EACH_PROCESS], [
   AC_MSG_CHECKING([for defined for_each_process])
@@ -902,3 +911,13 @@ _fop.sendfile(NULL, NULL, 0, 0, NULL);],
       ac_cv_linux_fs_struct_fop_has_sendfile=no)])
   AC_MSG_RESULT($ac_cv_linux_fs_struct_fop_has_sendfile)])
 
+AC_DEFUN([LINUX_HAVE_SVC_ADDR_IN], [
+  AC_MSG_CHECKING([whether svc_addr_in exists])
+  AC_CACHE_VAL([ac_cv_linux_have_svc_addr_in], [
+    AC_TRY_KBUILD(
+[#include <linux/sunrpc/svc.h>],
+[svc_addr_in(NULL);],
+      ac_cv_linux_have_svc_addr_in=yes,
+      ac_cv_linux_have_svc_addr_in=no)])
+  AC_MSG_RESULT($ac_cv_linux_have_svc_addr_in)])
+