From d78b844133549b530273fc7ad1ea376d582985d9 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Wed, 24 Oct 2007 16:44:26 +0000 Subject: [PATCH] linux-nfstrans-20071024 FIXES 75233 better track changes so we can build an nfstranslator module for new linux kernels --- acinclude.m4 | 8 ++++++++ src/afs/LINUX/osi_export.c | 4 ++++ src/afs/LINUX/osi_nfssrv.c | 16 +++++++++++----- src/afs/afs_prototypes.h | 1 + src/cf/linux-test4.m4 | 19 +++++++++++++++++++ 5 files changed, 43 insertions(+), 5 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 1df0d24..db381a2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -586,6 +586,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 @@ -637,6 +638,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 @@ -720,6 +722,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 @@ -878,6 +883,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 diff --git a/src/afs/LINUX/osi_export.c b/src/afs/LINUX/osi_export.c index 5de06a1..24d5063 100644 --- a/src/afs/LINUX/osi_export.c +++ b/src/afs/LINUX/osi_export.c @@ -18,6 +18,10 @@ RCSID ("$Header$"); #include /* early to avoid printf->printk mapping */ +#include +#ifdef EXPORTFS_H_EXISTS +#include +#endif #include "afs/sysincludes.h" #include "afsincludes.h" #include "afs/afs_dynroot.h" diff --git a/src/afs/LINUX/osi_nfssrv.c b/src/afs/LINUX/osi_nfssrv.c index 1ae6c9c..a2c2e05 100644 --- a/src/afs/LINUX/osi_nfssrv.c +++ b/src/afs/LINUX/osi_nfssrv.c @@ -19,6 +19,7 @@ RCSID #if !defined(AFS_NONFSTRANS) || defined(AFS_AIX_IAUTH_ENV) #include /* early to avoid printf->printk mapping */ +#include #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; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 1f940ed..798eb9e 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -529,6 +529,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(); diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 3cb0ee0..659edaf 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -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 ], +[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]) @@ -894,3 +903,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 ], +[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)]) + -- 1.9.4