[7702] in Athena Bugs
NFS server changes
daemon@ATHENA.MIT.EDU (John Carr)
Fri Jun 28 18:54:39 1991
To: bugs@ATHENA.MIT.EDU, probe@ATHENA.MIT.EDU
Date: Fri, 28 Jun 91 18:54:29 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>
These are the diffs between the NFS server sources I use and the ones
in the Athena source tree.
Changes:
nfs_syncwrite = 0 (writes 3x faster).
Use "register" more often.
Don't check to see if a request is for AFS unless exportfs has been
called for /afs.
Must be root to call exportfs().
MAXCLIENTS = 6 (affects NFS clients).
nfs_portmon = 1 (needed for secure access to servers by multi-user
clients).
In addition to these diffs, add these lines to the beginning of
Nfs2AfsCall in afs_nfssrv.c:
if (afs_nonfsreqs)
return 0;
and add these lines just above Nfs2AfsCall():
/* Assume no NFS requests are directed to the translator. */
int afs_nonfsreqs = 1;
*** ref/nfs_server.c Fri Jun 21 14:05:31 1991
--- nfs_server.c Sun Jun 23 11:57:21 1991
***************
*** 1,6 ****
#ifndef lint
static char *nfs_server_c =
! "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/sys/nfs/RCS/nfs_server.c,v 1.19 91/06/21 13:56:44 probe Exp $";
#endif not lint
/*
* RCS Info
--- 1,6 ----
#ifndef lint
static char *nfs_server_c =
! "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/sys/nfs/RCS/nfs_server.c,v 1.17 90/11/13 13:31:56 probe Exp $";
#endif not lint
/*
* RCS Info
***************
*** 7,27 ****
* $Locker: $
*
* $Log: nfs_server.c,v $
- * Revision 1.19 91/06/21 13:56:44 probe
- * Don't require privileged ports for NFS requests; this option was enabled
- * assuming that all NFS implementations use privileged ports. It has now
- * been determined that there are several NFS implementations that do not
- * do so: 4.3Reno, some SYSV implementations
- *
- * Revision 1.18 91/03/24 16:55:04 probe
- * Fixed kernel crash:
- * If there are no valid directory entries and the last directory entry
- * skipped extends past the end of the block being examined, dp will end
- * up pointing past the end of the allocated block. [jfc]
- *
- * Revision 1.1 91/03/22 10:02:39 probe
- * Initial revision
- *
* Revision 1.17 90/11/13 13:31:56 probe
* include files changed with the latest AFS code
*
--- 7,12 ----
***************
*** 189,195 ****
int nfs_fascist = 0; /* non zero means no mapent, no access */
#endif
int nfs_mapon = 1; /* reported state of UID mapping */
! int nfs_syncwrite = 1; /* use synchronous writes (perf. hit) */
/* The UID to which unknown users map. */
--- 174,180 ----
int nfs_fascist = 0; /* non zero means no mapent, no access */
#endif
int nfs_mapon = 1; /* reported state of UID mapping */
! int nfs_syncwrite = 0; /* use synchronous writes (perf. hit) */
/* The UID to which unknown users map. */
***************
*** 524,530 ****
register struct nfsrdresult *rr;
{
int error;
! struct vnode *vp;
struct vattr va;
struct iovec iov;
struct uio uio;
--- 509,515 ----
register struct nfsrdresult *rr;
{
int error;
! register struct vnode *vp;
struct vattr va;
struct iovec iov;
struct uio uio;
***************
*** 758,764 ****
*/
int
rfs_create(args, dr, req)
! struct nfscreatargs *args;
struct nfsdiropres *dr;
struct svc_req *req;
{
--- 743,749 ----
*/
int
rfs_create(args, dr, req)
! register struct nfscreatargs *args;
struct nfsdiropres *dr;
struct svc_req *req;
{
***************
*** 1236,1242 ****
struct iovec iov;
struct uio uio;
register struct vnode *vp;
! struct direct *dp;
#ifdef NFSDEBUG
dprint(nfsdebug, 4, "rfs_readdir fh %o %d count %d\n",
--- 1221,1227 ----
struct iovec iov;
struct uio uio;
register struct vnode *vp;
! register struct direct *dp;
#ifdef NFSDEBUG
dprint(nfsdebug, 4, "rfs_readdir fh %o %d count %d\n",
***************
*** 1344,1351 ****
* Reset entries pointer and free space we are skipping
*/
if (skipped) {
- if (skipped > rd->rd_size)
- skipped = rd->rd_size;
rd->rd_size -= skipped;
rd->rd_bufsize -= skipped;
rd->rd_offset = offset;
--- 1329,1334 ----
***************
*** 1558,1564 ****
* If nfs_portmon is set, then clients are required to use
* privileged ports (ports < IPPORT_RESERVED) in order to get NFS services.
*/
! int nfs_portmon = 0;
void
rfs_dispatch(req, xprt)
--- 1541,1547 ----
* If nfs_portmon is set, then clients are required to use
* privileged ports (ports < IPPORT_RESERVED) in order to get NFS services.
*/
! int nfs_portmon = 1;
void
rfs_dispatch(req, xprt)
***************
*** 1740,1749 ****
#ifdef EXPORT_AFS
if (which != RFS_NULL) {
/* The following handling is for the nfs to afs translator.
* Note that only nfs calls destined to afs land are
* specially handled */
! if (Nfs2AfsCall(req->rq_vers, which, args)) {
struct afs_exporter *outexporter;
long dummypag;
#ifdef NFSDEBUG
--- 1723,1733 ----
#ifdef EXPORT_AFS
if (which != RFS_NULL) {
+ extern int afs_nonfsreqs;
/* The following handling is for the nfs to afs translator.
* Note that only nfs calls destined to afs land are
* specially handled */
! if (!afs_nonfsreqs && Nfs2AfsCall(req->rq_vers, which, args)) {
struct afs_exporter *outexporter;
long dummypag;
#ifdef NFSDEBUG
*** ref/nfs_subr.c Mon Jun 24 09:36:43 1991
--- nfs_subr.c Sun Jun 23 12:14:43 1991
***************
*** 1,6 ****
#ifndef lint
static char rcs_id[] =
! {"$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/sys/nfs/RCS/nfs_subr.c,v 1.8 91/06/24 09:36:27 probe Exp $"};
#endif not lint
/*
* RCS Info
--- 1,6 ----
#ifndef lint
static char rcs_id[] =
! {"$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/bsd-4.3/common/sys/nfs/RCS/nfs_subr.c,v 1.7 90/11/13 13:32:25 probe Exp $"};
#endif not lint
/*
* RCS Info
***************
*** 70,76 ****
} clstat;
! #define MAXCLIENTS 4
struct chtab {
int ch_timesused;
bool_t ch_inuse;
--- 70,76 ----
} clstat;
! #define MAXCLIENTS 6
struct chtab {
int ch_timesused;
bool_t ch_inuse;
***************
*** 560,566 ****
*/
makefh(fh, vp)
register fhandle_t *fh;
! struct vnode *vp;
{
struct inode *ip;
--- 560,566 ----
*/
makefh(fh, vp)
register fhandle_t *fh;
! register struct vnode *vp;
{
struct inode *ip;
***************
*** 690,699 ****
struct vnode *vp;
register int error;
! if (!suser()) {
! u.u_error = EPERM;
! return(EPERM);
! }
error = lookupname(uap->dname, UIO_USERSPACE, FOLLOW_LINK,
(struct vnode **)0, &vp);
--- 690,697 ----
struct vnode *vp;
register int error;
! if (!suser())
! return u.u_error;
error = lookupname(uap->dname, UIO_USERSPACE, FOLLOW_LINK,
(struct vnode **)0, &vp);
***************
*** 703,708 ****
--- 701,713 ----
vp->v_vfsp->vfs_exroot = (u_short)uap->rootid;
vp->v_vfsp->vfs_exflags = (short)uap->flags;
vp->v_vfsp->vfs_flag |= VFS_EXPORTED;
+ #ifdef EXPORT_AFS
+ if (vp->v_op == &afs_vnodeops) {
+ extern int afs_nonfsreqs;
+ afs_nonfsreqs = 0;
+ }
+ #endif
+
#ifdef NFSDEBUG
dprint(nfsdebug, 3, "exportfs: root %d flags %x\n",
vp->v_vfsp->vfs_exroot, vp->v_vfsp->vfs_exflags);