From owner-svn-src-stable@FreeBSD.ORG Sat May 14 02:28:22 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 149DA1065672; Sat, 14 May 2011 02:28:22 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE54A8FC14; Sat, 14 May 2011 02:28:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4E2SLZ7089839; Sat, 14 May 2011 02:28:21 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4E2SLcG089835; Sat, 14 May 2011 02:28:21 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201105140228.p4E2SLcG089835@svn.freebsd.org> From: Rick Macklem Date: Sat, 14 May 2011 02:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221871 - in stable/8/sys: fs/nfs fs/nfsclient nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 02:28:22 -0000 Author: rmacklem Date: Sat May 14 02:28:21 2011 New Revision: 221871 URL: http://svn.freebsd.org/changeset/base/221871 Log: MFC: r221014,r221018 Modify the experimental NFS client so that it uses the same "struct nfs_args" as the regular NFS client. This is needed so that the old mount(2) syscall will work and it makes sharing of the diskless NFS root code easier. Eary in the porting exercise I introduced a new revision of nfs_args, but didn't actually need it, thanks to nmount(2). I re-introduced the NFSMNT_KERB flag, since it does essentially the same thing and the old one would not have been used because it never worked. I also added a few new NFSMNT_xxx flags to sys/nfsclient/nfs_args.h that are used by the experimental NFS client. Also fix the NFS client so that it doesn't bogusly set the f_flags argument of "struct statfs", Deleted: stable/8/sys/fs/nfsclient/nfsargs.h Modified: stable/8/sys/fs/nfs/nfsport.h stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/nfsclient/nfsargs.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfs/nfsport.h ============================================================================== --- stable/8/sys/fs/nfs/nfsport.h Sat May 14 01:56:48 2011 (r221870) +++ stable/8/sys/fs/nfs/nfsport.h Sat May 14 02:28:21 2011 (r221871) @@ -372,7 +372,7 @@ struct ext_nfsstats { #include #include #include -#include +#include #include /* Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat May 14 01:56:48 2011 (r221870) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sat May 14 02:28:21 2011 (r221871) @@ -100,8 +100,9 @@ static void nfs_decode_args(struct mount struct nfs_args *argp, const char *, struct ucred *, struct thread *); static int mountnfs(struct nfs_args *, struct mount *, - struct sockaddr *, char *, u_char *, u_char *, u_char *, - struct vnode **, struct ucred *, struct thread *, int); + struct sockaddr *, char *, u_char *, int, u_char *, int, + u_char *, int, struct vnode **, struct ucred *, + struct thread *, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -315,7 +316,6 @@ nfs_statfs(struct mount *mp, struct stat if (gotfsinfo || (nmp->nm_flag & NFSMNT_NFSV4)) nfscl_loadfsinfo(nmp, &fs); nfscl_loadsbinfo(nmp, &sb, sbp); - sbp->f_flags = nmp->nm_flag; sbp->f_iosize = newnfs_iosize(nmp); mtx_unlock(&nmp->nm_mtx); if (sbp != &mp->mnt_stat) { @@ -501,11 +501,21 @@ nfs_mountdiskless(char *path, struct vnode **vpp, struct mount *mp) { struct sockaddr *nam; - int error; + int dirlen, error; + char *dirpath; + /* + * Find the directory path in "path", which also has the server's + * name/ip address in it. + */ + dirpath = strchr(path, ':'); + if (dirpath != NULL) + dirlen = strlen(++dirpath); + else + dirlen = 0; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); - if ((error = mountnfs(args, mp, nam, path, NULL, NULL, NULL, vpp, - td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, + NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -733,14 +743,10 @@ nfs_mount(struct mount *mp) .readahead = NFS_DEFRAHEAD, .wcommitsize = 0, /* was: NQ_DEFLEASE */ .hostname = NULL, - /* args version 4 */ .acregmin = NFS_MINATTRTIMO, .acregmax = NFS_MAXATTRTIMO, .acdirmin = NFS_MINDIRATTRTIMO, .acdirmax = NFS_MAXDIRATTRTIMO, - .dirlen = 0, - .krbnamelen = 0, - .srvkrbnamelen = 0, }; int error = 0, ret, len; struct sockaddr *nam = NULL; @@ -750,6 +756,7 @@ nfs_mount(struct mount *mp) u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; char *opt, *name, *secname; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; + int dirlen, krbnamelen, srvkrbnamelen; if (vfs_filteropt(mp->mnt_optnew, nfs_opts)) { error = EINVAL; @@ -1008,19 +1015,19 @@ nfs_mount(struct mount *mp) strlcpy(srvkrbname, name, sizeof (srvkrbname)); else snprintf(srvkrbname, sizeof (srvkrbname), "nfs@%s", hst); - args.srvkrbnamelen = strlen(srvkrbname); + srvkrbnamelen = strlen(srvkrbname); if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0) strlcpy(krbname, name, sizeof (krbname)); else krbname[0] = '\0'; - args.krbnamelen = strlen(krbname); + krbnamelen = strlen(krbname); if (vfs_getopt(mp->mnt_optnew, "dirpath", (void **)&name, NULL) == 0) strlcpy(dirpath, name, sizeof (dirpath)); else dirpath[0] = '\0'; - args.dirlen = strlen(dirpath); + dirlen = strlen(dirpath); if (vfs_getopt(mp->mnt_optnew, "addr", (void **)&args.addr, &args.addrlen) == 0) { @@ -1034,8 +1041,9 @@ nfs_mount(struct mount *mp) } args.fh = nfh; - error = mountnfs(&args, mp, nam, hst, krbname, dirpath, srvkrbname, - &vp, td->td_ucred, td, negnametimeo); + error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, + dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, + negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1077,9 +1085,9 @@ nfs_cmount(struct mntarg *ma, void *data */ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, - char *hst, u_char *krbname, u_char *dirpath, u_char *srvkrbname, - struct vnode **vpp, struct ucred *cred, struct thread *td, - int negnametimeo) + char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, + u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, + struct ucred *cred, struct thread *td, int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1094,17 +1102,15 @@ mountnfs(struct nfs_args *argp, struct m return (0); } else { MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount) + - argp->krbnamelen + argp->dirlen + argp->srvkrbnamelen + 2, - M_NEWNFSMNT, M_WAITOK); - bzero((caddr_t)nmp, sizeof (struct nfsmount) + - argp->krbnamelen + argp->dirlen + argp->srvkrbnamelen + 2); + krbnamelen + dirlen + srvkrbnamelen + 2, + M_NEWNFSMNT, M_WAITOK | M_ZERO); TAILQ_INIT(&nmp->nm_bufq); if (clval == 0) clval = (u_int64_t)nfsboottime.tv_sec; nmp->nm_clval = clval++; - nmp->nm_krbnamelen = argp->krbnamelen; - nmp->nm_dirpathlen = argp->dirlen; - nmp->nm_srvkrbnamelen = argp->srvkrbnamelen; + nmp->nm_krbnamelen = krbnamelen; + nmp->nm_dirpathlen = dirlen; + nmp->nm_srvkrbnamelen = srvkrbnamelen; if (td->td_ucred->cr_uid != (uid_t)0) { /* * nm_uid is used to get KerberosV credentials for Modified: stable/8/sys/nfsclient/nfsargs.h ============================================================================== --- stable/8/sys/nfsclient/nfsargs.h Sat May 14 01:56:48 2011 (r221870) +++ stable/8/sys/nfsclient/nfsargs.h Sat May 14 02:28:21 2011 (r221871) @@ -78,7 +78,7 @@ struct nfs_args { #define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ /* 0x100 free, was NFSMNT_NQNFS */ #define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ -/* 0x400 free, was NFSMNT_KERB */ +#define NFSMNT_KERB 0x00000400 /* Use RPCSEC_GSS/Krb5 */ #define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ #define NFSMNT_WCOMMITSIZE 0x00001000 /* set max write commit size */ #define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ @@ -93,6 +93,10 @@ struct nfs_args { #define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */ #define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */ #define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */ +#define NFSMNT_INTEGRITY 0x02000000 /* Use integrity with RPCSEC_GSS */ +#define NFSMNT_PRIVACY 0x04000000 /* Use privacy with RPCSEC_GSS */ +#define NFSMNT_ALLGSSNAME 0x08000000 /* Use principal for all accesses */ +#define NFSMNT_STRICT3530 0x10000000 /* Adhere strictly to RFC3530 */ #define NFSMNT_NOCTO 0x20000000 /* Don't flush attrcache on open */ #endif