svn commit: r284318 - stable/10/sys/fs/nfsserver
Author: rmacklem Date: Fri Jun 12 13:42:53 2015 New Revision: 284318 URL: https://svnweb.freebsd.org/changeset/base/284318 Log: Add TUNABLE_INT() macros so that the tunables MFC'd from head as r284216 are set via /boot/loader.conf in stable/10. This is a direct commit to stable/10 because TUNABLE_INT() is deprecated in head. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Fri Jun 12 13:16:50 2015 (r284317) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Fri Jun 12 13:42:53 2015 (r284318) @@ -46,26 +46,31 @@ NFSSTATESPINLOCK; SYSCTL_DECL(_vfs_nfsd); intnfsrv_statehashsize = NFSSTATEHASHSIZE; +TUNABLE_INT(vfs.nfsd.statehashsize, nfsrv_statehashsize); SYSCTL_INT(_vfs_nfsd, OID_AUTO, statehashsize, CTLFLAG_RDTUN, nfsrv_statehashsize, 0, Size of state hash table set via loader.conf); intnfsrv_clienthashsize = NFSCLIENTHASHSIZE; +TUNABLE_INT(vfs.nfsd.clienthashsize, nfsrv_clienthashsize); SYSCTL_INT(_vfs_nfsd, OID_AUTO, clienthashsize, CTLFLAG_RDTUN, nfsrv_clienthashsize, 0, Size of client hash table set via loader.conf); intnfsrv_lockhashsize = NFSLOCKHASHSIZE; +TUNABLE_INT(vfs.nfsd.fhhashsize, nfsrv_lockhashsize); SYSCTL_INT(_vfs_nfsd, OID_AUTO, fhhashsize, CTLFLAG_RDTUN, nfsrv_lockhashsize, 0, Size of file handle hash table set via loader.conf); intnfsrv_sessionhashsize = NFSSESSIONHASHSIZE; +TUNABLE_INT(vfs.nfsd.sessionhashsize, nfsrv_sessionhashsize); SYSCTL_INT(_vfs_nfsd, OID_AUTO, sessionhashsize, CTLFLAG_RDTUN, nfsrv_sessionhashsize, 0, Size of session hash table set via loader.conf); static int nfsrv_v4statelimit = NFSRV_V4STATELIMIT; +TUNABLE_INT(vfs.nfsd.v4statelimit, nfsrv_v4statelimit); SYSCTL_INT(_vfs_nfsd, OID_AUTO, v4statelimit, CTLFLAG_RWTUN, nfsrv_v4statelimit, 0, High water limit for NFSv4 opens+locks+delegations); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r284216 - in stable/10/sys/fs: nfs nfsserver
Author: rmacklem Date: Wed Jun 10 12:17:19 2015 New Revision: 284216 URL: https://svnweb.freebsd.org/changeset/base/284216 Log: MFC: r283635 Make the size of the hash tables used by the NFSv4 server tunable. No appreciable change in performance was observed after increasing the sizes of these tables and then testing with a single client. However, there was an email that indicated high CPU overheads for a heavily loaded NFSv4 and it is hoped that increasing the sizes of the hash tables via these tunables might help. The tables remain the same size by default. Modified: stable/10/sys/fs/nfs/nfs.h stable/10/sys/fs/nfs/nfsdport.h stable/10/sys/fs/nfs/nfsrvstate.h stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/fs/nfsserver/nfs_nfsdserv.c stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c stable/10/sys/fs/nfsserver/nfs_nfsdstate.c stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs.h == --- stable/10/sys/fs/nfs/nfs.h Wed Jun 10 10:48:12 2015(r284215) +++ stable/10/sys/fs/nfs/nfs.h Wed Jun 10 12:17:19 2015(r284216) @@ -138,11 +138,11 @@ /* * This macro defines the high water mark for issuing V4 delegations. - * (It is currently set at a conservative 20% of NFSRV_V4STATELIMIT. This + * (It is currently set at a conservative 20% of nfsrv_v4statelimit. This * may want to increase when clients can make more effective use of * delegations.) */ -#defineNFSRV_V4DELEGLIMIT(c) (((c) * 5) NFSRV_V4STATELIMIT) +#defineNFSRV_V4DELEGLIMIT(c) (((c) * 5) nfsrv_v4statelimit) #defineNFS_READDIRBLKSIZ DIRBLKSIZ /* Minimal nm_readdirsize */ Modified: stable/10/sys/fs/nfs/nfsdport.h == --- stable/10/sys/fs/nfs/nfsdport.h Wed Jun 10 10:48:12 2015 (r284215) +++ stable/10/sys/fs/nfs/nfsdport.h Wed Jun 10 12:17:19 2015 (r284216) @@ -88,7 +88,7 @@ struct nfsexstuff { bcmp((f1)-fh_fid, (f2)-fh_fid, sizeof(struct fid)) == 0) #defineNFSLOCKHASH(f) \ - (nfslockhash[nfsrv_hashfh(f) % NFSLOCKHASHSIZE]) + (nfslockhash[nfsrv_hashfh(f) % nfsrv_lockhashsize]) #defineNFSFPVNODE(f) ((struct vnode *)((f)-f_data)) #defineNFSFPCRED(f)((f)-f_cred) Modified: stable/10/sys/fs/nfs/nfsrvstate.h == --- stable/10/sys/fs/nfs/nfsrvstate.h Wed Jun 10 10:48:12 2015 (r284215) +++ stable/10/sys/fs/nfs/nfsrvstate.h Wed Jun 10 12:17:19 2015 (r284216) @@ -52,9 +52,9 @@ LIST_HEAD(nfsuserhashhead, nfsusrgrp); TAILQ_HEAD(nfsuserlruhead, nfsusrgrp); #defineNFSCLIENTHASH(id) \ - (nfsclienthash[(id).lval[1] % NFSCLIENTHASHSIZE]) + (nfsclienthash[(id).lval[1] % nfsrv_clienthashsize]) #defineNFSSTATEHASH(clp, id) \ - (((clp)-lc_stateid[(id).other[2] % NFSSTATEHASHSIZE])) + (((clp)-lc_stateid[(id).other[2] % nfsrv_statehashsize])) #defineNFSUSERHASH(id) \ (nfsuserhash[(id) % NFSUSERHASHSIZE]) #defineNFSUSERNAMEHASH(p, l) \ @@ -71,7 +71,7 @@ struct nfssessionhash { struct nfssessionhashhead list; }; #defineNFSSESSIONHASH(f) \ - (nfssessionhash[nfsrv_hashsessionid(f) % NFSSESSIONHASHSIZE]) + (nfssessionhash[nfsrv_hashsessionid(f) % nfsrv_sessionhashsize]) /* * Client server structure for V4. It is doubly linked into two lists. @@ -81,7 +81,7 @@ struct nfssessionhash { */ struct nfsclient { LIST_ENTRY(nfsclient) lc_hash; /* Clientid hash list */ - struct nfsstatehead lc_stateid[NFSSTATEHASHSIZE]; /* stateid hash */ + struct nfsstatehead *lc_stateid;/* Stateid hash */ struct nfsstatehead lc_open;/* Open owner list */ struct nfsstatehead lc_deleg; /* Delegations */ struct nfsstatehead lc_olddeleg;/* and old delegations */ @@ -97,10 +97,10 @@ struct nfsclient { u_int32_t lc_cbref; /* Cnt of callbacks */ uid_t lc_uid; /* User credential */ gid_t lc_gid; - u_int16_t lc_namelen; + u_int16_t lc_idlen; /* Client ID and len */ + u_int16_t lc_namelen; /* plus GSS principal and len */ u_char *lc_name; struct nfssockreq lc_req; /* Callback info */ - u_short lc_idlen; /* Length of id string */
svn commit: r284101 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Sat Jun 6 20:54:41 2015 New Revision: 284101 URL: https://svnweb.freebsd.org/changeset/base/284101 Log: MFC: r283330 The NFS client generated directory block(s) with d_fileno == 0 so that it would not return less data than requested. Since returning less directory data than requested is not a problem for FreeBSD and even UFS no longer returns directory structures with d_fileno == 0, this patch stops the client from doing this. Although entries with d_fileno == 0 should not be a problem, the man pages no longer document that these entries should be ignored, so there was a concern that these entries might be an issue in the future. Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sat Jun 6 20:37:40 2015 (r284100) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sat Jun 6 20:54:41 2015 (r284101) @@ -3070,25 +3070,6 @@ nfsrpc_readdir(vnode_t vp, struct uio *u *eofp = eof; } - /* -* Add extra empty records to any remaining DIRBLKSIZ chunks. -*/ - while (uio_uio_resid(uiop) 0 ((size_t)(uio_uio_resid(uiop))) != tresid) { - dp = (struct dirent *) CAST_DOWN(caddr_t, uio_iov_base(uiop)); - dp-d_type = DT_UNKNOWN; - dp-d_fileno = 0; - dp-d_namlen = 0; - dp-d_name[0] = '\0'; - tl = (u_int32_t *)dp-d_name[4]; - *tl++ = cookie.lval[0]; - *tl = cookie.lval[1]; - dp-d_reclen = DIRBLKSIZ; - uio_iov_base_add(uiop, DIRBLKSIZ); - uio_iov_len_add(uiop, -(DIRBLKSIZ)); - uio_uio_resid_add(uiop, -(DIRBLKSIZ)); - uiop-uio_offset += DIRBLKSIZ; - } - nfsmout: if (nd-nd_mrep != NULL) mbuf_freem(nd-nd_mrep); @@ -3563,25 +3544,6 @@ nfsrpc_readdirplus(vnode_t vp, struct ui *eofp = eof; } - /* -* Add extra empty records to any remaining DIRBLKSIZ chunks. -*/ - while (uio_uio_resid(uiop) 0 uio_uio_resid(uiop) != tresid) { - dp = (struct dirent *)uio_iov_base(uiop); - dp-d_type = DT_UNKNOWN; - dp-d_fileno = 0; - dp-d_namlen = 0; - dp-d_name[0] = '\0'; - tl = (u_int32_t *)dp-d_name[4]; - *tl++ = cookie.lval[0]; - *tl = cookie.lval[1]; - dp-d_reclen = DIRBLKSIZ; - uio_iov_base_add(uiop, DIRBLKSIZ); - uio_iov_len_add(uiop, -(DIRBLKSIZ)); - uio_uio_resid_add(uiop, -(DIRBLKSIZ)); - uiop-uio_offset += DIRBLKSIZ; - } - nfsmout: if (nd-nd_mrep != NULL) mbuf_freem(nd-nd_mrep); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r283987 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Thu Jun 4 12:35:00 2015 New Revision: 283987 URL: https://svnweb.freebsd.org/changeset/base/283987 Log: MFC: r283273 The NFS client wasn't handling getdirentries(2) requests for sizes that are not an exact multiple of DIRBLKSIZ correctly. Fortunately readdir(3) always uses an exact multiple of DIRBLKSIZ, so few applications were affected. This patch fixes this problem by reducing the size of the directory read to an exact multiple of DIRBLKSIZ. Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c == --- stable/10/sys/fs/nfsclient/nfs_clvnops.cThu Jun 4 10:55:36 2015 (r283986) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.cThu Jun 4 12:35:00 2015 (r283987) @@ -2211,7 +2211,7 @@ nfs_readdir(struct vop_readdir_args *ap) struct vnode *vp = ap-a_vp; struct nfsnode *np = VTONFS(vp); struct uio *uio = ap-a_uio; - ssize_t tresid; + ssize_t tresid, left; int error = 0; struct vattr vattr; @@ -2240,6 +2240,17 @@ nfs_readdir(struct vop_readdir_args *ap) } /* +* NFS always guarantees that directory entries don't straddle +* DIRBLKSIZ boundaries. As such, we need to limit the size +* to an exact multiple of DIRBLKSIZ, to avoid copying a partial +* directory entry. +*/ + left = uio-uio_resid % DIRBLKSIZ; + if (left == uio-uio_resid) + return (EINVAL); + uio-uio_resid -= left; + + /* * Call ncl_bioread() to do the real work. */ tresid = uio-uio_resid; @@ -2250,6 +2261,9 @@ nfs_readdir(struct vop_readdir_args *ap) if (ap-a_eofflag != NULL) *ap-a_eofflag = 1; } + + /* Add the partial DIRBLKSIZ (left) back in. */ + uio-uio_resid += left; return (error); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r283762 - stable/10/usr.sbin/mountd
Author: rmacklem Date: Sat May 30 01:04:45 2015 New Revision: 283762 URL: https://svnweb.freebsd.org/changeset/base/283762 Log: MFC: r283008 Add a warning message to mountd for exported file systems that are automounted, since that configuration isn't supported. This still allows the export, since two emails I received felt that this should not be disabled. It sends the message to syslog(LOG_ERR..), so that it goes to the same places as the other messages related to /etc/exports problems, even though it is a warning and not an error. Modified: stable/10/usr.sbin/mountd/mountd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mountd/mountd.c == --- stable/10/usr.sbin/mountd/mountd.c Fri May 29 23:37:27 2015 (r283761) +++ stable/10/usr.sbin/mountd/mountd.c Sat May 30 01:04:45 2015 (r283762) @@ -1424,6 +1424,9 @@ get_exportlist_one(void) } if (check_dirpath(cp) statfs(cp, fsb) = 0) { + if ((fsb.f_flags MNT_AUTOMOUNTED) != 0) + syslog(LOG_ERR, Warning: exporting of + automounted fs %s not supported, cp); if (got_nondir) { syslog(LOG_ERR, dirs must be first); getexp_err(ep, tgrp); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r283753 - head/sys/fs/nfsserver
Author: rmacklem Date: Fri May 29 20:22:53 2015 New Revision: 283753 URL: https://svnweb.freebsd.org/changeset/base/283753 Log: Make the NFS server use shared vnode locks for a few cases that are allowed by the VFS/VOP interface instead of using exclusive locks. MFC after:2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c == --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Fri May 29 20:00:02 2015 (r283752) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Fri May 29 20:22:53 2015 (r283753) @@ -440,9 +440,12 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, if (nd-nd_procnum == NFSPROC_READ || nd-nd_procnum == NFSPROC_WRITE || nd-nd_procnum == NFSPROC_READDIR || + nd-nd_procnum == NFSPROC_READDIRPLUS || nd-nd_procnum == NFSPROC_READLINK || nd-nd_procnum == NFSPROC_GETATTR || - nd-nd_procnum == NFSPROC_ACCESS) + nd-nd_procnum == NFSPROC_ACCESS || + nd-nd_procnum == NFSPROC_FSSTAT || + nd-nd_procnum == NFSPROC_FSINFO) lktype = LK_SHARED; else lktype = LK_EXCLUSIVE; @@ -544,7 +547,7 @@ static void nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen, u_int32_t minorvers, NFSPROC_T *p) { - int i, op, op0 = 0; + int i, lktype, op, op0 = 0; u_int32_t *tl; struct nfsclient *clp, *nclp; int numops, error = 0, igotlock; @@ -953,11 +956,15 @@ nfsrvd_compound(struct nfsrv_descript *n panic(nfsrvd_compound); if (nfsv4_opflag[op].needscfh) { if (vp != NULL) { - if (nfsv4_opflag[op].modifyfs) + lktype = nfsv4_opflag[op].lktype; + if (nfsv4_opflag[op].modifyfs) { vn_start_write(vp, temp_mp, V_WAIT); - if (NFSVOPLOCK(vp, nfsv4_opflag[op].lktype) - == 0) + if (op == NFSV4OP_WRITE + MNT_SHARED_WRITES(temp_mp)) + lktype = LK_SHARED; + } + if (NFSVOPLOCK(vp, lktype) == 0) VREF(vp); else nd-nd_repstat = NFSERR_PERM; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r283635 - in head/sys/fs: nfs nfsserver
Author: rmacklem Date: Wed May 27 22:00:05 2015 New Revision: 283635 URL: https://svnweb.freebsd.org/changeset/base/283635 Log: Make the size of the hash tables used by the NFSv4 server tunable. No appreciable change in performance was observed after increasing the sizes of these tables and then testing with a single client. However, there was an email that indicated high CPU overheads for a heavily loaded NFSv4 and it is hoped that increasing the sizes of the hash tables via these tunables might help. The tables remain the same size by default. Differential Revision:https://reviews.freebsd.org/D2596 MFC after:2 weeks Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfsdport.h head/sys/fs/nfs/nfsrvstate.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: head/sys/fs/nfs/nfs.h == --- head/sys/fs/nfs/nfs.h Wed May 27 20:58:54 2015(r283634) +++ head/sys/fs/nfs/nfs.h Wed May 27 22:00:05 2015(r283635) @@ -138,11 +138,11 @@ /* * This macro defines the high water mark for issuing V4 delegations. - * (It is currently set at a conservative 20% of NFSRV_V4STATELIMIT. This + * (It is currently set at a conservative 20% of nfsrv_v4statelimit. This * may want to increase when clients can make more effective use of * delegations.) */ -#defineNFSRV_V4DELEGLIMIT(c) (((c) * 5) NFSRV_V4STATELIMIT) +#defineNFSRV_V4DELEGLIMIT(c) (((c) * 5) nfsrv_v4statelimit) #defineNFS_READDIRBLKSIZ DIRBLKSIZ /* Minimal nm_readdirsize */ Modified: head/sys/fs/nfs/nfsdport.h == --- head/sys/fs/nfs/nfsdport.h Wed May 27 20:58:54 2015(r283634) +++ head/sys/fs/nfs/nfsdport.h Wed May 27 22:00:05 2015(r283635) @@ -88,7 +88,7 @@ struct nfsexstuff { bcmp((f1)-fh_fid, (f2)-fh_fid, sizeof(struct fid)) == 0) #defineNFSLOCKHASH(f) \ - (nfslockhash[nfsrv_hashfh(f) % NFSLOCKHASHSIZE]) + (nfslockhash[nfsrv_hashfh(f) % nfsrv_lockhashsize]) #defineNFSFPVNODE(f) ((struct vnode *)((f)-f_data)) #defineNFSFPCRED(f)((f)-f_cred) Modified: head/sys/fs/nfs/nfsrvstate.h == --- head/sys/fs/nfs/nfsrvstate.hWed May 27 20:58:54 2015 (r283634) +++ head/sys/fs/nfs/nfsrvstate.hWed May 27 22:00:05 2015 (r283635) @@ -52,9 +52,9 @@ LIST_HEAD(nfsuserhashhead, nfsusrgrp); TAILQ_HEAD(nfsuserlruhead, nfsusrgrp); #defineNFSCLIENTHASH(id) \ - (nfsclienthash[(id).lval[1] % NFSCLIENTHASHSIZE]) + (nfsclienthash[(id).lval[1] % nfsrv_clienthashsize]) #defineNFSSTATEHASH(clp, id) \ - (((clp)-lc_stateid[(id).other[2] % NFSSTATEHASHSIZE])) + (((clp)-lc_stateid[(id).other[2] % nfsrv_statehashsize])) #defineNFSUSERHASH(id) \ (nfsuserhash[(id) % NFSUSERHASHSIZE]) #defineNFSUSERNAMEHASH(p, l) \ @@ -71,7 +71,7 @@ struct nfssessionhash { struct nfssessionhashhead list; }; #defineNFSSESSIONHASH(f) \ - (nfssessionhash[nfsrv_hashsessionid(f) % NFSSESSIONHASHSIZE]) + (nfssessionhash[nfsrv_hashsessionid(f) % nfsrv_sessionhashsize]) /* * Client server structure for V4. It is doubly linked into two lists. @@ -81,7 +81,7 @@ struct nfssessionhash { */ struct nfsclient { LIST_ENTRY(nfsclient) lc_hash; /* Clientid hash list */ - struct nfsstatehead lc_stateid[NFSSTATEHASHSIZE]; /* stateid hash */ + struct nfsstatehead *lc_stateid;/* Stateid hash */ struct nfsstatehead lc_open;/* Open owner list */ struct nfsstatehead lc_deleg; /* Delegations */ struct nfsstatehead lc_olddeleg;/* and old delegations */ @@ -97,10 +97,10 @@ struct nfsclient { u_int32_t lc_cbref; /* Cnt of callbacks */ uid_t lc_uid; /* User credential */ gid_t lc_gid; - u_int16_t lc_namelen; + u_int16_t lc_idlen; /* Client ID and len */ + u_int16_t lc_namelen; /* plus GSS principal and len */ u_char *lc_name; struct nfssockreq lc_req; /* Callback info */ - u_short lc_idlen; /* Length of id string */ u_int32_t lc_flags; /* LCL_
svn commit: r283330 - head/sys/fs/nfsclient
Author: rmacklem Date: Sat May 23 21:58:41 2015 New Revision: 283330 URL: https://svnweb.freebsd.org/changeset/base/283330 Log: The NFS client generated directory block(s) with d_fileno == 0 so that it would not return less data than requested. Since returning less directory data than requested is not a problem for FreeBSD and even UFS no longer returns directory structures with d_fileno == 0, this patch stops the client from doing this. Although entries with d_fileno == 0 should not be a problem, the man pages no longer document that these entries should be ignored, so there was a concern that these entries might be an issue in the future. Suggested by: trasz Tested by:trasz MFC after:2 weeks Modified: head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfsclient/nfs_clrpcops.c == --- head/sys/fs/nfsclient/nfs_clrpcops.cSat May 23 21:12:51 2015 (r283329) +++ head/sys/fs/nfsclient/nfs_clrpcops.cSat May 23 21:58:41 2015 (r283330) @@ -3072,25 +3072,6 @@ nfsrpc_readdir(vnode_t vp, struct uio *u *eofp = eof; } - /* -* Add extra empty records to any remaining DIRBLKSIZ chunks. -*/ - while (uio_uio_resid(uiop) 0 ((size_t)(uio_uio_resid(uiop))) != tresid) { - dp = (struct dirent *) CAST_DOWN(caddr_t, uio_iov_base(uiop)); - dp-d_type = DT_UNKNOWN; - dp-d_fileno = 0; - dp-d_namlen = 0; - dp-d_name[0] = '\0'; - tl = (u_int32_t *)dp-d_name[4]; - *tl++ = cookie.lval[0]; - *tl = cookie.lval[1]; - dp-d_reclen = DIRBLKSIZ; - uio_iov_base_add(uiop, DIRBLKSIZ); - uio_iov_len_add(uiop, -(DIRBLKSIZ)); - uio_uio_resid_add(uiop, -(DIRBLKSIZ)); - uiop-uio_offset += DIRBLKSIZ; - } - nfsmout: if (nd-nd_mrep != NULL) mbuf_freem(nd-nd_mrep); @@ -3565,25 +3546,6 @@ nfsrpc_readdirplus(vnode_t vp, struct ui *eofp = eof; } - /* -* Add extra empty records to any remaining DIRBLKSIZ chunks. -*/ - while (uio_uio_resid(uiop) 0 uio_uio_resid(uiop) != tresid) { - dp = (struct dirent *)uio_iov_base(uiop); - dp-d_type = DT_UNKNOWN; - dp-d_fileno = 0; - dp-d_namlen = 0; - dp-d_name[0] = '\0'; - tl = (u_int32_t *)dp-d_name[4]; - *tl++ = cookie.lval[0]; - *tl = cookie.lval[1]; - dp-d_reclen = DIRBLKSIZ; - uio_iov_base_add(uiop, DIRBLKSIZ); - uio_iov_len_add(uiop, -(DIRBLKSIZ)); - uio_uio_resid_add(uiop, -(DIRBLKSIZ)); - uiop-uio_offset += DIRBLKSIZ; - } - nfsmout: if (nd-nd_mrep != NULL) mbuf_freem(nd-nd_mrep); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r283273 - head/sys/fs/nfsclient
Author: rmacklem Date: Thu May 21 23:14:18 2015 New Revision: 283273 URL: https://svnweb.freebsd.org/changeset/base/283273 Log: The NFS client wasn't handling getdirentries(2) requests for sizes that are not an exact multiple of DIRBLKSIZ correctly. Fortunately readdir(3) always uses an exact multiple of DIRBLKSIZ, so few applications were affected. This patch fixes this problem by reducing the size of the directory read to an exact multiple of DIRBLKSIZ. Tested by:trasz Reported by: trasz Reviewed by: trasz MFC after:2 weeks Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c == --- head/sys/fs/nfsclient/nfs_clvnops.c Thu May 21 22:50:39 2015 (r283272) +++ head/sys/fs/nfsclient/nfs_clvnops.c Thu May 21 23:14:18 2015 (r283273) @@ -2210,7 +2210,7 @@ nfs_readdir(struct vop_readdir_args *ap) struct vnode *vp = ap-a_vp; struct nfsnode *np = VTONFS(vp); struct uio *uio = ap-a_uio; - ssize_t tresid; + ssize_t tresid, left; int error = 0; struct vattr vattr; @@ -2239,6 +2239,17 @@ nfs_readdir(struct vop_readdir_args *ap) } /* +* NFS always guarantees that directory entries don't straddle +* DIRBLKSIZ boundaries. As such, we need to limit the size +* to an exact multiple of DIRBLKSIZ, to avoid copying a partial +* directory entry. +*/ + left = uio-uio_resid % DIRBLKSIZ; + if (left == uio-uio_resid) + return (EINVAL); + uio-uio_resid -= left; + + /* * Call ncl_bioread() to do the real work. */ tresid = uio-uio_resid; @@ -2249,6 +2260,9 @@ nfs_readdir(struct vop_readdir_args *ap) if (ap-a_eofflag != NULL) *ap-a_eofflag = 1; } + + /* Add the partial DIRBLKSIZ (left) back in. */ + uio-uio_resid += left; return (error); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r283008 - head/usr.sbin/mountd
Author: rmacklem Date: Sat May 16 12:05:26 2015 New Revision: 283008 URL: https://svnweb.freebsd.org/changeset/base/283008 Log: Add a warning message to mountd for exported file systems that are automounted, since that configuration isn't supported. This still allows the export, since two emails I received felt that this should not be disabled. It sends the message to syslog(LOG_ERR..), so that it goes to the same places as the other messages related to /etc/exports problems, even though it is a warning and not an error. Reviewed by: trasz MFC after:2 weeks Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c == --- head/usr.sbin/mountd/mountd.c Sat May 16 10:35:30 2015 (r283007) +++ head/usr.sbin/mountd/mountd.c Sat May 16 12:05:26 2015 (r283008) @@ -1410,6 +1410,9 @@ get_exportlist_one(void) } if (check_dirpath(cp) statfs(cp, fsb) = 0) { + if ((fsb.f_flags MNT_AUTOMOUNTED) != 0) + syslog(LOG_ERR, Warning: exporting of + automounted fs %s not supported, cp); if (got_nondir) { syslog(LOG_ERR, dirs must be first); getexp_err(ep, tgrp); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r282933 - in stable/10/sys: fs/nfs fs/nfsclient kern sys
Author: rmacklem Date: Thu May 14 22:50:07 2015 New Revision: 282933 URL: https://svnweb.freebsd.org/changeset/base/282933 Log: MFC: r281960 MAXBSIZE defines both the largest UFS block size and the largest size for a buffer in the buffer cache. This patch defines a new constant MAXBCACHEBUF, which is the largest size for a buffer in the buffer cache. Having a separate constant allows MAXBCACHEBUF to be set larger than MAXBSIZE on a per-architecture basis, so that NFS can do larger read/writes for these architectures. It modifies sys/param.h so that BKVASIZE can also be set on a per-architecture basis. A couple of cases where NFS used MAXBSIZE instead of NFS_MAXBSIZE is fixed as well. Modified: stable/10/sys/fs/nfs/nfsport.h stable/10/sys/fs/nfsclient/nfs_clvfsops.c stable/10/sys/kern/vfs_bio.c stable/10/sys/sys/param.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfsport.h == --- stable/10/sys/fs/nfs/nfsport.h Thu May 14 22:35:26 2015 (r282932) +++ stable/10/sys/fs/nfs/nfsport.h Thu May 14 22:50:07 2015 (r282933) @@ -967,7 +967,7 @@ struct nfsreq { }; #ifndef NFS_MAXBSIZE -#defineNFS_MAXBSIZEMAXBSIZE +#defineNFS_MAXBSIZEMAXBCACHEBUF #endif /* Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c == --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu May 14 22:35:26 2015 (r282932) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu May 14 22:50:07 2015 (r282933) @@ -196,16 +196,16 @@ newnfs_iosize(struct nfsmount *nmp) } if (nmp-nm_rsize maxio || nmp-nm_rsize == 0) nmp-nm_rsize = maxio; - if (nmp-nm_rsize MAXBSIZE) - nmp-nm_rsize = MAXBSIZE; + if (nmp-nm_rsize NFS_MAXBSIZE) + nmp-nm_rsize = NFS_MAXBSIZE; if (nmp-nm_readdirsize maxio || nmp-nm_readdirsize == 0) nmp-nm_readdirsize = maxio; if (nmp-nm_readdirsize nmp-nm_rsize) nmp-nm_readdirsize = nmp-nm_rsize; if (nmp-nm_wsize maxio || nmp-nm_wsize == 0) nmp-nm_wsize = maxio; - if (nmp-nm_wsize MAXBSIZE) - nmp-nm_wsize = MAXBSIZE; + if (nmp-nm_wsize NFS_MAXBSIZE) + nmp-nm_wsize = NFS_MAXBSIZE; /* * Calculate the size used for io buffers. Use the larger Modified: stable/10/sys/kern/vfs_bio.c == --- stable/10/sys/kern/vfs_bio.cThu May 14 22:35:26 2015 (r282932) +++ stable/10/sys/kern/vfs_bio.cThu May 14 22:50:07 2015 (r282933) @@ -774,6 +774,7 @@ bufinit(void) struct buf *bp; int i; + CTASSERT(MAXBCACHEBUF = MAXBSIZE); mtx_init(bqclean, bufq clean lock, NULL, MTX_DEF); mtx_init(bqdirty, bufq dirty lock, NULL, MTX_DEF); mtx_init(rbreqlock, runningbufspace lock, NULL, MTX_DEF); @@ -815,8 +816,8 @@ bufinit(void) * by the system. */ maxbufspace = (long)nbuf * BKVASIZE; - hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10); - lobufspace = hibufspace - MAXBSIZE; + hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBCACHEBUF * 10); + lobufspace = hibufspace - MAXBCACHEBUF; /* * Note: The 16 MiB upper limit for hirunningspace was chosen @@ -826,9 +827,9 @@ bufinit(void) * The lower 1 MiB limit is the historical upper limit for * hirunningspace. */ - hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBSIZE), + hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBCACHEBUF), 16 * 1024 * 1024), 1024 * 1024); - lorunningspace = roundup((hirunningspace * 2) / 3, MAXBSIZE); + lorunningspace = roundup((hirunningspace * 2) / 3, MAXBCACHEBUF); /* * Limit the amount of malloc memory since it is wired permanently into @@ -3076,8 +3077,9 @@ getblk(struct vnode *vp, daddr_t blkno, KASSERT((flags (GB_UNMAPPED | GB_KVAALLOC)) != GB_KVAALLOC, (GB_KVAALLOC only makes sense with GB_UNMAPPED)); ASSERT_VOP_LOCKED(vp, getblk); - if (size MAXBSIZE) - panic(getblk: size(%d) MAXBSIZE(%d)\n, size, MAXBSIZE); + if (size MAXBCACHEBUF) + panic(getblk: size(%d) MAXBCACHEBUF(%d)\n, size, + MAXBCACHEBUF); if (!unmapped_buf_allowed) flags = ~(GB_UNMAPPED | GB_KVAALLOC); Modified: stable/10/sys/sys/param.h == --- stable/10/sys/sys/param.h Thu May 14 22:35:26 2015(r282932) +++ stable/10/sys/sys/param.h Thu May 14 22:50:07 2015(r282933) @@ -232,10 +232,19 @@ * and
svn commit: r282677 - in stable/9/sys/fs: nfs nfsserver
Author: rmacklem Date: Sat May 9 12:10:59 2015 New Revision: 282677 URL: https://svnweb.freebsd.org/changeset/base/282677 Log: MFC: r281628 mav@ has found that NFS servers exporting ZFS file systems can perform better when using a 128K read/write data size. This patch changes NFS_MAXDATA from 64K to 128K so that clients can use 128K for NFS mounts to allow this. The patch also renames NFS_MAXDATA to NFS_SRVMAXIO so that it is clear that it applies to the NFS server side only. It also avoids a name conflict with the NFS_MAXDATA defined in rpcsvc/nfs_prot.h, that is used for userland RPC. Modified: stable/9/sys/fs/nfs/nfs.h stable/9/sys/fs/nfs/nfs_commonport.c stable/9/sys/fs/nfs/nfsproto.h stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfs.h == --- stable/9/sys/fs/nfs/nfs.h Sat May 9 09:21:59 2015(r282676) +++ stable/9/sys/fs/nfs/nfs.h Sat May 9 12:10:59 2015(r282677) @@ -151,7 +151,7 @@ (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0) #defineNFS_SRVMAXDATA(n) \ (((n)-nd_flag (ND_NFSV3 | ND_NFSV4)) ? \ -NFS_MAXDATA : NFS_V2MAXDATA) +NFS_SRVMAXIO : NFS_V2MAXDATA) #defineNFS64BITSSET0xull #defineNFS64BITSMINUS1 0xfffeull Modified: stable/9/sys/fs/nfs/nfs_commonport.c == --- stable/9/sys/fs/nfs/nfs_commonport.cSat May 9 09:21:59 2015 (r282676) +++ stable/9/sys/fs/nfs/nfs_commonport.cSat May 9 12:10:59 2015 (r282677) @@ -274,11 +274,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int if (isdgram) pref = NFS_MAXDGRAMDATA; else - pref = NFS_MAXDATA; - sip-fs_rtmax = NFS_MAXDATA; + pref = NFS_SRVMAXIO; + sip-fs_rtmax = NFS_SRVMAXIO; sip-fs_rtpref = pref; sip-fs_rtmult = NFS_FABLKSIZE; - sip-fs_wtmax = NFS_MAXDATA; + sip-fs_wtmax = NFS_SRVMAXIO; sip-fs_wtpref = pref; sip-fs_wtmult = NFS_FABLKSIZE; sip-fs_dtpref = pref; Modified: stable/9/sys/fs/nfs/nfsproto.h == --- stable/9/sys/fs/nfs/nfsproto.h Sat May 9 09:21:59 2015 (r282676) +++ stable/9/sys/fs/nfs/nfsproto.h Sat May 9 12:10:59 2015 (r282677) @@ -54,17 +54,28 @@ #defineNFS_VER44 #defineNFS_V2MAXDATA 8192 #defineNFS_MAXDGRAMDATA 16384 -#defineNFS_MAXDATA NFS_MAXBSIZE #defineNFS_MAXPATHLEN 1024 #defineNFS_MAXNAMLEN 255 #defineNFS_MAXPKTHDR 404 -#defineNFS_MAXPACKET (NFS_MAXDATA + 2048) +#defineNFS_MAXPACKET (NFS_SRVMAXIO + 2048) #defineNFS_MINPACKET 20 #defineNFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #defineNFSV4_MINORVERSION 0 /* V4 Minor version */ #defineNFSV4_CBVERS1 /* V4 CB Version */ #defineNFSV4_SMALLSTR 50 /* Strings small enough for stack */ +/* + * This value isn't a fixed value in the RFCs. + * It is the maximum data size supported by NFSv3 or NFSv4 over TCP for + * the server. It should be set to the I/O size preferred by ZFS or + * MAXBSIZE, whichever is greater. + * ZFS currently prefers 128K. + * It used to be called NFS_MAXDATA, but has been renamed to clarify that + * it refers to server side only and doesn't conflict with the NFS_MAXDATA + * defined in rpcsvc/nfs_prot.h for userland. + */ +#defineNFS_SRVMAXIO(128 * 1024) + /* Stat numbers for rpc returns (version 2, 3 and 4) */ /* * These numbers are hard-wired in the RFCs, so they can't be changed. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdserv.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdserv.cSat May 9 09:21:59 2015 (r282676) +++ stable/9/sys/fs/nfsserver/nfs_nfsdserv.cSat May 9 12:10:59 2015 (r282677) @@ -862,7 +862,7 @@ nfsrvd_write(struct nfsrv_descript *nd, i = mbuf_len(mp); } - if (retlen NFS_MAXDATA || retlen 0) + if (retlen NFS_SRVMAXIO || retlen 0) nd-nd_repstat = EIO; if (vnode_vtype(vp) != VREG !nd-nd_repstat) { if (nd-nd_flag ND_NFSV3) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r282343 - stable/9/sys/fs/nfsserver
Author: rmacklem Date: Sat May 2 12:58:04 2015 New Revision: 282343 URL: https://svnweb.freebsd.org/changeset/base/282343 Log: MFC: r281962 Fix the NFS server's handling of a bogus NFSv2 ROOT RPC. The ROOT RPC is deprecated in the NFSv2 RFC, RFC-1094 and should never be used by a client. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.cSat May 2 12:22:24 2015 (r282342) +++ stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.cSat May 2 12:58:04 2015 (r282343) @@ -120,7 +120,8 @@ nfssvc_program(struct svc_req *rqst, SVC memset(nd, 0, sizeof(nd)); if (rqst-rq_vers == NFS_VER2) { - if (rqst-rq_proc NFSV2PROC_STATFS) { + if (rqst-rq_proc NFSV2PROC_STATFS || + newnfs_nfsv3_procid[rqst-rq_proc] == NFSPROC_NOOP) { svcerr_noproc(rqst); svc_freereq(rqst); goto out; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r282340 - stable/10/sys/fs/nfsserver
Author: rmacklem Date: Sat May 2 12:18:28 2015 New Revision: 282340 URL: https://svnweb.freebsd.org/changeset/base/282340 Log: MFC: r281962 Fix the NFS server's handling of a bogus NFSv2 ROOT RPC. The ROOT RPC is deprecated in the NFSv2 RFC, RFC-1094 and should never be used by a client. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c Sat May 2 12:08:28 2015 (r282339) +++ stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c Sat May 2 12:18:28 2015 (r282340) @@ -120,7 +120,8 @@ nfssvc_program(struct svc_req *rqst, SVC memset(nd, 0, sizeof(nd)); if (rqst-rq_vers == NFS_VER2) { - if (rqst-rq_proc NFSV2PROC_STATFS) { + if (rqst-rq_proc NFSV2PROC_STATFS || + newnfs_nfsv3_procid[rqst-rq_proc] == NFSPROC_NOOP) { svcerr_noproc(rqst); svc_freereq(rqst); goto out; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r282270 - in stable/10/sys: fs/ext2fs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/nfsserver fs/nullfs kern sys ufs/ffs
Author: rmacklem Date: Thu Apr 30 12:39:24 2015 New Revision: 282270 URL: https://svnweb.freebsd.org/changeset/base/282270 Log: MFC: r281562 File systems that do not use the buffer cache (such as ZFS) must use VOP_FSYNC() to perform the NFS server's Commit operation. This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which is set by file systems that use the buffer cache. If this flag is not set, the NFS server always does a VOP_FSYNC(). This should be ok for old file system modules that do not set MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although it might not be optimal for file systems that use the buffer cache. Modified: stable/10/sys/fs/ext2fs/ext2_vfsops.c stable/10/sys/fs/fuse/fuse_vfsops.c stable/10/sys/fs/msdosfs/msdosfs_vfsops.c stable/10/sys/fs/nandfs/nandfs_vfsops.c stable/10/sys/fs/nfsclient/nfs_clvfsops.c stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/fs/nullfs/null_vfsops.c stable/10/sys/kern/vfs_subr.c stable/10/sys/sys/mount.h stable/10/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2_vfsops.c == --- stable/10/sys/fs/ext2fs/ext2_vfsops.c Thu Apr 30 07:00:25 2015 (r282269) +++ stable/10/sys/fs/ext2fs/ext2_vfsops.c Thu Apr 30 12:39:24 2015 (r282270) @@ -661,7 +661,8 @@ ext2_mountfs(struct vnode *devvp, struct * Initialize filesystem stat information in mount struct. */ MNT_ILOCK(mp); - mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; + mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | + MNTK_USES_BCACHE; MNT_IUNLOCK(mp); return (0); out: Modified: stable/10/sys/fs/fuse/fuse_vfsops.c == --- stable/10/sys/fs/fuse/fuse_vfsops.c Thu Apr 30 07:00:25 2015 (r282269) +++ stable/10/sys/fs/fuse/fuse_vfsops.c Thu Apr 30 12:39:24 2015 (r282270) @@ -337,6 +337,7 @@ fuse_vfsop_mount(struct mount *mp) MNT_ILOCK(mp); mp-mnt_data = data; mp-mnt_flag |= MNT_LOCAL; + mp-mnt_kern_flag |= MNTK_USES_BCACHE; MNT_IUNLOCK(mp); /* We need this here as this slot is used by getnewvnode() */ mp-mnt_stat.f_iosize = PAGE_SIZE; Modified: stable/10/sys/fs/msdosfs/msdosfs_vfsops.c == --- stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Thu Apr 30 07:00:25 2015 (r282269) +++ stable/10/sys/fs/msdosfs/msdosfs_vfsops.c Thu Apr 30 12:39:24 2015 (r282270) @@ -759,6 +759,7 @@ mountmsdosfs(struct vnode *devvp, struct mp-mnt_stat.f_fsid.val[1] = mp-mnt_vfc-vfc_typenum; MNT_ILOCK(mp); mp-mnt_flag |= MNT_LOCAL; + mp-mnt_kern_flag |= MNTK_USES_BCACHE; MNT_IUNLOCK(mp); if (pmp-pm_flags MSDOSFS_LARGEFS) Modified: stable/10/sys/fs/nandfs/nandfs_vfsops.c == --- stable/10/sys/fs/nandfs/nandfs_vfsops.c Thu Apr 30 07:00:25 2015 (r282269) +++ stable/10/sys/fs/nandfs/nandfs_vfsops.c Thu Apr 30 12:39:24 2015 (r282270) @@ -1385,6 +1385,7 @@ nandfs_mountfs(struct vnode *devvp, stru nmp-nm_ronly = ronly; MNT_ILOCK(mp); mp-mnt_flag |= MNT_LOCAL; + mp-mnt_kern_flag |= MNTK_USES_BCACHE; MNT_IUNLOCK(mp); nmp-nm_nandfsdev = nandfsdev; /* Add our mountpoint */ Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c == --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 30 07:00:25 2015 (r282269) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 30 12:39:24 2015 (r282270) @@ -1193,7 +1193,8 @@ nfs_mount(struct mount *mp) out: if (!error) { MNT_ILOCK(mp); - mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF; + mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF | + MNTK_USES_BCACHE; MNT_IUNLOCK(mp); } return (error); Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu Apr 30 07:00:25 2015 (r282269) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu Apr 30 12:39:24 2015 (r282270) @@ -1270,8 +1270,11 @@ nfsvno_fsync(struct vnode *vp, u_int64_t * file is done. At this time VOP_FSYNC does not accept offset and * byte count parameters so call VOP_FSYNC the whole file for now. * The same is true for NFSv4: RFC 3530 Sec. 14.2.3. +* File systems that do not use the buffer cache (as indicated +* by
svn commit: r282271 - in stable/10/sys/fs: nfs nfsserver
Author: rmacklem Date: Thu Apr 30 12:44:20 2015 New Revision: 282271 URL: https://svnweb.freebsd.org/changeset/base/282271 Log: MFC: r281628 mav@ has found that NFS servers exporting ZFS file systems can perform better when using a 128K read/write data size. This patch changes NFS_MAXDATA from 64K to 128K so that clients can use 128K for NFS mounts to allow this. The patch also renames NFS_MAXDATA to NFS_SRVMAXIO so that it is clear that it applies to the NFS server side only. It also avoids a name conflict with the NFS_MAXDATA defined in rpcsvc/nfs_prot.h, that is used for userland RPC. Modified: stable/10/sys/fs/nfs/nfs.h stable/10/sys/fs/nfs/nfs_commonport.c stable/10/sys/fs/nfs/nfsproto.h stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs.h == --- stable/10/sys/fs/nfs/nfs.h Thu Apr 30 12:39:24 2015(r282270) +++ stable/10/sys/fs/nfs/nfs.h Thu Apr 30 12:44:20 2015(r282271) @@ -159,7 +159,7 @@ (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0) #defineNFS_SRVMAXDATA(n) \ (((n)-nd_flag (ND_NFSV3 | ND_NFSV4)) ? \ -NFS_MAXDATA : NFS_V2MAXDATA) +NFS_SRVMAXIO : NFS_V2MAXDATA) #defineNFS64BITSSET0xull #defineNFS64BITSMINUS1 0xfffeull Modified: stable/10/sys/fs/nfs/nfs_commonport.c == --- stable/10/sys/fs/nfs/nfs_commonport.c Thu Apr 30 12:39:24 2015 (r282270) +++ stable/10/sys/fs/nfs/nfs_commonport.c Thu Apr 30 12:44:20 2015 (r282271) @@ -281,11 +281,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int if (isdgram) pref = NFS_MAXDGRAMDATA; else - pref = NFS_MAXDATA; - sip-fs_rtmax = NFS_MAXDATA; + pref = NFS_SRVMAXIO; + sip-fs_rtmax = NFS_SRVMAXIO; sip-fs_rtpref = pref; sip-fs_rtmult = NFS_FABLKSIZE; - sip-fs_wtmax = NFS_MAXDATA; + sip-fs_wtmax = NFS_SRVMAXIO; sip-fs_wtpref = pref; sip-fs_wtmult = NFS_FABLKSIZE; sip-fs_dtpref = pref; Modified: stable/10/sys/fs/nfs/nfsproto.h == --- stable/10/sys/fs/nfs/nfsproto.h Thu Apr 30 12:39:24 2015 (r282270) +++ stable/10/sys/fs/nfs/nfsproto.h Thu Apr 30 12:44:20 2015 (r282271) @@ -54,11 +54,10 @@ #defineNFS_VER44 #defineNFS_V2MAXDATA 8192 #defineNFS_MAXDGRAMDATA 16384 -#defineNFS_MAXDATA NFS_MAXBSIZE #defineNFS_MAXPATHLEN 1024 #defineNFS_MAXNAMLEN 255 #defineNFS_MAXPKTHDR 404 -#defineNFS_MAXPACKET (NFS_MAXDATA + 2048) +#defineNFS_MAXPACKET (NFS_SRVMAXIO + 2048) #defineNFS_MINPACKET 20 #defineNFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #defineNFSV4_MINORVERSION 0 /* V4 Minor version */ @@ -67,6 +66,18 @@ #defineNFSV41_CBVERS 4 /* V4.1 CB Version */ #defineNFSV4_SMALLSTR 50 /* Strings small enough for stack */ +/* + * This value isn't a fixed value in the RFCs. + * It is the maximum data size supported by NFSv3 or NFSv4 over TCP for + * the server. It should be set to the I/O size preferred by ZFS or + * MAXBSIZE, whichever is greater. + * ZFS currently prefers 128K. + * It used to be called NFS_MAXDATA, but has been renamed to clarify that + * it refers to server side only and doesn't conflict with the NFS_MAXDATA + * defined in rpcsvc/nfs_prot.h for userland. + */ +#defineNFS_SRVMAXIO(128 * 1024) + /* Stat numbers for rpc returns (version 2, 3 and 4) */ /* * These numbers are hard-wired in the RFCs, so they can't be changed. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Thu Apr 30 12:39:24 2015 (r282270) +++ stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Thu Apr 30 12:44:20 2015 (r282271) @@ -870,7 +870,7 @@ nfsrvd_write(struct nfsrv_descript *nd, i = mbuf_len(mp); } - if (retlen NFS_MAXDATA || retlen 0) + if (retlen NFS_SRVMAXIO || retlen 0) nd-nd_repstat = EIO; if (vnode_vtype(vp) != VREG !nd-nd_repstat) { if (nd-nd_flag ND_NFSV3) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r281962 - head/sys/fs/nfsserver
Author: rmacklem Date: Sat Apr 25 00:58:24 2015 New Revision: 281962 URL: https://svnweb.freebsd.org/changeset/base/281962 Log: Fix the NFS server's handling of a bogus NFSv2 ROOT RPC. The ROOT RPC is deprecated in the NFSv2 RFC, RFC-1094 and should never be used by a client. Tested by:t...@freenet.de MFC after:1 week Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c == --- head/sys/fs/nfsserver/nfs_nfsdkrpc.cSat Apr 25 00:58:19 2015 (r281961) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.cSat Apr 25 00:58:24 2015 (r281962) @@ -117,7 +117,8 @@ nfssvc_program(struct svc_req *rqst, SVC memset(nd, 0, sizeof(nd)); if (rqst-rq_vers == NFS_VER2) { - if (rqst-rq_proc NFSV2PROC_STATFS) { + if (rqst-rq_proc NFSV2PROC_STATFS || + newnfs_nfsv3_procid[rqst-rq_proc] == NFSPROC_NOOP) { svcerr_noproc(rqst); svc_freereq(rqst); goto out; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r281960 - in head/sys: fs/nfs fs/nfsclient kern sys
Author: rmacklem Date: Sat Apr 25 00:52:01 2015 New Revision: 281960 URL: https://svnweb.freebsd.org/changeset/base/281960 Log: MAXBSIZE defines both the largest UFS block size and the largest size for a buffer in the buffer cache. This patch defines a new constant MAXBCACHEBUF, which is the largest size for a buffer in the buffer cache. Having a separate constant allows MAXBCACHEBUF to be set larger than MAXBSIZE on a per-architecture basis, so that NFS can do larger read/writes for these architectures. It modifies sys/param.h so that BKVASIZE can also be set on a per-architecture basis. A couple of cases where NFS used MAXBSIZE instead of NFS_MAXBSIZE is fixed as well. Differential Revision:https://reviews.freebsd.org/D2330 Reviewed by: mav, kib MFC after:2 weeks Modified: head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/kern/vfs_bio.c head/sys/sys/param.h Modified: head/sys/fs/nfs/nfsport.h == --- head/sys/fs/nfs/nfsport.h Sat Apr 25 00:51:44 2015(r281959) +++ head/sys/fs/nfs/nfsport.h Sat Apr 25 00:52:01 2015(r281960) @@ -950,7 +950,7 @@ struct nfsreq { }; #ifndef NFS_MAXBSIZE -#defineNFS_MAXBSIZEMAXBSIZE +#defineNFS_MAXBSIZEMAXBCACHEBUF #endif /* Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cSat Apr 25 00:51:44 2015 (r281959) +++ head/sys/fs/nfsclient/nfs_clvfsops.cSat Apr 25 00:52:01 2015 (r281960) @@ -201,16 +201,16 @@ newnfs_iosize(struct nfsmount *nmp) } if (nmp-nm_rsize maxio || nmp-nm_rsize == 0) nmp-nm_rsize = maxio; - if (nmp-nm_rsize MAXBSIZE) - nmp-nm_rsize = MAXBSIZE; + if (nmp-nm_rsize NFS_MAXBSIZE) + nmp-nm_rsize = NFS_MAXBSIZE; if (nmp-nm_readdirsize maxio || nmp-nm_readdirsize == 0) nmp-nm_readdirsize = maxio; if (nmp-nm_readdirsize nmp-nm_rsize) nmp-nm_readdirsize = nmp-nm_rsize; if (nmp-nm_wsize maxio || nmp-nm_wsize == 0) nmp-nm_wsize = maxio; - if (nmp-nm_wsize MAXBSIZE) - nmp-nm_wsize = MAXBSIZE; + if (nmp-nm_wsize NFS_MAXBSIZE) + nmp-nm_wsize = NFS_MAXBSIZE; /* * Calculate the size used for io buffers. Use the larger Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Sat Apr 25 00:51:44 2015(r281959) +++ head/sys/kern/vfs_bio.c Sat Apr 25 00:52:01 2015(r281960) @@ -805,6 +805,7 @@ bufinit(void) struct buf *bp; int i; + CTASSERT(MAXBCACHEBUF = MAXBSIZE); mtx_init(bqclean, bufq clean lock, NULL, MTX_DEF); mtx_init(bqdirty, bufq dirty lock, NULL, MTX_DEF); mtx_init(rbreqlock, runningbufspace lock, NULL, MTX_DEF); @@ -846,8 +847,8 @@ bufinit(void) * by the system. */ maxbufspace = (long)nbuf * BKVASIZE; - hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10); - lobufspace = hibufspace - MAXBSIZE; + hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBCACHEBUF * 10); + lobufspace = hibufspace - MAXBCACHEBUF; /* * Note: The 16 MiB upper limit for hirunningspace was chosen @@ -857,9 +858,9 @@ bufinit(void) * The lower 1 MiB limit is the historical upper limit for * hirunningspace. */ - hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBSIZE), + hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBCACHEBUF), 16 * 1024 * 1024), 1024 * 1024); - lorunningspace = roundup((hirunningspace * 2) / 3, MAXBSIZE); + lorunningspace = roundup((hirunningspace * 2) / 3, MAXBCACHEBUF); /* * Limit the amount of malloc memory since it is wired permanently into @@ -3073,8 +3074,9 @@ getblk(struct vnode *vp, daddr_t blkno, KASSERT((flags (GB_UNMAPPED | GB_KVAALLOC)) != GB_KVAALLOC, (GB_KVAALLOC only makes sense with GB_UNMAPPED)); ASSERT_VOP_LOCKED(vp, getblk); - if (size MAXBSIZE) - panic(getblk: size(%d) MAXBSIZE(%d)\n, size, MAXBSIZE); + if (size MAXBCACHEBUF) + panic(getblk: size(%d) MAXBCACHEBUF(%d)\n, size, + MAXBCACHEBUF); if (!unmapped_buf_allowed) flags = ~(GB_UNMAPPED | GB_KVAALLOC); Modified: head/sys/sys/param.h == --- head/sys/sys/param.hSat Apr 25 00:51:44 2015(r281959) +++ head/sys/sys/param.hSat Apr 25 00:52:01 2015(r281960) @@ -233,10 +233,19 @@ * and may be made smaller at
Re: svn commit: r281888 - head/usr.bin/nfsstat
John Baldwin wrote: On Thursday, April 23, 2015 02:36:02 PM Edward Tomasz Napierala wrote: Author: trasz Date: Thu Apr 23 14:36:01 2015 New Revision: 281888 URL: https://svnweb.freebsd.org/changeset/base/281888 Log: Remove oldnfs support from nfsstat(1). Reviewed by: rmacklem@ (earlier version) Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/nfsstat/nfsstat.1 head/usr.bin/nfsstat/nfsstat.c It might be nice to rename the new datastructure names as well, so that ext_nfsstats would just be nfsstats. Actually, I hope to soon add a new revision of nfsstats, so that the iostat like stats can be supported (D1626) and also make all the fields uint64_t, so they don't wrap. Maybe I can all that one nfsstats? ;-) Btw, if you have a suggestion for the best way to acquire this new structure from the kernel, please let me know. (I was planning on code that would copy this new one to ext_nfsstats when it is acquired by an old binary.) rick -- John Baldwin ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r281628 - in head/sys/fs: nfs nfsserver
Author: rmacklem Date: Thu Apr 16 22:35:15 2015 New Revision: 281628 URL: https://svnweb.freebsd.org/changeset/base/281628 Log: mav@ has found that NFS servers exporting ZFS file systems can perform better when using a 128K read/write data size. This patch changes NFS_MAXDATA from 64K to 128K so that clients can use 128K for NFS mounts to allow this. The patch also renames NFS_MAXDATA to NFS_SRVMAXIO so that it is clear that it applies to the NFS server side only. It also avoids a name conflict with the NFS_MAXDATA defined in rpcsvc/nfs_prot.h, that is used for userland RPC. Tested by:mav Reviewed by: mav MFC after:2 weeks Modified: head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfsproto.h head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfs/nfs.h == --- head/sys/fs/nfs/nfs.h Thu Apr 16 22:34:10 2015(r281627) +++ head/sys/fs/nfs/nfs.h Thu Apr 16 22:35:15 2015(r281628) @@ -159,7 +159,7 @@ (t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0) #defineNFS_SRVMAXDATA(n) \ (((n)-nd_flag (ND_NFSV3 | ND_NFSV4)) ? \ -NFS_MAXDATA : NFS_V2MAXDATA) +NFS_SRVMAXIO : NFS_V2MAXDATA) #defineNFS64BITSSET0xull #defineNFS64BITSMINUS1 0xfffeull Modified: head/sys/fs/nfs/nfs_commonport.c == --- head/sys/fs/nfs/nfs_commonport.cThu Apr 16 22:34:10 2015 (r281627) +++ head/sys/fs/nfs/nfs_commonport.cThu Apr 16 22:35:15 2015 (r281628) @@ -281,11 +281,11 @@ nfsvno_getfs(struct nfsfsinfo *sip, int if (isdgram) pref = NFS_MAXDGRAMDATA; else - pref = NFS_MAXDATA; - sip-fs_rtmax = NFS_MAXDATA; + pref = NFS_SRVMAXIO; + sip-fs_rtmax = NFS_SRVMAXIO; sip-fs_rtpref = pref; sip-fs_rtmult = NFS_FABLKSIZE; - sip-fs_wtmax = NFS_MAXDATA; + sip-fs_wtmax = NFS_SRVMAXIO; sip-fs_wtpref = pref; sip-fs_wtmult = NFS_FABLKSIZE; sip-fs_dtpref = pref; Modified: head/sys/fs/nfs/nfsproto.h == --- head/sys/fs/nfs/nfsproto.h Thu Apr 16 22:34:10 2015(r281627) +++ head/sys/fs/nfs/nfsproto.h Thu Apr 16 22:35:15 2015(r281628) @@ -54,11 +54,10 @@ #defineNFS_VER44 #defineNFS_V2MAXDATA 8192 #defineNFS_MAXDGRAMDATA 16384 -#defineNFS_MAXDATA NFS_MAXBSIZE #defineNFS_MAXPATHLEN 1024 #defineNFS_MAXNAMLEN 255 #defineNFS_MAXPKTHDR 404 -#defineNFS_MAXPACKET (NFS_MAXDATA + 2048) +#defineNFS_MAXPACKET (NFS_SRVMAXIO + 2048) #defineNFS_MINPACKET 20 #defineNFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #defineNFSV4_MINORVERSION 0 /* V4 Minor version */ @@ -67,6 +66,18 @@ #defineNFSV41_CBVERS 4 /* V4.1 CB Version */ #defineNFSV4_SMALLSTR 50 /* Strings small enough for stack */ +/* + * This value isn't a fixed value in the RFCs. + * It is the maximum data size supported by NFSv3 or NFSv4 over TCP for + * the server. It should be set to the I/O size preferred by ZFS or + * MAXBSIZE, whichever is greater. + * ZFS currently prefers 128K. + * It used to be called NFS_MAXDATA, but has been renamed to clarify that + * it refers to server side only and doesn't conflict with the NFS_MAXDATA + * defined in rpcsvc/nfs_prot.h for userland. + */ +#defineNFS_SRVMAXIO(128 * 1024) + /* Stat numbers for rpc returns (version 2, 3 and 4) */ /* * These numbers are hard-wired in the RFCs, so they can't be changed. Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c == --- head/sys/fs/nfsserver/nfs_nfsdserv.cThu Apr 16 22:34:10 2015 (r281627) +++ head/sys/fs/nfsserver/nfs_nfsdserv.cThu Apr 16 22:35:15 2015 (r281628) @@ -881,7 +881,7 @@ nfsrvd_write(struct nfsrv_descript *nd, i = mbuf_len(mp); } - if (retlen NFS_MAXDATA || retlen 0) + if (retlen NFS_SRVMAXIO || retlen 0) nd-nd_repstat = EIO; if (vnode_vtype(vp) != VREG !nd-nd_repstat) { if (nd-nd_flag ND_NFSV3) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r281562 - in head/sys: fs/ext2fs fs/fuse fs/msdosfs fs/nandfs fs/nfsclient fs/nfsserver fs/nullfs kern sys ufs/ffs
Author: rmacklem Date: Wed Apr 15 20:16:31 2015 New Revision: 281562 URL: https://svnweb.freebsd.org/changeset/base/281562 Log: File systems that do not use the buffer cache (such as ZFS) must use VOP_FSYNC() to perform the NFS server's Commit operation. This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which is set by file systems that use the buffer cache. If this flag is not set, the NFS server always does a VOP_FSYNC(). This should be ok for old file system modules that do not set MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although it might not be optimal for file systems that use the buffer cache. Reviewed by: kib MFC after:2 weeks Modified: head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/fuse/fuse_vfsops.c head/sys/fs/msdosfs/msdosfs_vfsops.c head/sys/fs/nandfs/nandfs_vfsops.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nullfs/null_vfsops.c head/sys/kern/vfs_subr.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/fs/ext2fs/ext2_vfsops.c == --- head/sys/fs/ext2fs/ext2_vfsops.cWed Apr 15 18:49:03 2015 (r281561) +++ head/sys/fs/ext2fs/ext2_vfsops.cWed Apr 15 20:16:31 2015 (r281562) @@ -675,7 +675,8 @@ ext2_mountfs(struct vnode *devvp, struct * Initialize filesystem stat information in mount struct. */ MNT_ILOCK(mp); - mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; + mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | + MNTK_USES_BCACHE; MNT_IUNLOCK(mp); return (0); out: Modified: head/sys/fs/fuse/fuse_vfsops.c == --- head/sys/fs/fuse/fuse_vfsops.c Wed Apr 15 18:49:03 2015 (r281561) +++ head/sys/fs/fuse/fuse_vfsops.c Wed Apr 15 20:16:31 2015 (r281562) @@ -337,6 +337,7 @@ fuse_vfsop_mount(struct mount *mp) MNT_ILOCK(mp); mp-mnt_data = data; mp-mnt_flag |= MNT_LOCAL; + mp-mnt_kern_flag |= MNTK_USES_BCACHE; MNT_IUNLOCK(mp); /* We need this here as this slot is used by getnewvnode() */ mp-mnt_stat.f_iosize = PAGE_SIZE; Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c == --- head/sys/fs/msdosfs/msdosfs_vfsops.cWed Apr 15 18:49:03 2015 (r281561) +++ head/sys/fs/msdosfs/msdosfs_vfsops.cWed Apr 15 20:16:31 2015 (r281562) @@ -759,6 +759,7 @@ mountmsdosfs(struct vnode *devvp, struct mp-mnt_stat.f_fsid.val[1] = mp-mnt_vfc-vfc_typenum; MNT_ILOCK(mp); mp-mnt_flag |= MNT_LOCAL; + mp-mnt_kern_flag |= MNTK_USES_BCACHE; MNT_IUNLOCK(mp); if (pmp-pm_flags MSDOSFS_LARGEFS) Modified: head/sys/fs/nandfs/nandfs_vfsops.c == --- head/sys/fs/nandfs/nandfs_vfsops.c Wed Apr 15 18:49:03 2015 (r281561) +++ head/sys/fs/nandfs/nandfs_vfsops.c Wed Apr 15 20:16:31 2015 (r281562) @@ -1391,6 +1391,7 @@ nandfs_mountfs(struct vnode *devvp, stru nmp-nm_ronly = ronly; MNT_ILOCK(mp); mp-mnt_flag |= MNT_LOCAL; + mp-mnt_kern_flag |= MNTK_USES_BCACHE; MNT_IUNLOCK(mp); nmp-nm_nandfsdev = nandfsdev; /* Add our mountpoint */ Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cWed Apr 15 18:49:03 2015 (r281561) +++ head/sys/fs/nfsclient/nfs_clvfsops.cWed Apr 15 20:16:31 2015 (r281562) @@ -1198,7 +1198,8 @@ nfs_mount(struct mount *mp) out: if (!error) { MNT_ILOCK(mp); - mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF; + mp-mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_NO_IOPF | + MNTK_USES_BCACHE; MNT_IUNLOCK(mp); } return (error); Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cWed Apr 15 18:49:03 2015 (r281561) +++ head/sys/fs/nfsserver/nfs_nfsdport.cWed Apr 15 20:16:31 2015 (r281562) @@ -1270,8 +1270,11 @@ nfsvno_fsync(struct vnode *vp, u_int64_t * file is done. At this time VOP_FSYNC does not accept offset and * byte count parameters so call VOP_FSYNC the whole file for now. * The same is true for NFSv4: RFC 3530 Sec. 14.2.3. +* File systems that do not use the buffer cache (as indicated +* by MNTK_USES_BCACHE not being set) must use VOP_FSYNC(). */ - if (cnt == 0 || cnt MAX_COMMIT_COUNT) { + if (cnt == 0 || cnt
svn commit: r281385 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Fri Apr 10 22:53:07 2015 New Revision: 281385 URL: https://svnweb.freebsd.org/changeset/base/281385 Log: MFC: r276347 r245508 modified the NFS client's Setattr RPC to use VA_UTIMES_NULL to indicate whether it should set the time to the current tod on the server. This had the side effect of making the NFS client use the client's timestamp for exclusive create, starting with FreeBSD9.2. Unfortunately a bug in some Solaris NFS servers causes these servers to return NFS_OK to the Setattr RPC done during exclusive create, but not actually set the file's mode, leaving the file's mode == 0. This patch restores the NFS client's behaviour to use the server's tod for the exclusive open's Setattr RPC, to avoid the Solaris server bug and to restore the pre-FreeBSD9.2 NFS behaviour. Modified: stable/9/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clport.c == --- stable/9/sys/fs/nfsclient/nfs_clport.c Fri Apr 10 21:24:38 2015 (r281384) +++ stable/9/sys/fs/nfsclient/nfs_clport.c Fri Apr 10 22:53:07 2015 (r281385) @@ -1103,9 +1103,16 @@ nfscl_checksattr(struct vattr *vap, stru * us to do a SETATTR RPC. FreeBSD servers store the verifier * in atime, but we can't really assume that all servers will * so we ensure that our SETATTR sets both atime and mtime. +* Set the VA_UTIMES_NULL flag for this case, so that +* the server's time will be used. This is needed to +* work around a bug in some Solaris servers, where +* setting the time TOCLIENT causes the Setattr RPC +* to return NFS_OK, but not set va_mode. */ - if (vap-va_mtime.tv_sec == VNOVAL) + if (vap-va_mtime.tv_sec == VNOVAL) { vfs_timestamp(vap-va_mtime); + vap-va_vaflags |= VA_UTIMES_NULL; + } if (vap-va_atime.tv_sec == VNOVAL) vap-va_atime = vap-va_mtime; return (1); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r281386 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Fri Apr 10 23:43:01 2015 New Revision: 281386 URL: https://svnweb.freebsd.org/changeset/base/281386 Log: MFC: r276347 r245508 modified the NFS client's Setattr RPC to use VA_UTIMES_NULL to indicate whether it should set the time to the current tod on the server. This had the side effect of making the NFS client use the client's timestamp for exclusive create, starting with FreeBSD9.2. Unfortunately a bug in some Solaris NFS servers causes these servers to return NFS_OK to the Setattr RPC done during exclusive create, but not actually set the file's mode, leaving the file's mode == 0. This patch restores the NFS client's behaviour to use the server's tod for the exclusive open's Setattr RPC, to avoid the Solaris server bug and to restore the pre-FreeBSD9.2 NFS behaviour. Modified: stable/10/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clport.c == --- stable/10/sys/fs/nfsclient/nfs_clport.c Fri Apr 10 22:53:07 2015 (r281385) +++ stable/10/sys/fs/nfsclient/nfs_clport.c Fri Apr 10 23:43:01 2015 (r281386) @@ -1097,9 +1097,16 @@ nfscl_checksattr(struct vattr *vap, stru * us to do a SETATTR RPC. FreeBSD servers store the verifier * in atime, but we can't really assume that all servers will * so we ensure that our SETATTR sets both atime and mtime. +* Set the VA_UTIMES_NULL flag for this case, so that +* the server's time will be used. This is needed to +* work around a bug in some Solaris servers, where +* setting the time TOCLIENT causes the Setattr RPC +* to return NFS_OK, but not set va_mode. */ - if (vap-va_mtime.tv_sec == VNOVAL) + if (vap-va_mtime.tv_sec == VNOVAL) { vfs_timestamp(vap-va_mtime); + vap-va_vaflags |= VA_UTIMES_NULL; + } if (vap-va_atime.tv_sec == VNOVAL) vap-va_atime = vap-va_mtime; return (1); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276436 - stable/10/sys/kern
Author: rmacklem Date: Wed Dec 31 00:34:37 2014 New Revision: 276436 URL: https://svnweb.freebsd.org/changeset/base/276436 Log: MFC: r276192, r276200 Modify vop_stdadvlock{async}() so that it only locks/unlocks the vnode and does a VOP_GETATTR() for the SEEK_END case. This is safe to do, since lf_advlock{async}() only uses the size argument for the SEEK_END case. The NFSv4 server needs this when vfs.nfsd.enable_locallocks!=0 since locking the vnode results in a LOR that can cause a deadlock for the nfsd threads. Modified: stable/10/sys/kern/vfs_default.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_default.c == --- stable/10/sys/kern/vfs_default.cWed Dec 31 00:09:05 2014 (r276435) +++ stable/10/sys/kern/vfs_default.cWed Dec 31 00:34:37 2014 (r276436) @@ -399,17 +399,24 @@ int vop_stdadvlock(struct vop_advlock_args *ap) { struct vnode *vp; - struct ucred *cred; struct vattr vattr; int error; vp = ap-a_vp; - cred = curthread-td_ucred; - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - return (error); + if (ap-a_fl-l_whence == SEEK_END) { + /* +* The NFSv4 server must avoid doing a vn_lock() here, since it +* can deadlock the nfsd threads, due to a LOR. Fortunately +* the NFSv4 server always uses SEEK_SET and this code is +* only required for the SEEK_END case. +*/ + vn_lock(vp, LK_SHARED | LK_RETRY); + error = VOP_GETATTR(vp, vattr, curthread-td_ucred); + VOP_UNLOCK(vp, 0); + if (error) + return (error); + } else + vattr.va_size = 0; return (lf_advlock(ap, (vp-v_lockf), vattr.va_size)); } @@ -418,17 +425,19 @@ int vop_stdadvlockasync(struct vop_advlockasync_args *ap) { struct vnode *vp; - struct ucred *cred; struct vattr vattr; int error; vp = ap-a_vp; - cred = curthread-td_ucred; - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - return (error); + if (ap-a_fl-l_whence == SEEK_END) { + /* The size argument is only needed for SEEK_END. */ + vn_lock(vp, LK_SHARED | LK_RETRY); + error = VOP_GETATTR(vp, vattr, curthread-td_ucred); + VOP_UNLOCK(vp, 0); + if (error) + return (error); + } else + vattr.va_size = 0; return (lf_advlockasync(ap, (vp-v_lockf), vattr.va_size)); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276437 - stable/10/sys/fs/nfsserver
Author: rmacklem Date: Wed Dec 31 00:40:10 2014 New Revision: 276437 URL: https://svnweb.freebsd.org/changeset/base/276437 Log: MFC: r276193 A deadlock in the NFSv4 server with vfs.nfsd.enable_locallocks=1 was reported via email. This was caused by a LOR between the sleep lock used to serialize the local locking (nfsrv_locklf()) and locking the vnode. I believe this patch fixes the problem by delaying relocking of the vnode until the sleep lock is unlocked (nfsrv_unlocklf()). To avoid nfsvno_advlock() having the side effect of unlocking the vnode, unlocking the vnode was moved to before the functions that call nfsvno_advlock(). It shouldn't affect the execution of the default case where vfs.nfsd.enable_locallocks=0. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Wed Dec 31 00:34:37 2014 (r276436) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Wed Dec 31 00:40:10 2014 (r276437) @@ -2965,12 +2965,7 @@ nfsvno_advlock(struct vnode *vp, int fty if (nfsrv_dolocallocks == 0) goto out; - - /* Check for VI_DOOMED here, so that VOP_ADVLOCK() isn't performed. */ - if ((vp-v_iflag VI_DOOMED) != 0) { - error = EPERM; - goto out; - } + ASSERT_VOP_UNLOCKED(vp, nfsvno_advlock: vp locked); fl.l_whence = SEEK_SET; fl.l_type = ftype; @@ -2994,14 +2989,12 @@ nfsvno_advlock(struct vnode *vp, int fty fl.l_pid = (pid_t)0; fl.l_sysid = (int)nfsv4_sysid; - NFSVOPUNLOCK(vp, 0); if (ftype == F_UNLCK) error = VOP_ADVLOCK(vp, (caddr_t)td-td_proc, F_UNLCK, fl, (F_POSIX | F_REMOTE)); else error = VOP_ADVLOCK(vp, (caddr_t)td-td_proc, F_SETLK, fl, (F_POSIX | F_REMOTE)); - NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); out: NFSEXITCODE(error); Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Wed Dec 31 00:34:37 2014 (r276436) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Wed Dec 31 00:40:10 2014 (r276437) @@ -1344,6 +1344,8 @@ nfsrv_freeallnfslocks(struct nfsstate *s vnode_t tvp = NULL; uint64_t first, end; + if (vp != NULL) + ASSERT_VOP_UNLOCKED(vp, nfsrv_freeallnfslocks: vnode locked); lop = LIST_FIRST(stp-ls_lock); while (lop != LIST_END(stp-ls_lock)) { nlop = LIST_NEXT(lop, lo_lckowner); @@ -1363,9 +1365,10 @@ nfsrv_freeallnfslocks(struct nfsstate *s if (gottvp == 0) { if (nfsrv_dolocallocks == 0) tvp = NULL; - else if (vp == NULL cansleep != 0) + else if (vp == NULL cansleep != 0) { tvp = nfsvno_getvp(lfp-lf_fh); - else + NFSVOPUNLOCK(tvp, 0); + } else tvp = vp; gottvp = 1; } @@ -1386,7 +1389,7 @@ nfsrv_freeallnfslocks(struct nfsstate *s lop = nlop; } if (vp == NULL tvp != NULL) - vput(tvp); + vrele(tvp); } /* @@ -1497,7 +1500,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfssta struct nfsclient *clp = NULL; u_int32_t bits; int error = 0, haslock = 0, ret, reterr; - int getlckret, delegation = 0, filestruct_locked; + int getlckret, delegation = 0, filestruct_locked, vnode_unlocked = 0; fhandle_t nfh; uint64_t first, end; uint32_t lock_flags; @@ -1587,6 +1590,11 @@ tryagain: * locking rolled back. */ NFSUNLOCKSTATE(); + if (vnode_unlocked == 0) { + ASSERT_VOP_ELOCKED(vp, nfsrv_lockctrl1); + vnode_unlocked = 1; + NFSVOPUNLOCK(vp, 0); + } reterr = nfsrv_locallock(vp, lfp, (new_lop-lo_flags (NFSLCK_READ | NFSLCK_WRITE)), new_lop-lo_first, new_lop-lo_end, cfp, p); @@ -1748,6 +1756,11 @@ tryagain: if (filestruct_locked != 0) { /* Roll back local locks. */ NFSUNLOCKSTATE(); + if (vnode_unlocked == 0) { + ASSERT_VOP_ELOCKED(vp, nfsrv_lockctrl2); +
svn commit: r276438 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Wed Dec 31 00:44:11 2014 New Revision: 276438 URL: https://svnweb.freebsd.org/changeset/base/276438 Log: MFC: r276221 Delete some duplicate code that was harmless because exactly the same code is at the end of the nfscl_checksattr() function that is called just before it. As such, this code had already been executed and didn't do anything. Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c == --- stable/10/sys/fs/nfsclient/nfs_clvnops.cWed Dec 31 00:40:10 2014 (r276437) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.cWed Dec 31 00:44:11 2014 (r276438) @@ -1608,20 +1608,6 @@ again: } } else if (NFS_ISV34(dvp) (fmode O_EXCL)) { if (nfscl_checksattr(vap, nfsva)) { - /* -* We are normally called with only a partially -* initialized VAP. Since the NFSv3 spec says that -* the server may use the file attributes to -* store the verifier, the spec requires us to do a -* SETATTR RPC. FreeBSD servers store the verifier in -* atime, but we can't really assume that all servers -* will so we ensure that our SETATTR sets both atime -* and mtime. -*/ - if (vap-va_mtime.tv_sec == VNOVAL) - vfs_timestamp(vap-va_mtime); - if (vap-va_atime.tv_sec == VNOVAL) - vap-va_atime = vap-va_mtime; error = nfsrpc_setattr(newvp, vap, NULL, cnp-cn_cred, cnp-cn_thread, nfsva, attrflag, NULL); if (error (vap-va_uid != (uid_t)VNOVAL || ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276440 - stable/9/sys/kern
Author: rmacklem Date: Wed Dec 31 01:29:44 2014 New Revision: 276440 URL: https://svnweb.freebsd.org/changeset/base/276440 Log: MFC: r276192, r276200 Modify vop_stdadvlock{async}() so that it only locks/unlocks the vnode and does a VOP_GETATTR() for the SEEK_END case. This is safe to do, since lf_advlock{async}() only uses the size argument for the SEEK_END case. The NFSv4 server needs this when vfs.nfsd.enable_locallocks!=0 since locking the vnode results in a LOR that can cause a deadlock for the nfsd threads. Modified: stable/9/sys/kern/vfs_default.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_default.c == --- stable/9/sys/kern/vfs_default.c Wed Dec 31 00:54:38 2014 (r276439) +++ stable/9/sys/kern/vfs_default.c Wed Dec 31 01:29:44 2014 (r276440) @@ -399,17 +399,24 @@ int vop_stdadvlock(struct vop_advlock_args *ap) { struct vnode *vp; - struct ucred *cred; struct vattr vattr; int error; vp = ap-a_vp; - cred = curthread-td_ucred; - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - return (error); + if (ap-a_fl-l_whence == SEEK_END) { + /* +* The NFSv4 server must avoid doing a vn_lock() here, since it +* can deadlock the nfsd threads, due to a LOR. Fortunately +* the NFSv4 server always uses SEEK_SET and this code is +* only required for the SEEK_END case. +*/ + vn_lock(vp, LK_SHARED | LK_RETRY); + error = VOP_GETATTR(vp, vattr, curthread-td_ucred); + VOP_UNLOCK(vp, 0); + if (error) + return (error); + } else + vattr.va_size = 0; return (lf_advlock(ap, (vp-v_lockf), vattr.va_size)); } @@ -418,17 +425,19 @@ int vop_stdadvlockasync(struct vop_advlockasync_args *ap) { struct vnode *vp; - struct ucred *cred; struct vattr vattr; int error; vp = ap-a_vp; - cred = curthread-td_ucred; - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - return (error); + if (ap-a_fl-l_whence == SEEK_END) { + /* The size argument is only needed for SEEK_END. */ + vn_lock(vp, LK_SHARED | LK_RETRY); + error = VOP_GETATTR(vp, vattr, curthread-td_ucred); + VOP_UNLOCK(vp, 0); + if (error) + return (error); + } else + vattr.va_size = 0; return (lf_advlockasync(ap, (vp-v_lockf), vattr.va_size)); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276441 - stable/9/sys/fs/nfsserver
Author: rmacklem Date: Wed Dec 31 01:34:37 2014 New Revision: 276441 URL: https://svnweb.freebsd.org/changeset/base/276441 Log: MFC: r276193 A deadlock in the NFSv4 server with vfs.nfsd.enable_locallocks=1 was reported via email. This was caused by a LOR between the sleep lock used to serialize the local locking (nfsrv_locklf()) and locking the vnode. I believe this patch fixes the problem by delaying relocking of the vnode until the sleep lock is unlocked (nfsrv_unlocklf()). To avoid nfsvno_advlock() having the side effect of unlocking the vnode, unlocking the vnode was moved to before the functions that call nfsvno_advlock(). It shouldn't affect the execution of the default case where vfs.nfsd.enable_locallocks=0. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdport.cWed Dec 31 01:29:44 2014 (r276440) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cWed Dec 31 01:34:37 2014 (r276441) @@ -2969,12 +2969,7 @@ nfsvno_advlock(struct vnode *vp, int fty if (nfsrv_dolocallocks == 0) goto out; - - /* Check for VI_DOOMED here, so that VOP_ADVLOCK() isn't performed. */ - if ((vp-v_iflag VI_DOOMED) != 0) { - error = EPERM; - goto out; - } + ASSERT_VOP_UNLOCKED(vp, nfsvno_advlock: vp locked); fl.l_whence = SEEK_SET; fl.l_type = ftype; @@ -2998,14 +2993,12 @@ nfsvno_advlock(struct vnode *vp, int fty fl.l_pid = (pid_t)0; fl.l_sysid = (int)nfsv4_sysid; - NFSVOPUNLOCK(vp, 0); if (ftype == F_UNLCK) error = VOP_ADVLOCK(vp, (caddr_t)td-td_proc, F_UNLCK, fl, (F_POSIX | F_REMOTE)); else error = VOP_ADVLOCK(vp, (caddr_t)td-td_proc, F_SETLK, fl, (F_POSIX | F_REMOTE)); - NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); out: NFSEXITCODE(error); Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Wed Dec 31 01:29:44 2014 (r276440) +++ stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Wed Dec 31 01:34:37 2014 (r276441) @@ -1168,6 +1168,8 @@ nfsrv_freeallnfslocks(struct nfsstate *s vnode_t tvp = NULL; uint64_t first, end; + if (vp != NULL) + ASSERT_VOP_UNLOCKED(vp, nfsrv_freeallnfslocks: vnode locked); lop = LIST_FIRST(stp-ls_lock); while (lop != LIST_END(stp-ls_lock)) { nlop = LIST_NEXT(lop, lo_lckowner); @@ -1187,9 +1189,10 @@ nfsrv_freeallnfslocks(struct nfsstate *s if (gottvp == 0) { if (nfsrv_dolocallocks == 0) tvp = NULL; - else if (vp == NULL cansleep != 0) + else if (vp == NULL cansleep != 0) { tvp = nfsvno_getvp(lfp-lf_fh); - else + NFSVOPUNLOCK(tvp, 0); + } else tvp = vp; gottvp = 1; } @@ -1210,7 +1213,7 @@ nfsrv_freeallnfslocks(struct nfsstate *s lop = nlop; } if (vp == NULL tvp != NULL) - vput(tvp); + vrele(tvp); } /* @@ -1321,7 +1324,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfssta struct nfsclient *clp = NULL; u_int32_t bits; int error = 0, haslock = 0, ret, reterr; - int getlckret, delegation = 0, filestruct_locked; + int getlckret, delegation = 0, filestruct_locked, vnode_unlocked = 0; fhandle_t nfh; uint64_t first, end; uint32_t lock_flags; @@ -1411,6 +1414,11 @@ tryagain: * locking rolled back. */ NFSUNLOCKSTATE(); + if (vnode_unlocked == 0) { + ASSERT_VOP_ELOCKED(vp, nfsrv_lockctrl1); + vnode_unlocked = 1; + NFSVOPUNLOCK(vp, 0); + } reterr = nfsrv_locallock(vp, lfp, (new_lop-lo_flags (NFSLCK_READ | NFSLCK_WRITE)), new_lop-lo_first, new_lop-lo_end, cfp, p); @@ -1569,6 +1577,11 @@ tryagain: if (filestruct_locked != 0) { /* Roll back local locks. */ NFSUNLOCKSTATE(); + if (vnode_unlocked == 0) { + ASSERT_VOP_ELOCKED(vp, nfsrv_lockctrl2); +
svn commit: r276442 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Wed Dec 31 01:38:02 2014 New Revision: 276442 URL: https://svnweb.freebsd.org/changeset/base/276442 Log: MFC: r276221 Delete some duplicate code that was harmless because exactly the same code is at the end of the nfscl_checksattr() function that is called just before it. As such, this code had already been executed and didn't do anything. Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c == --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Wed Dec 31 01:34:37 2014 (r276441) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Wed Dec 31 01:38:02 2014 (r276442) @@ -1583,20 +1583,6 @@ again: } } else if (NFS_ISV34(dvp) (fmode O_EXCL)) { if (nfscl_checksattr(vap, nfsva)) { - /* -* We are normally called with only a partially -* initialized VAP. Since the NFSv3 spec says that -* the server may use the file attributes to -* store the verifier, the spec requires us to do a -* SETATTR RPC. FreeBSD servers store the verifier in -* atime, but we can't really assume that all servers -* will so we ensure that our SETATTR sets both atime -* and mtime. -*/ - if (vap-va_mtime.tv_sec == VNOVAL) - vfs_timestamp(vap-va_mtime); - if (vap-va_atime.tv_sec == VNOVAL) - vap-va_atime = vap-va_mtime; error = nfsrpc_setattr(newvp, vap, NULL, cnp-cn_cred, cnp-cn_thread, nfsva, attrflag, NULL); if (error (vap-va_uid != (uid_t)VNOVAL || ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276347 - head/sys/fs/nfsclient
Author: rmacklem Date: Sun Dec 28 21:13:52 2014 New Revision: 276347 URL: https://svnweb.freebsd.org/changeset/base/276347 Log: r245508 modified the NFS client's Setattr RPC to use VA_UTIMES_NULL to indicate whether it should set the time to the current tod on the server. This had the side effect of making the NFS client use the client's timestamp for exclusive create, starting with FreeBSD9.2. Unfortunately a bug in some Solaris NFS servers causes these servers to return NFS_OK to the Setattr RPC done during exclusive create, but not actually set the file's mode, leaving the file's mode == 0. This patch restores the NFS client's behaviour to use the server's tod for the exclusive open's Setattr RPC, to avoid the Solaris server bug and to restore the pre-FreeBSD9.2 NFS behaviour. Discussed on: freebsd-fs PR: 186293 MFC after:3 months Modified: head/sys/fs/nfsclient/nfs_clport.c Modified: head/sys/fs/nfsclient/nfs_clport.c == --- head/sys/fs/nfsclient/nfs_clport.c Sun Dec 28 21:06:03 2014 (r276346) +++ head/sys/fs/nfsclient/nfs_clport.c Sun Dec 28 21:13:52 2014 (r276347) @@ -1096,9 +1096,16 @@ nfscl_checksattr(struct vattr *vap, stru * us to do a SETATTR RPC. FreeBSD servers store the verifier * in atime, but we can't really assume that all servers will * so we ensure that our SETATTR sets both atime and mtime. +* Set the VA_UTIMES_NULL flag for this case, so that +* the server's time will be used. This is needed to +* work around a bug in some Solaris servers, where +* setting the time TOCLIENT causes the Setattr RPC +* to return NFS_OK, but not set va_mode. */ - if (vap-va_mtime.tv_sec == VNOVAL) + if (vap-va_mtime.tv_sec == VNOVAL) { vfs_timestamp(vap-va_mtime); + vap-va_vaflags |= VA_UTIMES_NULL; + } if (vap-va_atime.tv_sec == VNOVAL) vap-va_atime = vap-va_mtime; return (1); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276200 - head/sys/kern
Author: rmacklem Date: Thu Dec 25 14:44:04 2014 New Revision: 276200 URL: https://svnweb.freebsd.org/changeset/base/276200 Log: Fix the comment introduced in r276192 so that it clearly states that the change is needed to avoid a deadlock. Suggested by: kib MFC after:1 week Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c == --- head/sys/kern/vfs_default.c Thu Dec 25 13:38:51 2014(r276199) +++ head/sys/kern/vfs_default.c Thu Dec 25 14:44:04 2014(r276200) @@ -407,9 +407,10 @@ vop_stdadvlock(struct vop_advlock_args * vp = ap-a_vp; if (ap-a_fl-l_whence == SEEK_END) { /* -* The NFSv4 server will LOR/deadlock if a vn_lock() call -* is done on vp. Fortunately, vattr.va_size is only -* needed for SEEK_END and the NFSv4 server only uses SEEK_SET. +* The NFSv4 server must avoid doing a vn_lock() here, since it +* can deadlock the nfsd threads, due to a LOR. Fortunately +* the NFSv4 server always uses SEEK_SET and this code is +* only required for the SEEK_END case. */ vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_GETATTR(vp, vattr, curthread-td_ucred); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276221 - head/sys/fs/nfsclient
Author: rmacklem Date: Thu Dec 25 22:29:37 2014 New Revision: 276221 URL: https://svnweb.freebsd.org/changeset/base/276221 Log: Delete some duplicate code that was harmless because exactly the same code is at the end of the nfscl_checksattr() function that is called just before it. As such, this code had already been executed and didn't do anything. MFC after:1 week Modified: head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c == --- head/sys/fs/nfsclient/nfs_clvnops.c Thu Dec 25 22:04:16 2014 (r276220) +++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Dec 25 22:29:37 2014 (r276221) @@ -1606,20 +1606,6 @@ again: } } else if (NFS_ISV34(dvp) (fmode O_EXCL)) { if (nfscl_checksattr(vap, nfsva)) { - /* -* We are normally called with only a partially -* initialized VAP. Since the NFSv3 spec says that -* the server may use the file attributes to -* store the verifier, the spec requires us to do a -* SETATTR RPC. FreeBSD servers store the verifier in -* atime, but we can't really assume that all servers -* will so we ensure that our SETATTR sets both atime -* and mtime. -*/ - if (vap-va_mtime.tv_sec == VNOVAL) - vfs_timestamp(vap-va_mtime); - if (vap-va_atime.tv_sec == VNOVAL) - vap-va_atime = vap-va_mtime; error = nfsrpc_setattr(newvp, vap, NULL, cnp-cn_cred, cnp-cn_thread, nfsva, attrflag, NULL); if (error (vap-va_uid != (uid_t)VNOVAL || ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276192 - head/sys/kern
Author: rmacklem Date: Wed Dec 24 22:58:08 2014 New Revision: 276192 URL: https://svnweb.freebsd.org/changeset/base/276192 Log: Modify vop_stdadvlock{async}() so that it only locks/unlocks the vnode and does a VOP_GETATTR() for the SEEK_END case. This is safe to do, since lf_advlock{async}() only uses the size argument for the SEEK_END case. The NFSv4 server needs this when vfs.nfsd.enable_locallocks!=0 since locking the vnode results in a LOR that can cause a deadlock for the nfsd threads. Reviewed by: kib MFC after:1 week Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c == --- head/sys/kern/vfs_default.c Wed Dec 24 19:47:50 2014(r276191) +++ head/sys/kern/vfs_default.c Wed Dec 24 22:58:08 2014(r276192) @@ -401,17 +401,23 @@ int vop_stdadvlock(struct vop_advlock_args *ap) { struct vnode *vp; - struct ucred *cred; struct vattr vattr; int error; vp = ap-a_vp; - cred = curthread-td_ucred; - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - return (error); + if (ap-a_fl-l_whence == SEEK_END) { + /* +* The NFSv4 server will LOR/deadlock if a vn_lock() call +* is done on vp. Fortunately, vattr.va_size is only +* needed for SEEK_END and the NFSv4 server only uses SEEK_SET. +*/ + vn_lock(vp, LK_SHARED | LK_RETRY); + error = VOP_GETATTR(vp, vattr, curthread-td_ucred); + VOP_UNLOCK(vp, 0); + if (error) + return (error); + } else + vattr.va_size = 0; return (lf_advlock(ap, (vp-v_lockf), vattr.va_size)); } @@ -420,17 +426,19 @@ int vop_stdadvlockasync(struct vop_advlockasync_args *ap) { struct vnode *vp; - struct ucred *cred; struct vattr vattr; int error; vp = ap-a_vp; - cred = curthread-td_ucred; - vn_lock(vp, LK_SHARED | LK_RETRY); - error = VOP_GETATTR(vp, vattr, cred); - VOP_UNLOCK(vp, 0); - if (error) - return (error); + if (ap-a_fl-l_whence == SEEK_END) { + /* The size argument is only needed for SEEK_END. */ + vn_lock(vp, LK_SHARED | LK_RETRY); + error = VOP_GETATTR(vp, vattr, curthread-td_ucred); + VOP_UNLOCK(vp, 0); + if (error) + return (error); + } else + vattr.va_size = 0; return (lf_advlockasync(ap, (vp-v_lockf), vattr.va_size)); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276193 - head/sys/fs/nfsserver
Author: rmacklem Date: Thu Dec 25 01:55:17 2014 New Revision: 276193 URL: https://svnweb.freebsd.org/changeset/base/276193 Log: A deadlock in the NFSv4 server with vfs.nfsd.enable_locallocks=1 was reported via email. This was caused by a LOR between the sleep lock used to serialize the local locking (nfsrv_locklf()) and locking the vnode. I believe this patch fixes the problem by delaying relocking of the vnode until the sleep lock is unlocked (nfsrv_unlocklf()). To avoid nfsvno_advlock() having the side effect of unlocking the vnode, unlocking the vnode was moved to before the functions that call nfsvno_advlock(). It shouldn't affect the execution of the default case where vfs.nfsd.enable_locallocks=0. Reported by: loic.b...@unix-experience.fr Discussed with: kib MFC after:1 week Modified: head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cWed Dec 24 22:58:08 2014 (r276192) +++ head/sys/fs/nfsserver/nfs_nfsdport.cThu Dec 25 01:55:17 2014 (r276193) @@ -2970,12 +2970,7 @@ nfsvno_advlock(struct vnode *vp, int fty if (nfsrv_dolocallocks == 0) goto out; - - /* Check for VI_DOOMED here, so that VOP_ADVLOCK() isn't performed. */ - if ((vp-v_iflag VI_DOOMED) != 0) { - error = EPERM; - goto out; - } + ASSERT_VOP_UNLOCKED(vp, nfsvno_advlock: vp locked); fl.l_whence = SEEK_SET; fl.l_type = ftype; @@ -2999,14 +2994,12 @@ nfsvno_advlock(struct vnode *vp, int fty fl.l_pid = (pid_t)0; fl.l_sysid = (int)nfsv4_sysid; - NFSVOPUNLOCK(vp, 0); if (ftype == F_UNLCK) error = VOP_ADVLOCK(vp, (caddr_t)td-td_proc, F_UNLCK, fl, (F_POSIX | F_REMOTE)); else error = VOP_ADVLOCK(vp, (caddr_t)td-td_proc, F_SETLK, fl, (F_POSIX | F_REMOTE)); - NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY); out: NFSEXITCODE(error); Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c == --- head/sys/fs/nfsserver/nfs_nfsdstate.c Wed Dec 24 22:58:08 2014 (r276192) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Thu Dec 25 01:55:17 2014 (r276193) @@ -1344,6 +1344,8 @@ nfsrv_freeallnfslocks(struct nfsstate *s vnode_t tvp = NULL; uint64_t first, end; + if (vp != NULL) + ASSERT_VOP_UNLOCKED(vp, nfsrv_freeallnfslocks: vnode locked); lop = LIST_FIRST(stp-ls_lock); while (lop != LIST_END(stp-ls_lock)) { nlop = LIST_NEXT(lop, lo_lckowner); @@ -1363,9 +1365,10 @@ nfsrv_freeallnfslocks(struct nfsstate *s if (gottvp == 0) { if (nfsrv_dolocallocks == 0) tvp = NULL; - else if (vp == NULL cansleep != 0) + else if (vp == NULL cansleep != 0) { tvp = nfsvno_getvp(lfp-lf_fh); - else + NFSVOPUNLOCK(tvp, 0); + } else tvp = vp; gottvp = 1; } @@ -1386,7 +1389,7 @@ nfsrv_freeallnfslocks(struct nfsstate *s lop = nlop; } if (vp == NULL tvp != NULL) - vput(tvp); + vrele(tvp); } /* @@ -1497,7 +1500,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfssta struct nfsclient *clp = NULL; u_int32_t bits; int error = 0, haslock = 0, ret, reterr; - int getlckret, delegation = 0, filestruct_locked; + int getlckret, delegation = 0, filestruct_locked, vnode_unlocked = 0; fhandle_t nfh; uint64_t first, end; uint32_t lock_flags; @@ -1587,6 +1590,11 @@ tryagain: * locking rolled back. */ NFSUNLOCKSTATE(); + if (vnode_unlocked == 0) { + ASSERT_VOP_ELOCKED(vp, nfsrv_lockctrl1); + vnode_unlocked = 1; + NFSVOPUNLOCK(vp, 0); + } reterr = nfsrv_locallock(vp, lfp, (new_lop-lo_flags (NFSLCK_READ | NFSLCK_WRITE)), new_lop-lo_first, new_lop-lo_end, cfp, p); @@ -1756,6 +1764,11 @@ tryagain: if (filestruct_locked != 0) { /* Roll back local locks. */ NFSUNLOCKSTATE(); + if (vnode_unlocked == 0) { + ASSERT_VOP_ELOCKED(vp, nfsrv_lockctrl2); +
svn commit: r276140 - in head/sys: conf fs/nfs fs/nfsclient
Author: rmacklem Date: Tue Dec 23 14:24:36 2014 New Revision: 276140 URL: https://svnweb.freebsd.org/changeset/base/276140 Log: Fix kernel builds with options NFS_DEBUG that were broken by r276096. Also delete the two kernel options NFS_GATHERDELAY, NFS_WDELAYHASHSIZ which are no longer used. Reported by: bz Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs.h head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Tue Dec 23 12:45:29 2014(r276139) +++ head/sys/conf/NOTES Tue Dec 23 14:24:36 2014(r276140) @@ -1098,8 +1098,6 @@ options NFS_MINATTRTIMO=3 # VREG attrib optionsNFS_MAXATTRTIMO=60 optionsNFS_MINDIRATTRTIMO=30 # VDIR attrib cache timeout in sec optionsNFS_MAXDIRATTRTIMO=60 -optionsNFS_GATHERDELAY=10 # Default write gather delay (msec) -optionsNFS_WDELAYHASHSIZ=16# and with this optionsNFS_DEBUG # Enable NFS Debugging # Modified: head/sys/conf/options == --- head/sys/conf/options Tue Dec 23 12:45:29 2014(r276139) +++ head/sys/conf/options Tue Dec 23 14:24:36 2014(r276140) @@ -619,8 +619,6 @@ NFS_MINATTRTIMO opt_nfs.h NFS_MAXATTRTIMOopt_nfs.h NFS_MINDIRATTRTIMO opt_nfs.h NFS_MAXDIRATTRTIMO opt_nfs.h -NFS_GATHERDELAYopt_nfs.h -NFS_WDELAYHASHSIZ opt_nfs.h NFS_DEBUG opt_nfs.h # For the Bt848/Bt848A/Bt849/Bt878/Bt879 driver Modified: head/sys/fs/nfs/nfsport.h == --- head/sys/fs/nfs/nfsport.h Tue Dec 23 12:45:29 2014(r276139) +++ head/sys/fs/nfs/nfsport.h Tue Dec 23 14:24:36 2014(r276140) @@ -930,24 +930,6 @@ void nfsd_mntinit(void); int newnfs_iosize(struct nfsmount *); -#ifdef NFS_DEBUG - -extern int nfs_debug; -#defineNFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */ -#defineNFS_DEBUG_WG2 /* server write gathering */ -#defineNFS_DEBUG_RC4 /* server request caching */ - -#defineNFS_DPF(cat, args) \ - do {\ - if (nfs_debug NFS_DEBUG_##cat) printf args; \ - } while (0) - -#else - -#defineNFS_DPF(cat, args) - -#endif - int newnfs_vncmpf(struct vnode *, void *); #ifndef NFS_MINDIRATTRTIMO Modified: head/sys/fs/nfsclient/nfs.h == --- head/sys/fs/nfsclient/nfs.h Tue Dec 23 12:45:29 2014(r276139) +++ head/sys/fs/nfsclient/nfs.h Tue Dec 23 14:24:36 2014(r276140) @@ -55,6 +55,24 @@ #defineNFS_ISV34(v) \ (VFSTONFS((v)-v_mount)-nm_flag (NFSMNT_NFSV3 | NFSMNT_NFSV4)) +#ifdef NFS_DEBUG + +extern int nfs_debug; +#defineNFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */ +#defineNFS_DEBUG_WG2 /* server write gathering */ +#defineNFS_DEBUG_RC4 /* server request caching */ + +#defineNFS_DPF(cat, args) \ + do {\ + if (nfs_debug NFS_DEBUG_##cat) printf args; \ + } while (0) + +#else + +#defineNFS_DPF(cat, args) + +#endif + /* * NFS iod threads can be in one of these three states once spawned. * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time. Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cTue Dec 23 12:45:29 2014 (r276139) +++ head/sys/fs/nfsclient/nfs_clvfsops.cTue Dec 23 14:24:36 2014 (r276140) @@ -100,6 +100,11 @@ SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_INITIAL static int nfs_tprintf_delay = NFS_TPRINTF_DELAY; SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_DELAY, downdelayinterval, CTLFLAG_RW, nfs_tprintf_delay, 0, ); +#ifdef NFS_DEBUG +int nfs_debug; +SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, nfs_debug, 0, +Toggle debug flag); +#endif static int nfs_mountroot(struct mount *); static voidnfs_sec_name(char *, int *); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r276096 - in head/sys: arm/conf conf fs/nfs fs/nfsclient modules modules/dtrace modules/dtrace/dtnfsclient modules/dtrace/dtraceall modules/nfs_common modules/nfsclient modules/nfsserv
Bjoern A. Zeeb wrote: On 23 Dec 2014, at 00:47 , Rick Macklem rmack...@freebsd.org wrote: Author: rmacklem Date: Tue Dec 23 00:47:46 2014 New Revision: 276096 URL: https://svnweb.freebsd.org/changeset/base/276096 Log: Remove the old NFS client and server from head, which means that the NFSCLIENT and NFSSERVER kernel options will no longer work. This commit only removes the kernel components. Removal of unused code in the user utilities will be done later. This commit does not include an addition to UPDATING, but that will be committed in a few minutes. Discussed on: freebsd-fs Hi, I see the following error currently on my (incremental) builds: nfs_clbio.o: In function `ncl_asyncio': /scratch/tmp/bz/head.svn/sys/fs/nfsclient/nfs_clbio.c:(.text+0x1974): undefined reference to `nfs_debug' /scratch/tmp/bz/head.svn/sys/fs/nfsclient/nfs_clbio.c:(.text+0x19a2): undefined reference to `nfs_debug' /scratch/tmp/bz/head.svn/sys/fs/nfsclient/nfs_clbio.c:(.text+0x19f9): undefined reference to `nfs_debug' /scratch/tmp/bz/head.svn/sys/fs/nfsclient/nfs_clbio.c:(.text+0x1a93): undefined reference to `nfs_debug' /scratch/tmp/bz/head.svn/sys/fs/nfsclient/nfs_clbio.c:(.text+0x1b0a): undefined reference to `nfs_debug' nfs_clnfsiod.o:/scratch/tmp/bz/head.svn/sys/fs/nfsclient/nfs_clnfsiod.c:(.text+0x5d2): more undefined references to `nfs_debug' follow Oops, sorry about that. Should be fixed by r276140. Thanks for reporting it, rick Deleted: head/sys/modules/dtrace/dtnfsclient/ head/sys/modules/nfs_common/ head/sys/modules/nfsclient/ head/sys/modules/nfsserver/ head/sys/nfs/nfs_common.c head/sys/nfsclient/nfs_bio.c head/sys/nfsclient/nfs_kdtrace.c head/sys/nfsclient/nfs_krpc.c head/sys/nfsclient/nfs_nfsiod.c head/sys/nfsclient/nfs_node.c head/sys/nfsclient/nfs_subs.c head/sys/nfsclient/nfs_vfsops.c head/sys/nfsclient/nfs_vnops.c head/sys/nfsserver/nfs_fha_old.c head/sys/nfsserver/nfs_serv.c head/sys/nfsserver/nfs_srvkrpc.c head/sys/nfsserver/nfs_srvsubs.c Modified: head/sys/arm/conf/DOCKSTAR head/sys/arm/conf/DREAMPLUG-1001 head/sys/arm/conf/EA3250 head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/modules/Makefile head/sys/modules/dtrace/Makefile head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/nfs/bootp_subr.c head/sys/sys/param.h — Bjoern A. Zeeb Charles Haddon Spurgeon: Friendship is one of the sweetest joys of life. Many might have failed beneath the bitterness of their trial had they not found a friend. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r276096 - in head/sys: arm/conf conf fs/nfs fs/nfsclient modules modules/dtrace modules/dtrace/dtnfsclient modules/dtrace/dtraceall modules/nfs_common modules/nfsclient modules/nfsserve...
Author: rmacklem Date: Tue Dec 23 00:47:46 2014 New Revision: 276096 URL: https://svnweb.freebsd.org/changeset/base/276096 Log: Remove the old NFS client and server from head, which means that the NFSCLIENT and NFSSERVER kernel options will no longer work. This commit only removes the kernel components. Removal of unused code in the user utilities will be done later. This commit does not include an addition to UPDATING, but that will be committed in a few minutes. Discussed on: freebsd-fs Deleted: head/sys/modules/dtrace/dtnfsclient/ head/sys/modules/nfs_common/ head/sys/modules/nfsclient/ head/sys/modules/nfsserver/ head/sys/nfs/nfs_common.c head/sys/nfsclient/nfs_bio.c head/sys/nfsclient/nfs_kdtrace.c head/sys/nfsclient/nfs_krpc.c head/sys/nfsclient/nfs_nfsiod.c head/sys/nfsclient/nfs_node.c head/sys/nfsclient/nfs_subs.c head/sys/nfsclient/nfs_vfsops.c head/sys/nfsclient/nfs_vnops.c head/sys/nfsserver/nfs_fha_old.c head/sys/nfsserver/nfs_serv.c head/sys/nfsserver/nfs_srvkrpc.c head/sys/nfsserver/nfs_srvsubs.c Modified: head/sys/arm/conf/DOCKSTAR head/sys/arm/conf/DREAMPLUG-1001 head/sys/arm/conf/EA3250 head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/modules/Makefile head/sys/modules/dtrace/Makefile head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/nfs/bootp_subr.c head/sys/sys/param.h Modified: head/sys/arm/conf/DOCKSTAR == --- head/sys/arm/conf/DOCKSTAR Mon Dec 22 23:03:18 2014(r276095) +++ head/sys/arm/conf/DOCKSTAR Tue Dec 23 00:47:46 2014(r276096) @@ -154,7 +154,7 @@ options INVARIANT_SUPPORT # Extra sanit # Enable these options for nfs root configured via BOOTP. optionsNFSCL # Network Filesystem Client optionsNFSLOCKD# Network Lock Manager -#options NFS_ROOT# NFS usable as /, requires NFSCLIENT +#options NFS_ROOT# NFS usable as /, requires NFSCL #options BOOTP #options BOOTP_NFSROOT #options BOOTP_NFSV3 Modified: head/sys/arm/conf/DREAMPLUG-1001 == --- head/sys/arm/conf/DREAMPLUG-1001Mon Dec 22 23:03:18 2014 (r276095) +++ head/sys/arm/conf/DREAMPLUG-1001Tue Dec 23 00:47:46 2014 (r276096) @@ -162,7 +162,7 @@ options INVARIANT_SUPPORT # Extra sanit # Enable these options for nfs root configured via BOOTP. optionsNFSCL # Network Filesystem Client optionsNFSLOCKD# Network Lock Manager -#options NFS_ROOT# NFS usable as /, requires NFSCLIENT +#options NFS_ROOT# NFS usable as /, requires NFSCL #options BOOTP #options BOOTP_NFSROOT #options BOOTP_NFSV3 Modified: head/sys/arm/conf/EA3250 == --- head/sys/arm/conf/EA3250Mon Dec 22 23:03:18 2014(r276095) +++ head/sys/arm/conf/EA3250Tue Dec 23 00:47:46 2014(r276096) @@ -19,7 +19,7 @@ options INET6 # IPv6 communications p optionsFFS # Berkeley Fast Filesystem optionsNFSCL # Network Filesystem Client optionsNFSLOCKD# Network Lock Manager -optionsNFS_ROOT# NFS usable as /, requires NFSCLIENT +optionsNFS_ROOT# NFS usable as /, requires NFSCL optionsGEOM_PART_BSD # BSD partition scheme optionsGEOM_PART_MBR # MBR partition scheme optionsTMPFS # Efficient memory filesystem Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Mon Dec 22 23:03:18 2014(r276095) +++ head/sys/conf/NOTES Tue Dec 23 00:47:46 2014(r276096) @@ -1019,7 +1019,7 @@ options DUMMYNET # One of these is mandatory: optionsFFS #Fast filesystem -optionsNFSCLIENT #Network File System client +optionsNFSCL #Network File System client # The rest are optional: optionsAUTOFS #Automounter filesystem @@ -1027,7 +1027,6 @@ options CD9660 #ISO 9660 filesystem optionsFDESCFS #File descriptor filesystem optionsFUSE#FUSE support module optionsMSDOSFS #MS DOS File System (FAT, FAT32) -optionsNFSSERVER #Network File System server optionsNFSLOCKD#Network Lock Manager
svn commit: r276097 - head
Author: rmacklem Date: Tue Dec 23 01:32:18 2014 New Revision: 276097 URL: https://svnweb.freebsd.org/changeset/base/276097 Log: Add an UPDATING entry for r276096, which removed the kernel sources for the old NFS client and server. Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Tue Dec 23 00:47:46 2014(r276096) +++ head/UPDATING Tue Dec 23 01:32:18 2014(r276097) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run ln -s 'abort:false,junk:false' /etc/malloc.conf.) +20141222: + The old NFS client and server (kernel options NFSCLIENT, NFSSERVER) + kernel sources have been removed. The .h files remain, since some + utilities include them. This will need to be fixed later. + If mount -t oldnfs ... is attempted, it will fail. + If the -o option on mountd(8), nfsd(8) or nfsstat(1) is used, + the utilities will report errors. + 20141121: The handling of LOCAL_LIB_DIRS has been altered to skip addition of directories to top level SUBDIR variable when their parent ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r274150 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Wed Nov 5 23:12:39 2014 New Revision: 274150 URL: https://svnweb.freebsd.org/changeset/base/274150 Log: MFC: r273486 Clip the settings for the NFS rsize, wsize mount options to a power of 2. For non-power of 2 settings, intermittent page faults have been reported. Although the bug that causes these page faults/crashes has not been identified, it does not appear to occur when rsize, wsize is a power of 2. Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c == --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Wed Nov 5 22:50:33 2014 (r274149) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Wed Nov 5 23:12:39 2014 (r274150) @@ -621,17 +621,27 @@ nfs_decode_args(struct mount *mp, struct if ((argp-flags NFSMNT_WSIZE) argp-wsize 0) { nmp-nm_wsize = argp-wsize; - /* Round down to multiple of blocksize */ - nmp-nm_wsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_wsize = 0) + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + if (nmp-nm_wsize NFS_FABLKSIZE) + nmp-nm_wsize = 1 (fls(nmp-nm_wsize) - 1); + else nmp-nm_wsize = NFS_FABLKSIZE; } if ((argp-flags NFSMNT_RSIZE) argp-rsize 0) { nmp-nm_rsize = argp-rsize; - /* Round down to multiple of blocksize */ - nmp-nm_rsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_rsize = 0) + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + if (nmp-nm_rsize NFS_FABLKSIZE) + nmp-nm_rsize = 1 (fls(nmp-nm_rsize) - 1); + else nmp-nm_rsize = NFS_FABLKSIZE; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r274152 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Wed Nov 5 23:57:33 2014 New Revision: 274152 URL: https://svnweb.freebsd.org/changeset/base/274152 Log: MFC: r273486 Clip the settings for the NFS rsize, wsize mount options to a power of 2. For non-power of 2 settings, intermittent page faults have been reported. Although the bug that causes these page faults/crashes has not been identified, it does not appear to occur when rsize, wsize is a power of 2. Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c == --- stable/9/sys/fs/nfsclient/nfs_clvfsops.cWed Nov 5 23:54:33 2014 (r274151) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.cWed Nov 5 23:57:33 2014 (r274152) @@ -615,17 +615,27 @@ nfs_decode_args(struct mount *mp, struct if ((argp-flags NFSMNT_WSIZE) argp-wsize 0) { nmp-nm_wsize = argp-wsize; - /* Round down to multiple of blocksize */ - nmp-nm_wsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_wsize = 0) + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + if (nmp-nm_wsize NFS_FABLKSIZE) + nmp-nm_wsize = 1 (fls(nmp-nm_wsize) - 1); + else nmp-nm_wsize = NFS_FABLKSIZE; } if ((argp-flags NFSMNT_RSIZE) argp-rsize 0) { nmp-nm_rsize = argp-rsize; - /* Round down to multiple of blocksize */ - nmp-nm_rsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_rsize = 0) + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + if (nmp-nm_rsize NFS_FABLKSIZE) + nmp-nm_rsize = 1 (fls(nmp-nm_rsize) - 1); + else nmp-nm_rsize = NFS_FABLKSIZE; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r273481 - head/sys/fs/nfsclient
Author: rmacklem Date: Wed Oct 22 20:47:11 2014 New Revision: 273481 URL: https://svnweb.freebsd.org/changeset/base/273481 Log: Clip the settings for the NFS rsize, wsize mount options to a power of 2. For non-power of 2 settings, intermittent page faults have been reported. Although the bug that causes these page faults/crashes has not been identified, it does not appear to occur when rsize, wsize is a power of 2. Reported by: tcber...@gmail.com MFC after:2 weeks Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cWed Oct 22 18:55:44 2014 (r273480) +++ head/sys/fs/nfsclient/nfs_clvfsops.cWed Oct 22 20:47:11 2014 (r273481) @@ -552,7 +552,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, const char *hostname, struct ucred *cred, struct thread *td) { - int s; + int i, s; int adjsock; char *p; @@ -621,18 +621,36 @@ nfs_decode_args(struct mount *mp, struct if ((argp-flags NFSMNT_WSIZE) argp-wsize 0) { nmp-nm_wsize = argp-wsize; - /* Round down to multiple of blocksize */ - nmp-nm_wsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_wsize = 0) - nmp-nm_wsize = NFS_FABLKSIZE; + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + i = NFS_FABLKSIZE; + for (;;) { + if (i * 2 nmp-nm_wsize) { + nmp-nm_wsize = i; + break; + } + i *= 2; + } } if ((argp-flags NFSMNT_RSIZE) argp-rsize 0) { nmp-nm_rsize = argp-rsize; - /* Round down to multiple of blocksize */ - nmp-nm_rsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_rsize = 0) - nmp-nm_rsize = NFS_FABLKSIZE; + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + i = NFS_FABLKSIZE; + for (;;) { + if (i * 2 nmp-nm_rsize) { + nmp-nm_rsize = i; + break; + } + i *= 2; + } } if ((argp-flags NFSMNT_READDIRSIZE) argp-readdirsize 0) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r273485 - head/sys/fs/nfsclient
Author: rmacklem Date: Wed Oct 22 21:57:35 2014 New Revision: 273485 URL: https://svnweb.freebsd.org/changeset/base/273485 Log: Revert r273481 so it can be recoded using fls(), which some feel will make it more readable. Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cWed Oct 22 21:45:12 2014 (r273484) +++ head/sys/fs/nfsclient/nfs_clvfsops.cWed Oct 22 21:57:35 2014 (r273485) @@ -552,7 +552,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, const char *hostname, struct ucred *cred, struct thread *td) { - int i, s; + int s; int adjsock; char *p; @@ -621,36 +621,18 @@ nfs_decode_args(struct mount *mp, struct if ((argp-flags NFSMNT_WSIZE) argp-wsize 0) { nmp-nm_wsize = argp-wsize; - /* -* Clip at the power of 2 below the size. There is an -* issue (not isolated) that causes intermittent page -* faults if this is not done. -*/ - i = NFS_FABLKSIZE; - for (;;) { - if (i * 2 nmp-nm_wsize) { - nmp-nm_wsize = i; - break; - } - i *= 2; - } + /* Round down to multiple of blocksize */ + nmp-nm_wsize = ~(NFS_FABLKSIZE - 1); + if (nmp-nm_wsize = 0) + nmp-nm_wsize = NFS_FABLKSIZE; } if ((argp-flags NFSMNT_RSIZE) argp-rsize 0) { nmp-nm_rsize = argp-rsize; - /* -* Clip at the power of 2 below the size. There is an -* issue (not isolated) that causes intermittent page -* faults if this is not done. -*/ - i = NFS_FABLKSIZE; - for (;;) { - if (i * 2 nmp-nm_rsize) { - nmp-nm_rsize = i; - break; - } - i *= 2; - } + /* Round down to multiple of blocksize */ + nmp-nm_rsize = ~(NFS_FABLKSIZE - 1); + if (nmp-nm_rsize = 0) + nmp-nm_rsize = NFS_FABLKSIZE; } if ((argp-flags NFSMNT_READDIRSIZE) argp-readdirsize 0) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r273486 - head/sys/fs/nfsclient
Author: rmacklem Date: Wed Oct 22 22:27:51 2014 New Revision: 273486 URL: https://svnweb.freebsd.org/changeset/base/273486 Log: Clip the settings for the NFS rsize, wsize mount options to a power of 2. For non-power of 2 settings, intermittent page faults have been reported. Although the bug that causes these page faults/crashes has not been identified, it does not appear to occur when rsize, wsize is a power of 2. Reported by: tcber...@gmail.com MFC after:2 weeks Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cWed Oct 22 21:57:35 2014 (r273485) +++ head/sys/fs/nfsclient/nfs_clvfsops.cWed Oct 22 22:27:51 2014 (r273486) @@ -621,17 +621,27 @@ nfs_decode_args(struct mount *mp, struct if ((argp-flags NFSMNT_WSIZE) argp-wsize 0) { nmp-nm_wsize = argp-wsize; - /* Round down to multiple of blocksize */ - nmp-nm_wsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_wsize = 0) + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + if (nmp-nm_wsize NFS_FABLKSIZE) + nmp-nm_wsize = 1 (fls(nmp-nm_wsize) - 1); + else nmp-nm_wsize = NFS_FABLKSIZE; } if ((argp-flags NFSMNT_RSIZE) argp-rsize 0) { nmp-nm_rsize = argp-rsize; - /* Round down to multiple of blocksize */ - nmp-nm_rsize = ~(NFS_FABLKSIZE - 1); - if (nmp-nm_rsize = 0) + /* +* Clip at the power of 2 below the size. There is an +* issue (not isolated) that causes intermittent page +* faults if this is not done. +*/ + if (nmp-nm_rsize NFS_FABLKSIZE) + nmp-nm_rsize = 1 (fls(nmp-nm_rsize) - 1); + else nmp-nm_rsize = NFS_FABLKSIZE; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r271504 - in head/sys: dev/oce dev/vmware/vmxnet3 dev/xen/netfront net netinet ofed/drivers/net/mlx4
Hans Petter Selasky wrote: On 09/13/14 18:54, Adrian Chadd wrote: Hi, Just for the record: * I'm glad you're tackling the TSO config stuff; * I'm not glad you're trying to pack it into a u_int rather than creating a new structure and adding fields for it. I appreciate that you're trying to rush this in before 10.1, but this is exactly why things shouldn't be rushed in before release deadlines. :) I'd really like to see this be broken out as a structure and the bit shifting games for what really shouldn't be packed into a u_int fixed. Otherwise this is going to be deadweight that has to persist past 11.0. Hi Adrian, I can make that change for -current, making the new structure and such. This change was intended for 10 where there is only one u_int for this information. Or do you want me to change that in 10 too? Well, there are spare fields (if_ispare[4]) in struct ifnet that I believe can be used for new u_ints when MFC'ng a patch that adds fields to struct ifnet in head. (If I have this wrong, someone please correct me.) I'll admit I don't really see an advantage to defining a structure vs just defining a couple of additional u_ints, but so long as the structure doesn't cause alignment issues for any arch, I don't see a problem with a structure. I tend to agree with Adrian that this shouldn't be rushed. (I, personally, think that if_hw_tsomax was poorly chosen, but that is already in use, so I think we need to add to that and not replace it.) I also hope that your testing has included quite a bit of activity on an NFS mount using TSO and the default 64K rsize, wsize, since that is going to generate a bunch of 35 mbuf transmit fragment lists and there is an edge case where the total data length excluding ethernet header is just under 64K (by less than the ethernet header length) where the list must be split by tcp_output() to avoid disaster. rick --HPS ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r271504 - in head/sys: dev/oce dev/vmware/vmxnet3 dev/xen/netfront net netinet ofed/drivers/net/mlx4
Hans Petter Selasky wrote: On 09/13/14 22:04, Rick Macklem wrote: Hans Petter Selasky wrote: On 09/13/14 18:54, Adrian Chadd wrote: Hi, Just for the record: * I'm glad you're tackling the TSO config stuff; * I'm not glad you're trying to pack it into a u_int rather than creating a new structure and adding fields for it. I appreciate that you're trying to rush this in before 10.1, but this is exactly why things shouldn't be rushed in before release deadlines. :) I'd really like to see this be broken out as a structure and the bit shifting games for what really shouldn't be packed into a u_int fixed. Otherwise this is going to be deadweight that has to persist past 11.0. Hi Adrian, I can make that change for -current, making the new structure and such. This change was intended for 10 where there is only one u_int for this information. Or do you want me to change that in 10 too? Well, there are spare fields (if_ispare[4]) in struct ifnet that I believe can be used for new u_ints when MFC'ng a patch that adds fields to struct ifnet in head. (If I have this wrong, someone please correct me.) I'll admit I don't really see an advantage to defining a structure vs just defining a couple of additional u_ints, but so long as the structure doesn't cause alignment issues for any arch, I don't see a problem with a structure. I tend to agree with Adrian that this shouldn't be rushed. (I, personally, think that if_hw_tsomax was poorly chosen, but that is already in use, so I think we need to add to that and not replace it.) I also hope that your testing has included quite a bit of activity on an NFS mount using TSO and the default 64K rsize, wsize, since that is going to generate a bunch of 35 mbuf transmit fragment lists and there is an edge case where the total data length excluding ethernet header is just under 64K (by less than the ethernet header length) where the list must be split by tcp_output() to avoid disaster. Hi, The ethernet and VLAN headers are still subtracted. Where? I couldn't see it when I glanced at the patch. (hdrlen in tcp_output() does not include ethernet header length and that is the only thing I see subtracted from the max_len.) I see the default set to (65536 - 4). I don't know why you subtracted 4 but I would have expected the max ethernet header length to be subtracted here? Note that this must be subtracted before use by tcp_output() because there are several network device drivers that support 32 transmit segments and this means that the TSO segment including ethernet headers must fit in 65536bytes (32 * MCLBYTES). If it does not, then NFS over these devices is busted because even m_defrag() can`t make them fit. rick rick --HPS ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r271504 - in head/sys: dev/oce dev/vmware/vmxnet3 dev/xen/netfront net netinet ofed/drivers/net/mlx4
Hans Petter Selasky wrote: On 09/13/14 22:28, Rick Macklem wrote: Hans Petter Selasky wrote: On 09/13/14 22:04, Rick Macklem wrote: Hans Petter Selasky wrote: On 09/13/14 18:54, Adrian Chadd wrote: Hi, Just for the record: * I'm glad you're tackling the TSO config stuff; * I'm not glad you're trying to pack it into a u_int rather than creating a new structure and adding fields for it. I appreciate that you're trying to rush this in before 10.1, but this is exactly why things shouldn't be rushed in before release deadlines. :) I'd really like to see this be broken out as a structure and the bit shifting games for what really shouldn't be packed into a u_int fixed. Otherwise this is going to be deadweight that has to persist past 11.0. Hi Adrian, I can make that change for -current, making the new structure and such. This change was intended for 10 where there is only one u_int for this information. Or do you want me to change that in 10 too? Well, there are spare fields (if_ispare[4]) in struct ifnet that I believe can be used for new u_ints when MFC'ng a patch that adds fields to struct ifnet in head. (If I have this wrong, someone please correct me.) I'll admit I don't really see an advantage to defining a structure vs just defining a couple of additional u_ints, but so long as the structure doesn't cause alignment issues for any arch, I don't see a problem with a structure. I tend to agree with Adrian that this shouldn't be rushed. (I, personally, think that if_hw_tsomax was poorly chosen, but that is already in use, so I think we need to add to that and not replace it.) I also hope that your testing has included quite a bit of activity on an NFS mount using TSO and the default 64K rsize, wsize, since that is going to generate a bunch of 35 mbuf transmit fragment lists and there is an edge case where the total data length excluding ethernet header is just under 64K (by less than the ethernet header length) where the list must be split by tcp_output() to avoid disaster. Hi, The ethernet and VLAN headers are still subtracted. Where? I couldn't see it when I glanced at the patch. (hdrlen in tcp_output() does not include ethernet header length and that is the only thing I see subtracted from the max_len.) Hi Rick, When the drivers setup the if_hw_tsomax field, they need to subtract the ethernet and vlan headers from the maximum TSO payload. For example here: + sc-ifp-if_hw_tsomax = IF_HW_TSOMAX_BUILD_VALUE( + 65535 - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* bytes */, + OCE_MAX_TX_ELEMENTS /* maximum frag count */, + 12 /* 4K frag size */); I see the default set to (65536 - 4). I don't know why you subtracted 4 but I would have expected the max ethernet header length to be subtracted here? That is another technical point. If you have a bunch of data to transfer you want the start and stop physical addresses to be aligned to some boundary, like cache line or 32-bit or 64-bit, because then the hardware doesn't have to do the byte shifting when it starts reading the data payload - right? Note that this must be subtracted before use by tcp_output() because there are several network device drivers that support 32 transmit segments and this means that the TSO segment including ethernet headers must fit in 65536 bytes (32 * MCLBYTES). If it does not, then NFS over these devices is busted because even m_defrag() can`t make them fit. I only found a few network drivers which actually set the TSO limit, and for the rest: The default limit is 255 frags of MAX 65536 bytes, which should not be reached in the cases you are describing. The problem is that almost no driver (last I looked xen/netfront was the only one) sets if_hw_tsomax. However many of these driver do need the maximum TSO segment size to be 64K - max_ethernet_header_len, so they can pack the TSO segment (including ethernet header) into 32 mbuf clusters via m_defrag(). So, the default needs to handle this case, because the drivers may never get fixed. rick --HPS ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r271504 - in head/sys: dev/oce dev/vmware/vmxnet3 dev/xen/netfront net netinet ofed/drivers/net/mlx4
Hans Petter Selasky wrote: On 09/13/14 22:35, Hans Petter Selasky wrote: I see the default set to (65536 - 4). I don't know why you subtracted 4 but I would have expected the max ethernet header length to be subtracted here? You mean to say that the default should be 65535 - ethernet header - vlan header ? Almost. It is actually: 65536 - ethernet header - vlan header (or the min of IP_MAXPACKET vs 32*MCLBYTES - ethernet header - vlan header if you want to cover your butt for the case where the value of MCLBYTES is changed) IP_MAXPACKET (65535) comes from the fact that some devices use the iplen field of the ip header in the TSO segment for its length, I think? (Some do not and can support TSO segments greater than IP_MAXPACKET in length, but again, the default shouldn't assume this nor should it assume the device does the vlan header in hardware -- - vlan header to be safe for default.) This is because there are lots of broken drivers (basically any one that has a limit of 32 transmit segments) and this at least makes them work correctly. Unfortunately they still do a lot of m_defrag() calls for this case, but with a patch like yours, the drivers may eventually get patched to use the max_frags setting and then avoid the need to do m_defrag() calls. rick --HPS ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r271504 - in head/sys: dev/oce dev/vmware/vmxnet3 dev/xen/netfront net netinet ofed/drivers/net/mlx4
Hans Petter Selasky wrote: On 09/13/14 18:54, Adrian Chadd wrote: Hi, Just for the record: * I'm glad you're tackling the TSO config stuff; * I'm not glad you're trying to pack it into a u_int rather than creating a new structure and adding fields for it. I appreciate that you're trying to rush this in before 10.1, but this is exactly why things shouldn't be rushed in before release deadlines. :) I'd really like to see this be broken out as a structure and the bit shifting games for what really shouldn't be packed into a u_int fixed. Otherwise this is going to be deadweight that has to persist past 11.0. Hi Adrian, I can make that change for -current, making the new structure and such. This change was intended for 10 where there is only one u_int for this information. Or do you want me to change that in 10 too? --HPS Btw, your patch calls sbsndptr() in tcp_output(), which advances sb_sndptroff and sb_sndptr by the length. Then it loops around and reduces the length for the case where there are too many mbufs in the chain. I don't know this algorithm well enough to know if advancing sb_sndptroff and sb_sndptr by too much for this case will cause a problem? I avoided the question by implementing sbsndmbuf() that was cloned from sbsndptr() to avoid this when I did my draft patch. It is in the attached patch, in case it is useful. (It avoids updating sb_sndptroff and sb_sndptr.) rick --- kern/uipc_sockbuf.c.sav 2014-01-30 20:27:17.0 -0500 +++ kern/uipc_sockbuf.c 2014-01-30 22:12:08.0 -0500 @@ -965,6 +965,39 @@ sbsndptr(struct sockbuf *sb, u_int off, } /* + * Return the first mbuf for the provided offset. + */ +struct mbuf * +sbsndmbuf(struct sockbuf *sb, u_int off, long *first_len) +{ + struct mbuf *m; + + KASSERT(sb-sb_mb != NULL, (%s: sb_mb is NULL, __func__)); + + *first_len = 0; + /* + * Is off below stored offset? Happens on retransmits. + * If so, just use sb_mb. + */ + if (sb-sb_sndptr == NULL || sb-sb_sndptroff off) + m = sb-sb_mb; + else { + m = sb-sb_sndptr; + off -= sb-sb_sndptroff; + } + while (off 0 m != NULL) { + if (off m-m_len) + break; + off -= m-m_len; + m = m-m_next; + } + if (m != NULL) + *first_len = m-m_len - off; + + return (m); +} + +/* * Drop a record off the front of a sockbuf and move the next record to the * front. */ --- sys/sockbuf.h.sav 2014-01-30 20:42:28.0 -0500 +++ sys/sockbuf.h 2014-01-30 22:08:43.0 -0500 @@ -153,6 +153,8 @@ int sbreserve_locked(struct sockbuf *sb, struct thread *td); struct mbuf * sbsndptr(struct sockbuf *sb, u_int off, u_int len, u_int *moff); +struct mbuf * + sbsndmbuf(struct sockbuf *sb, u_int off, long *first_len); void sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb); int sbwait(struct sockbuf *sb); int sblock(struct sockbuf *sb, int flags); --- netinet/tcp_input.c.sav 2014-01-30 19:37:52.0 -0500 +++ netinet/tcp_input.c 2014-01-30 19:39:07.0 -0500 @@ -3627,6 +3627,7 @@ tcp_mss(struct tcpcb *tp, int offer) if (cap.ifcap CSUM_TSO) { tp-t_flags |= TF_TSO; tp-t_tsomax = cap.tsomax; + tp-t_tsomaxsegs = cap.tsomaxsegs; } } --- netinet/tcp_output.c.sav 2014-01-30 18:55:15.0 -0500 +++ netinet/tcp_output.c 2014-01-30 22:18:56.0 -0500 @@ -166,8 +166,8 @@ int tcp_output(struct tcpcb *tp) { struct socket *so = tp-t_inpcb-inp_socket; - long len, recwin, sendwin; - int off, flags, error = 0; /* Keep compiler happy */ + long len, recwin, sendwin, tso_tlen; + int cnt, off, flags, error = 0; /* Keep compiler happy */ struct mbuf *m; struct ip *ip = NULL; struct ipovly *ipov = NULL; @@ -780,6 +780,24 @@ send: } /* + * Limit the number of TSO transmit segments (mbufs + * in mbuf list) to tp-t_tsomaxsegs. + */ + cnt = 0; + m = sbsndmbuf(so-so_snd, off, tso_tlen); + while (m != NULL cnt tp-t_tsomaxsegs + tso_tlen len) { +if (cnt 0) + tso_tlen += m-m_len; +cnt++; +m = m-m_next; + } + if (m != NULL tso_tlen len) { +len = tso_tlen; +sendalot = 1; + } + + /* * Prevent the last segment from being * fractional unless the send sockbuf can * be emptied. --- netinet/tcp_subr.c.sav 2014-01-30 19:44:35.0 -0500 +++ netinet/tcp_subr.c 2014-01-30 20:56:12.0 -0500 @@ -1800,6 +1800,12 @@ tcp_maxmtu(struct in_conninfo *inc, stru ifp-if_hwassist CSUM_TSO) cap-ifcap |= CSUM_TSO; cap-tsomax = ifp-if_hw_tsomax; +#ifdef notyet +cap-tsomaxsegs = ifp-if_hw_tsomaxsegs; +#endif +if (cap-tsomaxsegs == 0) + cap-tsomaxsegs = + TCPTSO_MAX_TX_SEGS_DEFAULT; } RTFREE(sro.ro_rt); } --- netinet/tcp_var.h.sav 2014-01-30 19:39:22.0 -0500 +++ netinet/tcp_var.h 2014-01-30 20:52:57.0 -0500 @@ -209,6 +209,7 @@ struct tcpcb { u_int t_keepcnt; /* number of keepalives before close */ u_int t_tsomax; /* tso burst length limit */ + u_int t_tsomaxsegs;
svn commit: r270875 - stable/9/usr.sbin/mountd
Author: rmacklem Date: Sun Aug 31 12:21:40 2014 New Revision: 270875 URL: http://svnweb.freebsd.org/changeset/base/270875 Log: MFC: r270005 Try to clarify how file systems are exported for NFSv4. This is a content change. Modified: stable/9/usr.sbin/mountd/exports.5 Directory Properties: stable/9/usr.sbin/mountd/ (props changed) Modified: stable/9/usr.sbin/mountd/exports.5 == --- stable/9/usr.sbin/mountd/exports.5 Sun Aug 31 11:33:19 2014 (r270874) +++ stable/9/usr.sbin/mountd/exports.5 Sun Aug 31 12:21:40 2014 (r270875) @@ -28,7 +28,7 @@ .\ @(#)exports.5 8.3 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd December 23, 2012 +.Dd August 14, 2014 .Dt EXPORTS 5 .Os .Sh NAME @@ -91,10 +91,10 @@ option is used on Because NFSv4 does not use the mount protocol, the .Dq administrative controls -are not applied. -Thus, all the above export line(s) should be considered to have the +are not applied and all directories within this server +file system are mountable via NFSv4 even if the .Fl alldirs -flag, even if the line is specified without it. +flag has not been specified. The third form has the string ``V4:'' followed by a single absolute path name, to specify the NFSv4 tree root. This line does not export any file system, but simply marks where the root @@ -310,7 +310,8 @@ interface. For the third form which specifies the NFSv4 tree root, the directory path specifies the location within the server's file system tree which is the root of the NFSv4 tree. -All entries of this form must specify the same directory path. +There can only be one NFSv4 root directory per server. +As such, all entries of this form must specify the same directory path. For file systems other than ZFS, this location can be any directory and does not need to be within an exported file system. If it is not in an exported ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270841 - stable/9/sys/fs/nfsserver
Author: rmacklem Date: Sat Aug 30 13:28:10 2014 New Revision: 270841 URL: http://svnweb.freebsd.org/changeset/base/270841 Log: MFC: r269771 Change the NFS server's printf related to hitting the DRC cache's flood level so that it suggests increasing vfs.nfsd.tcphighwater. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 30 10:29:47 2014 (r270840) +++ stable/9/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 30 13:28:10 2014 (r270841) @@ -675,10 +675,9 @@ nfsrvd_compound(struct nfsrv_descript *n if (i == 0 nd-nd_rp-rc_refcnt == 0 (nfsrv_mallocmget_limit() || nfsrc_tcpsavedreplies nfsrc_floodlevel)) { - if (nfsrc_tcpsavedreplies nfsrc_floodlevel) { - printf(nfsd server cache flooded, try to); - printf( increase nfsrc_floodlevel\n); - } + if (nfsrc_tcpsavedreplies nfsrc_floodlevel) + printf(nfsd server cache flooded, try + increasing vfs.nfsd.tcphighwater\n); nd-nd_repstat = NFSERR_RESOURCE; *repp = nfsd_errmap(nd); if (op == NFSV4OP_SETATTR) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270860 - stable/9/usr.sbin/nfsd
Author: rmacklem Date: Sat Aug 30 20:26:30 2014 New Revision: 270860 URL: http://svnweb.freebsd.org/changeset/base/270860 Log: MFC: r269788 Document the use of the vfs.nfsd sysctls that control the size of the NFS server's DRC for TCP. This is a content change. Modified: stable/9/usr.sbin/nfsd/nfsd.8 Directory Properties: stable/9/usr.sbin/nfsd/ (props changed) Modified: stable/9/usr.sbin/nfsd/nfsd.8 == --- stable/9/usr.sbin/nfsd/nfsd.8 Sat Aug 30 20:18:47 2014 (r270859) +++ stable/9/usr.sbin/nfsd/nfsd.8 Sat Aug 30 20:26:30 2014 (r270860) @@ -28,7 +28,7 @@ .\@(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd April 23, 2011 +.Dd August 10, 2014 .Dt NFSD 8 .Os .Sh NAME @@ -164,6 +164,24 @@ utility would then be used to block nfs-related packets that come in on the outside interface. .Pp +If the server has stopped servicing clients and has generated a console message +like +.Dq Li nfsd server cache flooded... , +the value for vfs.nfsd.tcphighwater needs to be increased. +This should allow the server to again handle requests without a reboot. +Also, you may want to consider decreasing the value for +vfs.nfsd.tcpcachetimeo to several minutes (in seconds) instead of 12 hours +when this occurs. +.Pp +Unfortunately making vfs.nfsd.tcphighwater too large can result in the mbuf +limit being reached, as indicated by a console message +like +.Dq Li kern.ipc.nmbufs limit reached . +If you cannot find values of the above +.Nm sysctl +values that work, you can disable the DRC cache for TCP by setting +vfs.nfsd.cachetcp to 0. +.Pp The .Nm utility has to be terminated with ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270458 - stable/9/sys/dev/e1000
Author: rmacklem Date: Sun Aug 24 13:03:51 2014 New Revision: 270458 URL: http://svnweb.freebsd.org/changeset/base/270458 Log: MFC: r268726 Move the retry: label so that the calls to m_pullup() are not done after the call to m_defrag(). This fixes a problem where m_pullup() would prepend an mbuf to the list created by m_defrag() making the chain greater than 32 again. Modified: stable/9/sys/dev/e1000/if_em.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) Modified: stable/9/sys/dev/e1000/if_em.c == --- stable/9/sys/dev/e1000/if_em.c Sun Aug 24 12:51:34 2014 (r270457) +++ stable/9/sys/dev/e1000/if_em.c Sun Aug 24 13:03:51 2014 (r270458) @@ -1830,7 +1830,6 @@ em_xmit(struct tx_ring *txr, struct mbuf int nsegs, i, j, first, last = 0; int error, do_tso, tso_desc = 0, remap = 1; -retry: m_head = *m_headp; txd_upper = txd_lower = txd_used = txd_saved = 0; do_tso = ((m_head-m_pkthdr.csum_flags CSUM_TSO) != 0); @@ -1956,6 +1955,7 @@ retry: tx_buffer_mapped = tx_buffer; map = tx_buffer-map; +retry: error = bus_dmamap_load_mbuf_sg(txr-txtag, map, *m_headp, segs, nsegs, BUS_DMA_NOWAIT); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270435 - stable/9/sys/fs/nfsserver
Author: rmacklem Date: Sat Aug 23 22:03:15 2014 New Revision: 270435 URL: http://svnweb.freebsd.org/changeset/base/270435 Log: MFC: r268273 The new NFSv3 server did not generate directory postop attributes for the reply to ReaddirPlus when the server failed within the loop that calls VFS_VGET(). This failure is most likely an error return from VFS_VGET() caused by a bogus d_fileno that was truncated to 32bits. This patch fixes the server so that it will return directory postop attributes for the failure. It does not fix the underlying issue caused by d_fileno being uint32_t when a file system like ZFS generates a fileno that is greater than 32bits. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdport.cSat Aug 23 21:16:26 2014 (r270434) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cSat Aug 23 22:03:15 2014 (r270435) @@ -2265,9 +2265,11 @@ again: if (dirlen cnt || nd-nd_repstat) { if (!nd-nd_repstat entrycnt == 0) nd-nd_repstat = NFSERR_TOOSMALL; - if (nd-nd_repstat) + if (nd-nd_repstat) { newnfs_trimtrailing(nd, mb0, bpos0); - else + if (nd-nd_flag ND_NFSV3) + nfsrv_postopattr(nd, getret, at); + } else newnfs_trimtrailing(nd, mb1, bpos1); eofflag = 0; } else if (cpos cend) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270255 - stable/10/usr.sbin/mountd
Author: rmacklem Date: Thu Aug 21 01:07:27 2014 New Revision: 270255 URL: http://svnweb.freebsd.org/changeset/base/270255 Log: MFC: r270005 Try to clarify how file systems are exported for NFSv4. This is a content change. Modified: stable/10/usr.sbin/mountd/exports.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mountd/exports.5 == --- stable/10/usr.sbin/mountd/exports.5 Thu Aug 21 00:57:32 2014 (r270254) +++ stable/10/usr.sbin/mountd/exports.5 Thu Aug 21 01:07:27 2014 (r270255) @@ -28,7 +28,7 @@ .\ @(#)exports.5 8.3 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd December 23, 2012 +.Dd August 14, 2014 .Dt EXPORTS 5 .Os .Sh NAME @@ -91,10 +91,10 @@ option is used on Because NFSv4 does not use the mount protocol, the .Dq administrative controls -are not applied. -Thus, all the above export line(s) should be considered to have the +are not applied and all directories within this server +file system are mountable via NFSv4 even if the .Fl alldirs -flag, even if the line is specified without it. +flag has not been specified. The third form has the string ``V4:'' followed by a single absolute path name, to specify the NFSv4 tree root. This line does not export any file system, but simply marks where the root @@ -310,7 +310,8 @@ interface. For the third form which specifies the NFSv4 tree root, the directory path specifies the location within the server's file system tree which is the root of the NFSv4 tree. -All entries of this form must specify the same directory path. +There can only be one NFSv4 root directory per server. +As such, all entries of this form must specify the same directory path. For file systems other than ZFS, this location can be any directory and does not need to be within an exported file system. If it is not in an exported ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270112 - stable/10/usr.sbin/nfsd
Author: rmacklem Date: Sun Aug 17 19:24:26 2014 New Revision: 270112 URL: http://svnweb.freebsd.org/changeset/base/270112 Log: MFC: r269788 Document the use of the vfs.nfsd sysctls that control the size of the NFS server's DRC for TCP. This is a content change. Modified: stable/10/usr.sbin/nfsd/nfsd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/nfsd/nfsd.8 == --- stable/10/usr.sbin/nfsd/nfsd.8 Sun Aug 17 19:06:26 2014 (r270111) +++ stable/10/usr.sbin/nfsd/nfsd.8 Sun Aug 17 19:24:26 2014 (r270112) @@ -28,7 +28,7 @@ .\@(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd July 18, 2014 +.Dd August 10, 2014 .Dt NFSD 8 .Os .Sh NAME @@ -175,6 +175,24 @@ utility would then be used to block nfs-related packets that come in on the outside interface. .Pp +If the server has stopped servicing clients and has generated a console message +like +.Dq Li nfsd server cache flooded... , +the value for vfs.nfsd.tcphighwater needs to be increased. +This should allow the server to again handle requests without a reboot. +Also, you may want to consider decreasing the value for +vfs.nfsd.tcpcachetimeo to several minutes (in seconds) instead of 12 hours +when this occurs. +.Pp +Unfortunately making vfs.nfsd.tcphighwater too large can result in the mbuf +limit being reached, as indicated by a console message +like +.Dq Li kern.ipc.nmbufs limit reached . +If you cannot find values of the above +.Nm sysctl +values that work, you can disable the DRC cache for TCP by setting +vfs.nfsd.cachetcp to 0. +.Pp The .Nm utility has to be terminated with ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270066 - stable/10/sys/fs/nfsserver
Author: rmacklem Date: Sat Aug 16 21:36:22 2014 New Revision: 270066 URL: http://svnweb.freebsd.org/changeset/base/270066 Log: MFC: r269771 Change the NFS server's printf related to hitting the DRC cache's flood level so that it suggests increasing vfs.nfsd.tcphighwater. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 16 20:44:45 2014 (r270065) +++ stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 16 21:36:22 2014 (r270066) @@ -749,10 +749,9 @@ nfsrvd_compound(struct nfsrv_descript *n nd-nd_rp-rc_refcnt == 0) (nfsrv_mallocmget_limit() || nfsrc_tcpsavedreplies nfsrc_floodlevel)) { - if (nfsrc_tcpsavedreplies nfsrc_floodlevel) { - printf(nfsd server cache flooded, try to); - printf( increase nfsrc_floodlevel\n); - } + if (nfsrc_tcpsavedreplies nfsrc_floodlevel) + printf(nfsd server cache flooded, try + increasing vfs.nfsd.tcphighwater\n); nd-nd_repstat = NFSERR_RESOURCE; *repp = nfsd_errmap(nd); if (op == NFSV4OP_SETATTR) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r270005 - head/usr.sbin/mountd
Author: rmacklem Date: Thu Aug 14 22:52:05 2014 New Revision: 270005 URL: http://svnweb.freebsd.org/changeset/base/270005 Log: Try to clarify how file systems are exported for NFSv4. Suggested by: rcar...@pinyon.org MFC after:1 week Modified: head/usr.sbin/mountd/exports.5 Modified: head/usr.sbin/mountd/exports.5 == --- head/usr.sbin/mountd/exports.5 Thu Aug 14 22:33:56 2014 (r270004) +++ head/usr.sbin/mountd/exports.5 Thu Aug 14 22:52:05 2014 (r270005) @@ -28,7 +28,7 @@ .\ @(#)exports.5 8.3 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd December 23, 2012 +.Dd August 14, 2014 .Dt EXPORTS 5 .Os .Sh NAME @@ -91,10 +91,10 @@ option is used on Because NFSv4 does not use the mount protocol, the .Dq administrative controls -are not applied. -Thus, all the above export line(s) should be considered to have the +are not applied and all directories within this server +file system are mountable via NFSv4 even if the .Fl alldirs -flag, even if the line is specified without it. +flag has not been specified. The third form has the string ``V4:'' followed by a single absolute path name, to specify the NFSv4 tree root. This line does not export any file system, but simply marks where the root @@ -310,7 +310,8 @@ interface. For the third form which specifies the NFSv4 tree root, the directory path specifies the location within the server's file system tree which is the root of the NFSv4 tree. -All entries of this form must specify the same directory path. +There can only be one NFSv4 root directory per server. +As such, all entries of this form must specify the same directory path. For file systems other than ZFS, this location can be any directory and does not need to be within an exported file system. If it is not in an exported ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r269771 - head/sys/fs/nfsserver
I wrote: Author: rmacklem Date: Sun Aug 10 01:13:32 2014 New Revision: 269771 URL: http://svnweb.freebsd.org/changeset/base/269771 Log: Change the NFS server's printf related to hitting the DRC cache's flood level so that it suggests increasing vfs.nfsd.tcphighwater. Suggested by: h.schmalzba...@omnilan.de Oops, I intended to put an MFC of 1 week here. Sorry about that, rick Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c == --- head/sys/fs/nfsserver/nfs_nfsdsocket.cSun Aug 10 00:30:12 2014 (r269770) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.cSun Aug 10 01:13:32 2014 (r269771) @@ -749,10 +749,9 @@ nfsrvd_compound(struct nfsrv_descript *n nd-nd_rp-rc_refcnt == 0) (nfsrv_mallocmget_limit() || nfsrc_tcpsavedreplies nfsrc_floodlevel)) { - if (nfsrc_tcpsavedreplies nfsrc_floodlevel) { - printf(nfsd server cache flooded, try to); - printf( increase nfsrc_floodlevel\n); - } + if (nfsrc_tcpsavedreplies nfsrc_floodlevel) + printf(nfsd server cache flooded, try + increasing vfs.nfsd.tcphighwater\n); nd-nd_repstat = NFSERR_RESOURCE; *repp = nfsd_errmap(nd); if (op == NFSV4OP_SETATTR) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r269788 - head/usr.sbin/nfsd
Author: rmacklem Date: Sun Aug 10 20:05:13 2014 New Revision: 269788 URL: http://svnweb.freebsd.org/changeset/base/269788 Log: Document the use of the vfs.nfsd sysctls that control the size of the NFS server's DRC for TCP. This is a content change. MFC after:1 week Modified: head/usr.sbin/nfsd/nfsd.8 Modified: head/usr.sbin/nfsd/nfsd.8 == --- head/usr.sbin/nfsd/nfsd.8 Sun Aug 10 18:13:50 2014(r269787) +++ head/usr.sbin/nfsd/nfsd.8 Sun Aug 10 20:05:13 2014(r269788) @@ -28,7 +28,7 @@ .\@(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd July 18, 2014 +.Dd August 10, 2014 .Dt NFSD 8 .Os .Sh NAME @@ -175,6 +175,24 @@ utility would then be used to block nfs-related packets that come in on the outside interface. .Pp +If the server has stopped servicing clients and has generated a console message +like +.Dq Li nfsd server cache flooded... , +the value for vfs.nfsd.tcphighwater needs to be increased. +This should allow the server to again handle requests without a reboot. +Also, you may want to consider decreasing the value for +vfs.nfsd.tcpcachetimeo to several minutes (in seconds) instead of 12 hours +when this occurs. +.Pp +Unfortunately making vfs.nfsd.tcphighwater too large can result in the mbuf +limit being reached, as indicated by a console message +like +.Dq Li kern.ipc.nmbufs limit reached . +If you cannot find values of the above +.Nm sysctl +values that work, you can disable the DRC cache for TCP by setting +vfs.nfsd.cachetcp to 0. +.Pp The .Nm utility has to be terminated with ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r269771 - head/sys/fs/nfsserver
Author: rmacklem Date: Sun Aug 10 01:13:32 2014 New Revision: 269771 URL: http://svnweb.freebsd.org/changeset/base/269771 Log: Change the NFS server's printf related to hitting the DRC cache's flood level so that it suggests increasing vfs.nfsd.tcphighwater. Suggested by: h.schmalzba...@omnilan.de Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c == --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Sun Aug 10 00:30:12 2014 (r269770) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Sun Aug 10 01:13:32 2014 (r269771) @@ -749,10 +749,9 @@ nfsrvd_compound(struct nfsrv_descript *n nd-nd_rp-rc_refcnt == 0) (nfsrv_mallocmget_limit() || nfsrc_tcpsavedreplies nfsrc_floodlevel)) { - if (nfsrc_tcpsavedreplies nfsrc_floodlevel) { - printf(nfsd server cache flooded, try to); - printf( increase nfsrc_floodlevel\n); - } + if (nfsrc_tcpsavedreplies nfsrc_floodlevel) + printf(nfsd server cache flooded, try + increasing vfs.nfsd.tcphighwater\n); nd-nd_repstat = NFSERR_RESOURCE; *repp = nfsd_errmap(nd); if (op == NFSV4OP_SETATTR) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r269443 - stable/10/usr.sbin/nfsd
Author: rmacklem Date: Sat Aug 2 20:06:36 2014 New Revision: 269443 URL: http://svnweb.freebsd.org/changeset/base/269443 Log: MFC: r268866 r243637 changed the default number of nfsd threads created, but the man page did not reflect this. This is a content change. Modified: stable/10/usr.sbin/nfsd/nfsd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/nfsd/nfsd.8 == --- stable/10/usr.sbin/nfsd/nfsd.8 Sat Aug 2 19:59:19 2014 (r269442) +++ stable/10/usr.sbin/nfsd/nfsd.8 Sat Aug 2 20:06:36 2014 (r269443) @@ -28,7 +28,7 @@ .\@(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd April 23, 2011 +.Dd July 18, 2014 .Dt NFSD 8 .Os .Sh NAME @@ -53,7 +53,7 @@ At least one .Nm must be running for a machine to operate as a server. .Pp -Unless otherwise specified, four servers for +Unless otherwise specified, eight servers per CPU for .Tn UDP transport are started. .Pp ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r269452 - stable/10/sys/fs/nfsserver
Author: rmacklem Date: Sun Aug 3 00:35:10 2014 New Revision: 269452 URL: http://svnweb.freebsd.org/changeset/base/269452 Log: MFC: r268273 The new NFSv3 server did not generate directory postop attributes for the reply to ReaddirPlus when the server failed within the loop that calls VFS_VGET(). This failure is most likely an error return from VFS_VGET() caused by a bogus d_fileno that was truncated to 32bits. This patch fixes the server so that it will return directory postop attributes for the failure. It does not fix the underlying issue caused by d_fileno being uint32_t when a file system like ZFS generates a fileno that is greater than 32bits. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Sun Aug 3 00:29:03 2014 (r269451) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Sun Aug 3 00:35:10 2014 (r269452) @@ -2264,9 +2264,11 @@ again: if (dirlen cnt || nd-nd_repstat) { if (!nd-nd_repstat entrycnt == 0) nd-nd_repstat = NFSERR_TOOSMALL; - if (nd-nd_repstat) + if (nd-nd_repstat) { newnfs_trimtrailing(nd, mb0, bpos0); - else + if (nd-nd_flag ND_NFSV3) + nfsrv_postopattr(nd, getret, at); + } else newnfs_trimtrailing(nd, mb1, bpos1); eofflag = 0; } else if (cpos cend) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r269398 - in stable/10/sys: conf fs/nfs fs/nfsclient fs/nfsserver modules/krpc rpc
Author: rmacklem Date: Fri Aug 1 21:10:41 2014 New Revision: 269398 URL: http://svnweb.freebsd.org/changeset/base/269398 Log: MFC: r268115 Merge the NFSv4.1 server code in projects/nfsv4.1-server over into head. The code is not believed to have any effect on the semantics of non-NFSv4.1 server behaviour. It is a rather large merge, but I am hoping that there will not be any regressions for the NFS server. Added: stable/10/sys/rpc/clnt_bck.c - copied unchanged from r268115, head/sys/rpc/clnt_bck.c Modified: stable/10/sys/conf/files stable/10/sys/fs/nfs/nfs.h stable/10/sys/fs/nfs/nfs_commonkrpc.c stable/10/sys/fs/nfs/nfs_commonport.c stable/10/sys/fs/nfs/nfs_commonsubs.c stable/10/sys/fs/nfs/nfs_var.h stable/10/sys/fs/nfs/nfsclstate.h stable/10/sys/fs/nfs/nfsdport.h stable/10/sys/fs/nfs/nfsport.h stable/10/sys/fs/nfs/nfsproto.h stable/10/sys/fs/nfs/nfsrvstate.h stable/10/sys/fs/nfsclient/nfs_clstate.c stable/10/sys/fs/nfsserver/nfs_nfsdcache.c stable/10/sys/fs/nfsserver/nfs_nfsdkrpc.c stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/fs/nfsserver/nfs_nfsdserv.c stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c stable/10/sys/fs/nfsserver/nfs_nfsdstate.c stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c stable/10/sys/modules/krpc/Makefile stable/10/sys/rpc/krpc.h stable/10/sys/rpc/svc.h stable/10/sys/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files == --- stable/10/sys/conf/filesFri Aug 1 21:00:18 2014(r269397) +++ stable/10/sys/conf/filesFri Aug 1 21:10:41 2014(r269398) @@ -3838,6 +3838,7 @@ pci/viapm.c optional viapm pci rpc/auth_none.coptional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/auth_unix.coptional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/authunix_prot.coptional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +rpc/clnt_bck.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/clnt_dg.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd Modified: stable/10/sys/fs/nfs/nfs.h == --- stable/10/sys/fs/nfs/nfs.h Fri Aug 1 21:00:18 2014(r269397) +++ stable/10/sys/fs/nfs/nfs.h Fri Aug 1 21:10:41 2014(r269398) @@ -50,7 +50,8 @@ #defineNFS_MAXREXMIT 100 /* Stop counting after this many */ #defineNFSV4_CALLBACKTIMEO (2 * NFS_HZ) /* Timeout in ticks */ #defineNFSV4_CALLBACKRETRY 5 /* Number of retries before failure */ -#defineNFSV4_CBSLOTS 8 /* Number of slots for session */ +#defineNFSV4_SLOTS 64 /* Number of slots, fore channel */ +#defineNFSV4_CBSLOTS 8 /* Number of slots, back channel */ #defineNFSV4_CBRETRYCNT 4 /* # of CBRecall retries upon err */ #defineNFSV4_UPCALLTIMEO (15 * NFS_HZ) /* Timeout in ticks for upcalls */ /* to gssd or nfsuserd */ @@ -91,6 +92,9 @@ #ifndef NFSLOCKHASHSIZE #defineNFSLOCKHASHSIZE 20 /* Size of server nfslock hash table */ #endif +#ifndef NFSSESSIONHASHSIZE +#defineNFSSESSIONHASHSIZE 20 /* Size of server session hash table */ +#endif #defineNFSSTATEHASHSIZE10 /* Size of server stateid hash table */ #ifndef NFSUSERHASHSIZE #defineNFSUSERHASHSIZE 30 /* Size of user id hash table */ @@ -276,6 +280,8 @@ struct nfsreferral { #defineLCL_GSSINTEGRITY0x2000 #defineLCL_GSSPRIVACY 0x4000 #defineLCL_ADMINREVOKED0x8000 +#defineLCL_RECLAIMCOMPLETE 0x0001 +#defineLCL_NFSV41 0x0002 #defineLCL_GSS LCL_KERBV /* Or of all mechs */ @@ -318,6 +324,11 @@ struct nfsreferral { #defineNFSLCK_SETATTR 0x0200 #defineNFSLCK_DELEGPURGE 0x0400 #defineNFSLCK_DELEGRETURN 0x0800 +#defineNFSLCK_WANTWDELEG 0x1000 +#defineNFSLCK_WANTRDELEG 0x2000 +#defineNFSLCK_WANTNODELEG 0x4000 +#defineNFSLCK_WANTBITS \ +(NFSLCK_WANTWDELEG | NFSLCK_WANTRDELEG | NFSLCK_WANTNODELEG) /* And bits for nid_flag */ #defineNFSID_INITIALIZE0x0001 @@ -341,68 +352,120 @@ struct nfsreferral { * THE MACROS MUST BE MANUALLY MODIFIED IF NFSATTRBIT_MAXWORDS CHANGES!! * It is (NFSATTRBIT_MAX +
svn commit: r269400 - stable/10/sys/sys
Author: rmacklem Date: Fri Aug 1 21:24:19 2014 New Revision: 269400 URL: http://svnweb.freebsd.org/changeset/base/269400 Log: Bump __FreeBSD_version for r269398, since it changes the internal interfaces between the NFS related modules. This is a direct commit to stable/10. Modified: stable/10/sys/sys/param.h Modified: stable/10/sys/sys/param.h == --- stable/10/sys/sys/param.h Fri Aug 1 21:14:02 2014(r269399) +++ stable/10/sys/sys/param.h Fri Aug 1 21:24:19 2014(r269400) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000711 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000712 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r269401 - stable/10
Author: rmacklem Date: Fri Aug 1 21:28:58 2014 New Revision: 269401 URL: http://svnweb.freebsd.org/changeset/base/269401 Log: Add an UPDATING entry for the __FreeBSD_version bump related to r269398. Modified: stable/10/UPDATING Modified: stable/10/UPDATING == --- stable/10/UPDATING Fri Aug 1 21:24:19 2014(r269400) +++ stable/10/UPDATING Fri Aug 1 21:28:58 2014(r269401) @@ -16,6 +16,11 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20140801: + The NFSv4.1 server committed by r269398 changes the internal + function call interfaces used between the NFS and krpc modules. + As such, __FreeBSD_version was bumped. + 20140717: It is no longer necessary to include the dwarf version in your DEBUG options in your kernel config file. The bug that required it to be ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r269258 - stable/10/sys/dev/e1000
Author: rmacklem Date: Tue Jul 29 21:05:51 2014 New Revision: 269258 URL: http://svnweb.freebsd.org/changeset/base/269258 Log: MFC: r268726 Move the retry: label so that the calls to m_pullup() are not done after the call to m_defrag(). This fixes a problem where m_pullup() would prepend an mbuf to the list created by m_defrag() making the chain greater than 32 again. Modified: stable/10/sys/dev/e1000/if_em.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/if_em.c == --- stable/10/sys/dev/e1000/if_em.c Tue Jul 29 20:57:38 2014 (r269257) +++ stable/10/sys/dev/e1000/if_em.c Tue Jul 29 21:05:51 2014 (r269258) @@ -1830,7 +1830,6 @@ em_xmit(struct tx_ring *txr, struct mbuf int nsegs, i, j, first, last = 0; int error, do_tso, tso_desc = 0, remap = 1; -retry: m_head = *m_headp; txd_upper = txd_lower = txd_used = txd_saved = 0; do_tso = ((m_head-m_pkthdr.csum_flags CSUM_TSO) != 0); @@ -1956,6 +1955,7 @@ retry: tx_buffer_mapped = tx_buffer; map = tx_buffer-map; +retry: error = bus_dmamap_load_mbuf_sg(txr-txtag, map, *m_headp, segs, nsegs, BUS_DMA_NOWAIT); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268866 - head/usr.sbin/nfsd
Author: rmacklem Date: Sat Jul 19 01:15:01 2014 New Revision: 268866 URL: http://svnweb.freebsd.org/changeset/base/268866 Log: r243637 changed the default number of nfsd threads created, but the man page did not reflect this. This is a content change. Reported by: bde MFC after:2 weeks Modified: head/usr.sbin/nfsd/nfsd.8 Modified: head/usr.sbin/nfsd/nfsd.8 == --- head/usr.sbin/nfsd/nfsd.8 Sat Jul 19 00:26:03 2014(r268865) +++ head/usr.sbin/nfsd/nfsd.8 Sat Jul 19 01:15:01 2014(r268866) @@ -28,7 +28,7 @@ .\@(#)nfsd.8 8.4 (Berkeley) 3/29/95 .\ $FreeBSD$ .\ -.Dd April 23, 2011 +.Dd July 18, 2014 .Dt NFSD 8 .Os .Sh NAME @@ -53,7 +53,7 @@ At least one .Nm must be running for a machine to operate as a server. .Pp -Unless otherwise specified, four servers for +Unless otherwise specified, eight servers per CPU for .Tn UDP transport are started. .Pp ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268726 - head/sys/dev/e1000
Author: rmacklem Date: Tue Jul 15 23:32:13 2014 New Revision: 268726 URL: http://svnweb.freebsd.org/changeset/base/268726 Log: Move the retry: label so that the calls to m_pullup() are not done after the call to m_defrag(). This fixes a problem where m_pullup() would prepend an mbuf to the list created by m_defrag() making the chain greater than 32 again. Tested by:rcar...@pinyon.org Reviewed by: yongari, jfv MFC after:2 weeks Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Tue Jul 15 23:29:20 2014(r268725) +++ head/sys/dev/e1000/if_em.c Tue Jul 15 23:32:13 2014(r268726) @@ -1818,7 +1818,6 @@ em_xmit(struct tx_ring *txr, struct mbuf int nsegs, i, j, first, last = 0; int error, do_tso, tso_desc = 0, remap = 1; -retry: m_head = *m_headp; txd_upper = txd_lower = txd_used = txd_saved = 0; do_tso = ((m_head-m_pkthdr.csum_flags CSUM_TSO) != 0); @@ -1944,6 +1943,7 @@ retry: tx_buffer_mapped = tx_buffer; map = tx_buffer-map; +retry: error = bus_dmamap_load_mbuf_sg(txr-txtag, map, *m_headp, segs, nsegs, BUS_DMA_NOWAIT); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268579 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Sat Jul 12 23:27:38 2014 New Revision: 268579 URL: http://svnweb.freebsd.org/changeset/base/268579 Log: MFC: r268008 There might be a potential race condition for the NFSv4 client when a newly created file has another open done on it that update the open mode. This patch moves the code that updates the open mode up into the block where the mutex is held to ensure this cannot happen. No bug caused by this potential race has been observed, but this fix is a safety belt to ensure it cannot happen. Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c == --- stable/9/sys/fs/nfsclient/nfs_clstate.c Sat Jul 12 22:56:41 2014 (r268578) +++ stable/9/sys/fs/nfsclient/nfs_clstate.c Sat Jul 12 23:27:38 2014 (r268579) @@ -261,6 +261,23 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i newonep); /* +* Now, check the mode on the open and return the appropriate +* value. +*/ + if (retp != NULL) { + if (nfhp != NULL dp != NULL nop == NULL) + /* new local open on delegation */ + *retp = NFSCLOPEN_SETCRED; + else + *retp = NFSCLOPEN_OK; + } + if (op != NULL (amode ~(op-nfso_mode))) { + op-nfso_mode |= amode; + if (retp != NULL dp == NULL) + *retp = NFSCLOPEN_DOOPEN; + } + + /* * Serialize modifications to the open owner for multiple threads * within the same process using a read/write sleep lock. */ @@ -275,23 +292,6 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i *owpp = owp; if (opp != NULL) *opp = op; - if (retp != NULL) { - if (nfhp != NULL dp != NULL nop == NULL) - /* new local open on delegation */ - *retp = NFSCLOPEN_SETCRED; - else - *retp = NFSCLOPEN_OK; - } - - /* -* Now, check the mode on the open and return the appropriate -* value. -*/ - if (op != NULL (amode ~(op-nfso_mode))) { - op-nfso_mode |= amode; - if (retp != NULL dp == NULL) - *retp = NFSCLOPEN_DOOPEN; - } return (0); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268580 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Sun Jul 13 00:19:39 2014 New Revision: 268580 URL: http://svnweb.freebsd.org/changeset/base/268580 Log: MFC: r268008 There might be a potential race condition for the NFSv4 client when a newly created file has another open done on it that update the open mode. This patch moves the code that updates the open mode up into the block where the mutex is held to ensure this cannot happen. No bug caused by this potential race has been observed, but this fix is a safety belt to ensure it cannot happen. Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c == --- stable/10/sys/fs/nfsclient/nfs_clstate.cSat Jul 12 23:27:38 2014 (r268579) +++ stable/10/sys/fs/nfsclient/nfs_clstate.cSun Jul 13 00:19:39 2014 (r268580) @@ -281,6 +281,23 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i newonep); /* +* Now, check the mode on the open and return the appropriate +* value. +*/ + if (retp != NULL) { + if (nfhp != NULL dp != NULL nop == NULL) + /* new local open on delegation */ + *retp = NFSCLOPEN_SETCRED; + else + *retp = NFSCLOPEN_OK; + } + if (op != NULL (amode ~(op-nfso_mode))) { + op-nfso_mode |= amode; + if (retp != NULL dp == NULL) + *retp = NFSCLOPEN_DOOPEN; + } + + /* * Serialize modifications to the open owner for multiple threads * within the same process using a read/write sleep lock. */ @@ -295,23 +312,6 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i *owpp = owp; if (opp != NULL) *opp = op; - if (retp != NULL) { - if (nfhp != NULL dp != NULL nop == NULL) - /* new local open on delegation */ - *retp = NFSCLOPEN_SETCRED; - else - *retp = NFSCLOPEN_OK; - } - - /* -* Now, check the mode on the open and return the appropriate -* value. -*/ - if (op != NULL (amode ~(op-nfso_mode))) { - op-nfso_mode |= amode; - if (retp != NULL dp == NULL) - *retp = NFSCLOPEN_DOOPEN; - } return (0); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268273 - head/sys/fs/nfsserver
Author: rmacklem Date: Fri Jul 4 22:47:07 2014 New Revision: 268273 URL: http://svnweb.freebsd.org/changeset/base/268273 Log: The new NFSv3 server did not generate directory postop attributes for the reply to ReaddirPlus when the server failed within the loop that calls VFS_VGET(). This failure is most likely an error return from VFS_VGET() caused by a bogus d_fileno that was truncated to 32bits. This patch fixes the server so that it will return directory postop attributes for the failure. It does not fix the underlying issue caused by d_fileno being uint32_t when a file system like ZFS generates a fileno that is greater than 32bits. Reported by: jpaetzel Reviewed by: jpaetzel MFC after:1 month Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c == --- head/sys/fs/nfsserver/nfs_nfsdport.cFri Jul 4 22:39:39 2014 (r268272) +++ head/sys/fs/nfsserver/nfs_nfsdport.cFri Jul 4 22:47:07 2014 (r268273) @@ -2264,9 +2264,11 @@ again: if (dirlen cnt || nd-nd_repstat) { if (!nd-nd_repstat entrycnt == 0) nd-nd_repstat = NFSERR_TOOSMALL; - if (nd-nd_repstat) + if (nd-nd_repstat) { newnfs_trimtrailing(nd, mb0, bpos0); - else + if (nd-nd_flag ND_NFSV3) + nfsrv_postopattr(nd, getret, at); + } else newnfs_trimtrailing(nd, mb1, bpos1); eofflag = 0; } else if (cpos cend) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268115 - in head/sys: conf fs/nfs fs/nfsclient fs/nfsserver modules/krpc rpc
Author: rmacklem Date: Tue Jul 1 20:47:16 2014 New Revision: 268115 URL: http://svnweb.freebsd.org/changeset/base/268115 Log: Merge the NFSv4.1 server code in projects/nfsv4.1-server over into head. The code is not believed to have any effect on the semantics of non-NFSv4.1 server behaviour. It is a rather large merge, but I am hoping that there will not be any regressions for the NFS server. MFC after:1 month Added: head/sys/rpc/clnt_bck.c (contents, props changed) Modified: head/sys/conf/files head/sys/fs/nfs/nfs.h head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h head/sys/fs/nfs/nfsclstate.h head/sys/fs/nfs/nfsdport.h head/sys/fs/nfs/nfsport.h head/sys/fs/nfs/nfsproto.h head/sys/fs/nfs/nfsrvstate.h head/sys/fs/nfsclient/nfs_clstate.c head/sys/fs/nfsserver/nfs_nfsdcache.c head/sys/fs/nfsserver/nfs_nfsdkrpc.c head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c head/sys/fs/nfsserver/nfs_nfsdsocket.c head/sys/fs/nfsserver/nfs_nfsdstate.c head/sys/fs/nfsserver/nfs_nfsdsubs.c head/sys/modules/krpc/Makefile head/sys/rpc/krpc.h head/sys/rpc/svc.h head/sys/rpc/svc_vc.c Modified: head/sys/conf/files == --- head/sys/conf/files Tue Jul 1 20:00:35 2014(r268114) +++ head/sys/conf/files Tue Jul 1 20:47:16 2014(r268115) @@ -3810,6 +3810,7 @@ pci/viapm.c optional viapm pci rpc/auth_none.coptional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/auth_unix.coptional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/authunix_prot.coptional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +rpc/clnt_bck.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/clnt_dg.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd Modified: head/sys/fs/nfs/nfs.h == --- head/sys/fs/nfs/nfs.h Tue Jul 1 20:00:35 2014(r268114) +++ head/sys/fs/nfs/nfs.h Tue Jul 1 20:47:16 2014(r268115) @@ -50,7 +50,8 @@ #defineNFS_MAXREXMIT 100 /* Stop counting after this many */ #defineNFSV4_CALLBACKTIMEO (2 * NFS_HZ) /* Timeout in ticks */ #defineNFSV4_CALLBACKRETRY 5 /* Number of retries before failure */ -#defineNFSV4_CBSLOTS 8 /* Number of slots for session */ +#defineNFSV4_SLOTS 64 /* Number of slots, fore channel */ +#defineNFSV4_CBSLOTS 8 /* Number of slots, back channel */ #defineNFSV4_CBRETRYCNT 4 /* # of CBRecall retries upon err */ #defineNFSV4_UPCALLTIMEO (15 * NFS_HZ) /* Timeout in ticks for upcalls */ /* to gssd or nfsuserd */ @@ -91,6 +92,9 @@ #ifndef NFSLOCKHASHSIZE #defineNFSLOCKHASHSIZE 20 /* Size of server nfslock hash table */ #endif +#ifndef NFSSESSIONHASHSIZE +#defineNFSSESSIONHASHSIZE 20 /* Size of server session hash table */ +#endif #defineNFSSTATEHASHSIZE10 /* Size of server stateid hash table */ #ifndef NFSUSERHASHSIZE #defineNFSUSERHASHSIZE 30 /* Size of user id hash table */ @@ -276,6 +280,8 @@ struct nfsreferral { #defineLCL_GSSINTEGRITY0x2000 #defineLCL_GSSPRIVACY 0x4000 #defineLCL_ADMINREVOKED0x8000 +#defineLCL_RECLAIMCOMPLETE 0x0001 +#defineLCL_NFSV41 0x0002 #defineLCL_GSS LCL_KERBV /* Or of all mechs */ @@ -318,6 +324,11 @@ struct nfsreferral { #defineNFSLCK_SETATTR 0x0200 #defineNFSLCK_DELEGPURGE 0x0400 #defineNFSLCK_DELEGRETURN 0x0800 +#defineNFSLCK_WANTWDELEG 0x1000 +#defineNFSLCK_WANTRDELEG 0x2000 +#defineNFSLCK_WANTNODELEG 0x4000 +#defineNFSLCK_WANTBITS \ +(NFSLCK_WANTWDELEG | NFSLCK_WANTRDELEG | NFSLCK_WANTNODELEG) /* And bits for nid_flag */ #defineNFSID_INITIALIZE0x0001 @@ -341,68 +352,120 @@ struct nfsreferral { * THE MACROS MUST BE MANUALLY MODIFIED IF NFSATTRBIT_MAXWORDS CHANGES!! * It is (NFSATTRBIT_MAX + 31) / 32. */ -#defineNFSATTRBIT_MAXWORDS 2 +#defineNFSATTRBIT_MAXWORDS 3 typedef struct { u_int32_t bits[NFSATTRBIT_MAXWORDS]; } nfsattrbit_t; -#defineNFSZERO_ATTRBIT(b) do {
svn commit: r268118 - head/sys/sys
Author: rmacklem Date: Tue Jul 1 21:12:48 2014 New Revision: 268118 URL: http://svnweb.freebsd.org/changeset/base/268118 Log: Bump __FreeBSD_version since r268115 changed the internal interfaces used between the NFS related modules, including the krpc. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hTue Jul 1 21:04:40 2014(r268117) +++ head/sys/sys/param.hTue Jul 1 21:12:48 2014(r268118) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100025 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100026 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268127 - head
Author: rmacklem Date: Tue Jul 1 22:32:11 2014 New Revision: 268127 URL: http://svnweb.freebsd.org/changeset/base/268127 Log: Add an entry for r268115 to UPDATING. Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Tue Jul 1 22:31:09 2014(r268126) +++ head/UPDATING Tue Jul 1 22:32:11 2014(r268127) @@ -31,6 +31,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run ln -s 'abort:false,junk:false' /etc/malloc.conf.) +20140701: + Commit r268115 has added NFSv4.1 server support, merged from + projects/nfsv4.1-server. Since this includes changes to the + internal interfaces between the NFS related modules, a full + build of the kernel and modules will be necessary. + __FreeBSD_version has been bumped. + 20140629: The WITHOUT_VT_SUPPORT kernel config knob has been renamed WITHOUT_VT. (The other _SUPPORT knobs have a consistent meaning ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r268008 - head/sys/fs/nfsclient
Author: rmacklem Date: Sat Jun 28 21:47:15 2014 New Revision: 268008 URL: http://svnweb.freebsd.org/changeset/base/268008 Log: There might be a potential race condition for the NFSv4 client when a newly created file has another open done on it that update the open mode. This patch moves the code that updates the open mode up into the block where the mutex is held to ensure this cannot happen. No bug caused by this potential race has been observed, but this fix is a safety belt to ensure it cannot happen. MFC after:2 weeks Modified: head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfsclient/nfs_clstate.c == --- head/sys/fs/nfsclient/nfs_clstate.c Sat Jun 28 19:59:12 2014 (r268007) +++ head/sys/fs/nfsclient/nfs_clstate.c Sat Jun 28 21:47:15 2014 (r268008) @@ -281,6 +281,23 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i newonep); /* +* Now, check the mode on the open and return the appropriate +* value. +*/ + if (retp != NULL) { + if (nfhp != NULL dp != NULL nop == NULL) + /* new local open on delegation */ + *retp = NFSCLOPEN_SETCRED; + else + *retp = NFSCLOPEN_OK; + } + if (op != NULL (amode ~(op-nfso_mode))) { + op-nfso_mode |= amode; + if (retp != NULL dp == NULL) + *retp = NFSCLOPEN_DOOPEN; + } + + /* * Serialize modifications to the open owner for multiple threads * within the same process using a read/write sleep lock. */ @@ -295,23 +312,6 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i *owpp = owp; if (opp != NULL) *opp = op; - if (retp != NULL) { - if (nfhp != NULL dp != NULL nop == NULL) - /* new local open on delegation */ - *retp = NFSCLOPEN_SETCRED; - else - *retp = NFSCLOPEN_OK; - } - - /* -* Now, check the mode on the open and return the appropriate -* value. -*/ - if (op != NULL (amode ~(op-nfso_mode))) { - op-nfso_mode |= amode; - if (retp != NULL dp == NULL) - *retp = NFSCLOPEN_DOOPEN; - } return (0); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r267343 - stable/10/sys/fs/nfsserver
Author: rmacklem Date: Tue Jun 10 22:36:01 2014 New Revision: 267343 URL: http://svnweb.freebsd.org/changeset/base/267343 Log: MFC: r267191 The new NFS server would not allow a hard link to be created to a symlink. This restriction (which was inherited from OpenBSD) is not required by the NFS RFCs. Since this is allowed by the old NFS server, it is a POLA violation to not allow it. This patch modifies the new NFS server to allow this. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Tue Jun 10 21:40:43 2014 (r267342) +++ stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Tue Jun 10 22:36:01 2014 (r267343) @@ -1620,13 +1620,6 @@ nfsrvd_link(struct nfsrv_descript *nd, i nd-nd_repstat = NFSERR_INVAL; if (tovp) vrele(tovp); - } else if (vnode_vtype(vp) == VLNK) { - if (nd-nd_flag ND_NFSV2) - nd-nd_repstat = NFSERR_INVAL; - else - nd-nd_repstat = NFSERR_NOTSUPP; - if (tovp) - vrele(tovp); } if (!nd-nd_repstat) { if (nd-nd_flag ND_NFSV4) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r267268 - stable/9/sys/fs/nfsserver
Author: rmacklem Date: Mon Jun 9 13:52:10 2014 New Revision: 267268 URL: http://svnweb.freebsd.org/changeset/base/267268 Log: MFC: r267191 The new NFS server would not allow a hard link to be created to a symlink. This restriction (which was inherited from OpenBSD) is not required by the NFS RFCs. Since this is allowed by the old NFS server, it is a POLA violation to not allow it. This patch modifies the new NFS server to allow this. Reported by: jhb Reviewed by: jhb Approved by: re (kib) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdserv.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdserv.cMon Jun 9 13:04:58 2014 (r267267) +++ stable/9/sys/fs/nfsserver/nfs_nfsdserv.cMon Jun 9 13:52:10 2014 (r267268) @@ -1620,13 +1620,6 @@ nfsrvd_link(struct nfsrv_descript *nd, i nd-nd_repstat = NFSERR_INVAL; if (tovp) vrele(tovp); - } else if (vnode_vtype(vp) == VLNK) { - if (nd-nd_flag ND_NFSV2) - nd-nd_repstat = NFSERR_INVAL; - else - nd-nd_repstat = NFSERR_NOTSUPP; - if (tovp) - vrele(tovp); } if (!nd-nd_repstat) { if (nd-nd_flag ND_NFSV4) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r267191 - head/sys/fs/nfsserver
Author: rmacklem Date: Fri Jun 6 21:38:49 2014 New Revision: 267191 URL: http://svnweb.freebsd.org/changeset/base/267191 Log: The new NFS server would not allow a hard link to be created to a symlink. This restriction (which was inherited from OpenBSD) is not required by the NFS RFCs. Since this is allowed by the old NFS server, it is a POLA violation to not allow it. This patch modifies the new NFS server to allow this. Reported by: jhb Reviewed by: jhb MFC after:3 days Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c == --- head/sys/fs/nfsserver/nfs_nfsdserv.cFri Jun 6 21:38:34 2014 (r267190) +++ head/sys/fs/nfsserver/nfs_nfsdserv.cFri Jun 6 21:38:49 2014 (r267191) @@ -1620,13 +1620,6 @@ nfsrvd_link(struct nfsrv_descript *nd, i nd-nd_repstat = NFSERR_INVAL; if (tovp) vrele(tovp); - } else if (vnode_vtype(vp) == VLNK) { - if (nd-nd_flag ND_NFSV2) - nd-nd_repstat = NFSERR_INVAL; - else - nd-nd_repstat = NFSERR_NOTSUPP; - if (tovp) - vrele(tovp); } if (!nd-nd_repstat) { if (nd-nd_flag ND_NFSV4) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r266447 - stable/9/sys/fs/nfsserver
Author: rmacklem Date: Mon May 19 16:15:27 2014 New Revision: 266447 URL: http://svnweb.freebsd.org/changeset/base/266447 Log: MFC: r227809 This patch enables the new/default NFS server's use of shared vnode locking for read, readdir, readlink, getattr and access. It is hoped that this will improve server performance for these operations, since they will no longer be serialized for a given file/vnode. PR: 167048 Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdport.cMon May 19 16:13:40 2014 (r266446) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cMon May 19 16:15:27 2014 (r266447) @@ -2693,7 +2693,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_ if (VFS_NEEDSGIANT(mp)) error = ESTALE; else - error = VFS_FHTOVP(mp, fhp-fh_fid, LK_EXCLUSIVE, vpp); + error = VFS_FHTOVP(mp, fhp-fh_fid, lktype, vpp); if (error != 0) /* Make sure the server replies ESTALE to the client. */ error = ESTALE; @@ -2714,14 +2714,6 @@ nfsvno_fhtovp(struct mount *mp, fhandle_ exp-nes_secflavors[i] = secflavors[i]; } } - if (error == 0 lktype == LK_SHARED) - /* -* It would be much better to pass lktype to VFS_FHTOVP(), -* but this will have to do until VFS_FHTOVP() has a lock -* type argument like VFS_VGET(). -*/ - NFSVOPLOCK(*vpp, LK_DOWNGRADE | LK_RETRY); - NFSEXITCODE(error); return (error); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265667 - in stable/10/sys: fs/nfsserver nfsserver
Author: rmacklem Date: Thu May 8 11:59:23 2014 New Revision: 265667 URL: http://svnweb.freebsd.org/changeset/base/265667 Log: MFC: r264888 The PR reported that the old NFS server did not set uio_td == NULL for the VOP_READ() call. This patch fixes both the old and new server for this case. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c stable/10/sys/nfsserver/nfs_serv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu May 8 11:56:06 2014 (r265666) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu May 8 11:59:23 2014 (r265667) @@ -673,6 +673,7 @@ nfsvno_read(struct vnode *vp, off_t off, uiop-uio_resid = len; uiop-uio_rw = UIO_READ; uiop-uio_segflg = UIO_SYSSPACE; + uiop-uio_td = NULL; nh = nfsrv_sequential_heuristic(uiop, vp); ioflag |= nh-nh_seqcount IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); Modified: stable/10/sys/nfsserver/nfs_serv.c == --- stable/10/sys/nfsserver/nfs_serv.c Thu May 8 11:56:06 2014 (r265666) +++ stable/10/sys/nfsserver/nfs_serv.c Thu May 8 11:59:23 2014 (r265667) @@ -911,6 +911,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, uiop-uio_resid = len; uiop-uio_rw = UIO_READ; uiop-uio_segflg = UIO_SYSSPACE; + uiop-uio_td = NULL; nh = nfsrv_sequential_heuristic(uiop, vp); ioflag |= nh-nh_seqcount IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265714 - in stable/10/sys/fs: nfs nfsserver
Author: rmacklem Date: Thu May 8 20:52:25 2014 New Revision: 265714 URL: http://svnweb.freebsd.org/changeset/base/265714 Log: MFC: r265252 The new draft specification for NFSv4.0 specifies that a server should either accept owner and owner_group strings that are just the digits of the uid/gid or return NFS4ERR_BADOWNER. This patch adds a sysctl vfs.nfsd.enable_stringtouid, which can be set to enable the server w.r.t. accepting numeric string. It also ensures that NFS4ERR_BADOWNER is returned if numeric uid/gid strings are not enabled. This fixes the server for recent Linux nfs4 clients that use numeric uid/gid strings by default. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c stable/10/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c == --- stable/10/sys/fs/nfs/nfs_commonsubs.c Thu May 8 20:47:54 2014 (r265713) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Thu May 8 20:52:25 2014 (r265714) @@ -65,6 +65,7 @@ uid_t nfsrv_defaultuid; gid_t nfsrv_defaultgid; int nfsrv_lease = NFSRV_LEASE; int ncl_mbuf_mlen = MLEN; +int nfsd_enable_stringtouid = 0; NFSNAMEIDMUTEX; NFSSOCKMUTEX; @@ -2640,9 +2641,14 @@ nfsv4_strtouid(struct nfsrv_descript *nd /* If a string of digits and an AUTH_SYS mount, just convert it. */ str0 = str; tuid = (uid_t)strtoul(str0, endstr, 10); - if ((endstr - str0) == len - (nd-nd_flag (ND_KERBV | ND_NFSCL)) == ND_NFSCL) { - *uidp = tuid; + if ((endstr - str0) == len) { + /* A numeric string. */ + if ((nd-nd_flag ND_KERBV) == 0 + ((nd-nd_flag ND_NFSCL) != 0 || + nfsd_enable_stringtouid != 0)) + *uidp = tuid; + else + error = NFSERR_BADOWNER; goto out; } /* @@ -2845,9 +2851,14 @@ nfsv4_strtogid(struct nfsrv_descript *nd /* If a string of digits and an AUTH_SYS mount, just convert it. */ str0 = str; tgid = (gid_t)strtoul(str0, endstr, 10); - if ((endstr - str0) == len - (nd-nd_flag (ND_KERBV | ND_NFSCL)) == ND_NFSCL) { - *gidp = tgid; + if ((endstr - str0) == len) { + /* A numeric string. */ + if ((nd-nd_flag ND_KERBV) == 0 + ((nd-nd_flag ND_NFSCL) != 0 || + nfsd_enable_stringtouid != 0)) + *gidp = tgid; + else + error = NFSERR_BADOWNER; goto out; } /* Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu May 8 20:47:54 2014 (r265713) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Thu May 8 20:52:25 2014 (r265714) @@ -80,6 +80,7 @@ static int nfs_commit_blks; static int nfs_commit_miss; extern int nfsrv_issuedelegs; extern int nfsrv_dolocallocks; +extern int nfsd_enable_stringtouid; SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, New NFS server); SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW, @@ -92,6 +93,8 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_de nfsrv_issuedelegs, 0, Enable nfsd to issue delegations); SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW, nfsrv_dolocallocks, 0, Enable nfsd to acquire local locks on files); +SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_stringtouid, CTLFLAG_RW, +nfsd_enable_stringtouid, 0, Enable nfsd to accept numeric owner_names); #defineMAX_REORDERED_RPC 16 #defineNUM_HEURISTIC 1031 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265721 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Fri May 9 00:19:08 2014 New Revision: 265721 URL: http://svnweb.freebsd.org/changeset/base/265721 Log: MFC: r264842 Modify the NFSv4 client's Pathconf RPC (actually a Getattr Op.) so that it only does the RPC for names that are answered by the RPC. Doing the RPC for other names is harmless, but unnecessary. Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c == --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Thu May 8 23:54:15 2014 (r265720) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Fri May 9 00:19:08 2014 (r265721) @@ -3405,12 +3405,15 @@ nfs_pathconf(struct vop_pathconf_args *a struct thread *td = curthread; int attrflag, error; - if (NFS_ISV4(vp) || (NFS_ISV3(vp) (ap-a_name == _PC_LINK_MAX || + if ((NFS_ISV34(vp) (ap-a_name == _PC_LINK_MAX || ap-a_name == _PC_NAME_MAX || ap-a_name == _PC_CHOWN_RESTRICTED || - ap-a_name == _PC_NO_TRUNC))) { + ap-a_name == _PC_NO_TRUNC)) || + (NFS_ISV4(vp) ap-a_name == _PC_ACL_NFS4)) { /* * Since only the above 4 a_names are returned by the NFSv3 * Pathconf RPC, there is no point in doing it for others. +* For NFSv4, the Pathconf RPC (actually a Getattr Op.) can +* be used for _PC_NFS4_ACL as well. */ error = nfsrpc_pathconf(vp, pc, td-td_ucred, td, nfsva, attrflag, NULL); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265722 - stable/9/sys/fs/nfsserver
Author: rmacklem Date: Fri May 9 00:24:11 2014 New Revision: 265722 URL: http://svnweb.freebsd.org/changeset/base/265722 Log: MFC: r264845 Remove an unnecessary level of indirection for an argument. This simplifies the code and should avoid the clang sparc port from generating an abort() call. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Fri May 9 00:19:08 2014 (r265721) +++ stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Fri May 9 00:24:11 2014 (r265722) @@ -79,7 +79,7 @@ static int nfsrv_getstate(struct nfsclie static void nfsrv_getowner(struct nfsstatehead *hp, struct nfsstate *new_stp, struct nfsstate **stpp); static int nfsrv_getlockfh(vnode_t vp, u_short flags, -struct nfslockfile **new_lfpp, fhandle_t *nfhp, NFSPROC_T *p); +struct nfslockfile *new_lfp, fhandle_t *nfhp, NFSPROC_T *p); static int nfsrv_getlockfile(u_short flags, struct nfslockfile **new_lfpp, struct nfslockfile **lfpp, fhandle_t *nfhp, int lockit); static void nfsrv_insertlock(struct nfslock *new_lop, @@ -1985,7 +1985,7 @@ tryagain: MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile), M_NFSDLOCKFILE, M_WAITOK); if (vp) - getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, + getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, NULL, p); NFSLOCKSTATE(); /* @@ -2235,7 +2235,7 @@ tryagain: M_NFSDSTATE, M_WAITOK); MALLOC(new_deleg, struct nfsstate *, sizeof (struct nfsstate), M_NFSDSTATE, M_WAITOK); - getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, + getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, NULL, p); NFSLOCKSTATE(); /* @@ -3142,11 +3142,10 @@ out: * Get the file handle for a lock structure. */ static int -nfsrv_getlockfh(vnode_t vp, u_short flags, -struct nfslockfile **new_lfpp, fhandle_t *nfhp, NFSPROC_T *p) +nfsrv_getlockfh(vnode_t vp, u_short flags, struct nfslockfile *new_lfp, +fhandle_t *nfhp, NFSPROC_T *p) { fhandle_t *fhp = NULL; - struct nfslockfile *new_lfp; int error; /* @@ -3154,7 +3153,7 @@ nfsrv_getlockfh(vnode_t vp, u_short flag * a fhandle_t on the stack. */ if (flags NFSLCK_OPEN) { - new_lfp = *new_lfpp; + KASSERT(new_lfp != NULL, (nfsrv_getlockfh: new_lfp NULL)); fhp = new_lfp-lf_fh; } else if (nfhp) { fhp = nfhp; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265723 - in stable/9/sys: fs/nfsserver nfsserver
Author: rmacklem Date: Fri May 9 00:28:07 2014 New Revision: 265723 URL: http://svnweb.freebsd.org/changeset/base/265723 Log: MFC: r264888 The PR reported that the old NFS server did not set uio_td == NULL for the VOP_READ() call. This patch fixes both the old and new server for this case. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c stable/9/sys/nfsserver/nfs_serv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May 9 00:24:11 2014 (r265722) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May 9 00:28:07 2014 (r265723) @@ -674,6 +674,7 @@ nfsvno_read(struct vnode *vp, off_t off, uiop-uio_resid = len; uiop-uio_rw = UIO_READ; uiop-uio_segflg = UIO_SYSSPACE; + uiop-uio_td = NULL; nh = nfsrv_sequential_heuristic(uiop, vp); ioflag |= nh-nh_seqcount IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); Modified: stable/9/sys/nfsserver/nfs_serv.c == --- stable/9/sys/nfsserver/nfs_serv.c Fri May 9 00:24:11 2014 (r265722) +++ stable/9/sys/nfsserver/nfs_serv.c Fri May 9 00:28:07 2014 (r265723) @@ -965,6 +965,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, uiop-uio_resid = len; uiop-uio_rw = UIO_READ; uiop-uio_segflg = UIO_SYSSPACE; + uiop-uio_td = NULL; nh = nfsrv_sequential_heuristic(uiop, vp); ioflag |= nh-nh_seqcount IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265724 - in stable/9/sys/fs: nfs nfsserver
Author: rmacklem Date: Fri May 9 00:34:29 2014 New Revision: 265724 URL: http://svnweb.freebsd.org/changeset/base/265724 Log: MFC: r265252 The new draft specification for NFSv4.0 specifies that a server should either accept owner and owner_group strings that are just the digits of the uid/gid or return NFS4ERR_BADOWNER. This patch adds a sysctl vfs.nfsd.enable_stringtouid, which can be set to enable the server w.r.t. accepting numeric string. It also ensures that NFS4ERR_BADOWNER is returned if numeric uid/gid strings are not enabled. This fixes the server for recent Linux nfs4 clients that use numeric uid/gid strings by default. Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c stable/9/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c == --- stable/9/sys/fs/nfs/nfs_commonsubs.cFri May 9 00:28:07 2014 (r265723) +++ stable/9/sys/fs/nfs/nfs_commonsubs.cFri May 9 00:34:29 2014 (r265724) @@ -65,6 +65,7 @@ uid_t nfsrv_defaultuid; gid_t nfsrv_defaultgid; int nfsrv_lease = NFSRV_LEASE; int ncl_mbuf_mlen = MLEN; +int nfsd_enable_stringtouid = 0; NFSNAMEIDMUTEX; NFSSOCKMUTEX; @@ -2621,9 +2622,14 @@ nfsv4_strtouid(struct nfsrv_descript *nd /* If a string of digits and an AUTH_SYS mount, just convert it. */ str0 = str; tuid = (uid_t)strtoul(str0, endstr, 10); - if ((endstr - str0) == len - (nd-nd_flag (ND_KERBV | ND_NFSCL)) == ND_NFSCL) { - *uidp = tuid; + if ((endstr - str0) == len) { + /* A numeric string. */ + if ((nd-nd_flag ND_KERBV) == 0 + ((nd-nd_flag ND_NFSCL) != 0 || + nfsd_enable_stringtouid != 0)) + *uidp = tuid; + else + error = NFSERR_BADOWNER; goto out; } /* @@ -2826,9 +2832,14 @@ nfsv4_strtogid(struct nfsrv_descript *nd /* If a string of digits and an AUTH_SYS mount, just convert it. */ str0 = str; tgid = (gid_t)strtoul(str0, endstr, 10); - if ((endstr - str0) == len - (nd-nd_flag (ND_KERBV | ND_NFSCL)) == ND_NFSCL) { - *gidp = tgid; + if ((endstr - str0) == len) { + /* A numeric string. */ + if ((nd-nd_flag ND_KERBV) == 0 + ((nd-nd_flag ND_NFSCL) != 0 || + nfsd_enable_stringtouid != 0)) + *gidp = tgid; + else + error = NFSERR_BADOWNER; goto out; } /* Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c == --- stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May 9 00:28:07 2014 (r265723) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May 9 00:34:29 2014 (r265724) @@ -80,6 +80,7 @@ static int nfs_commit_blks; static int nfs_commit_miss; extern int nfsrv_issuedelegs; extern int nfsrv_dolocallocks; +extern int nfsd_enable_stringtouid; SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, New NFS server); SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW, @@ -92,6 +93,8 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_de nfsrv_issuedelegs, 0, Enable nfsd to issue delegations); SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW, nfsrv_dolocallocks, 0, Enable nfsd to acquire local locks on files); +SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_stringtouid, CTLFLAG_RW, +nfsd_enable_stringtouid, 0, Enable nfsd to accept numeric owner_names); #defineMAX_REORDERED_RPC 16 #defineNUM_HEURISTIC 1031 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265620 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Wed May 7 22:27:03 2014 New Revision: 265620 URL: http://svnweb.freebsd.org/changeset/base/265620 Log: MFC: r264842 Modify the NFSv4 client's Pathconf RPC (actually a Getattr Op.) so that it only does the RPC for names that are answered by the RPC. Doing the RPC for other names is harmless, but unnecessary. Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c == --- stable/10/sys/fs/nfsclient/nfs_clvnops.cWed May 7 22:17:16 2014 (r265619) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.cWed May 7 22:27:03 2014 (r265620) @@ -3430,12 +3430,15 @@ nfs_pathconf(struct vop_pathconf_args *a struct thread *td = curthread; int attrflag, error; - if (NFS_ISV4(vp) || (NFS_ISV3(vp) (ap-a_name == _PC_LINK_MAX || + if ((NFS_ISV34(vp) (ap-a_name == _PC_LINK_MAX || ap-a_name == _PC_NAME_MAX || ap-a_name == _PC_CHOWN_RESTRICTED || - ap-a_name == _PC_NO_TRUNC))) { + ap-a_name == _PC_NO_TRUNC)) || + (NFS_ISV4(vp) ap-a_name == _PC_ACL_NFS4)) { /* * Since only the above 4 a_names are returned by the NFSv3 * Pathconf RPC, there is no point in doing it for others. +* For NFSv4, the Pathconf RPC (actually a Getattr Op.) can +* be used for _PC_NFS4_ACL as well. */ error = nfsrpc_pathconf(vp, pc, td-td_ucred, td, nfsva, attrflag, NULL); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265621 - stable/10/sys/fs/nfsserver
Author: rmacklem Date: Wed May 7 22:33:36 2014 New Revision: 265621 URL: http://svnweb.freebsd.org/changeset/base/265621 Log: MFC: r264845 Remove an unnecessary level of indirection for an argument. This simplifies the code and should avoid the clang sparc port from generating an abort() call. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c == --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Wed May 7 22:27:03 2014 (r265620) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Wed May 7 22:33:36 2014 (r265621) @@ -79,7 +79,7 @@ static int nfsrv_getstate(struct nfsclie static void nfsrv_getowner(struct nfsstatehead *hp, struct nfsstate *new_stp, struct nfsstate **stpp); static int nfsrv_getlockfh(vnode_t vp, u_short flags, -struct nfslockfile **new_lfpp, fhandle_t *nfhp, NFSPROC_T *p); +struct nfslockfile *new_lfp, fhandle_t *nfhp, NFSPROC_T *p); static int nfsrv_getlockfile(u_short flags, struct nfslockfile **new_lfpp, struct nfslockfile **lfpp, fhandle_t *nfhp, int lockit); static void nfsrv_insertlock(struct nfslock *new_lop, @@ -1985,7 +1985,7 @@ tryagain: MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile), M_NFSDLOCKFILE, M_WAITOK); if (vp) - getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, + getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, NULL, p); NFSLOCKSTATE(); /* @@ -2235,7 +2235,7 @@ tryagain: M_NFSDSTATE, M_WAITOK); MALLOC(new_deleg, struct nfsstate *, sizeof (struct nfsstate), M_NFSDSTATE, M_WAITOK); - getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, + getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp, NULL, p); NFSLOCKSTATE(); /* @@ -3142,11 +3142,10 @@ out: * Get the file handle for a lock structure. */ static int -nfsrv_getlockfh(vnode_t vp, u_short flags, -struct nfslockfile **new_lfpp, fhandle_t *nfhp, NFSPROC_T *p) +nfsrv_getlockfh(vnode_t vp, u_short flags, struct nfslockfile *new_lfp, +fhandle_t *nfhp, NFSPROC_T *p) { fhandle_t *fhp = NULL; - struct nfslockfile *new_lfp; int error; /* @@ -3154,7 +3153,7 @@ nfsrv_getlockfh(vnode_t vp, u_short flag * a fhandle_t on the stack. */ if (flags NFSLCK_OPEN) { - new_lfp = *new_lfpp; + KASSERT(new_lfp != NULL, (nfsrv_getlockfh: new_lfp NULL)); fhp = new_lfp-lf_fh; } else if (nfhp) { fhp = nfhp; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265434 - in stable/10/sys/fs: nfs nfsclient
Author: rmacklem Date: Tue May 6 12:15:05 2014 New Revision: 265434 URL: http://svnweb.freebsd.org/changeset/base/265434 Log: MFC: r264672 Modify the Lookup RPC for NFSv4 so that it acquires directory attributes. This allows the client to cache directory names when they are looked up, reducing the Lookup RPC count by about 40% for software builds. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c stable/10/sys/fs/nfsclient/nfs_clcomsubs.c stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c == --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue May 6 11:12:56 2014 (r265433) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Tue May 6 12:15:05 2014 (r265434) @@ -101,8 +101,8 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_ { 0, 1, 0, 0, LK_EXCLUSIVE, 1 },/* Lock */ { 0, 1, 0, 0, LK_EXCLUSIVE, 1 },/* LockT */ { 0, 1, 0, 0, LK_EXCLUSIVE, 1 },/* LockU */ - { 1, 1, 0, 0, LK_EXCLUSIVE, 1 },/* Lookup */ - { 1, 1, 0, 0, LK_EXCLUSIVE, 1 },/* Lookupp */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1 },/* Lookup */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1 },/* Lookupp */ { 0, 1, 0, 0, LK_EXCLUSIVE, 1 },/* NVerify */ { 1, 1, 0, 1, LK_EXCLUSIVE, 1 },/* Open */ { 1, 1, 0, 0, LK_EXCLUSIVE, 1 },/* OpenAttr */ Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c == --- stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue May 6 11:12:56 2014 (r265433) +++ stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue May 6 12:15:05 2014 (r265434) @@ -219,9 +219,18 @@ nfscl_reqstart(struct nfsrv_descript *nd procnum != NFSPROC_COMMITDS) { NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); - NFSWCCATTR_ATTRBIT(attrbits); + /* +* For Lookup Ops, we want all the directory +* attributes, so we can load the name cache. +*/ + if (procnum == NFSPROC_LOOKUP || + procnum == NFSPROC_LOOKUPP) + NFSGETATTR_ATTRBIT(attrbits); + else { + NFSWCCATTR_ATTRBIT(attrbits); + nd-nd_flag |= ND_V4WCCATTR; + } (void) nfsrv_putattrbit(nd, attrbits); - nd-nd_flag |= ND_V4WCCATTR; } } if (procnum != NFSPROC_RENEW || Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue May 6 11:12:56 2014 (r265433) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue May 6 12:15:05 2014 (r265434) @@ -1238,14 +1238,23 @@ nfsrpc_lookup(vnode_t dvp, char *name, i } if (nd-nd_flag ND_NFSV3) error = nfscl_postop_attr(nd, dnap, dattrflagp, stuff); + else if ((nd-nd_flag (ND_NFSV4 | ND_NOMOREDATA)) == + ND_NFSV4) { + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error == 0) + *dattrflagp = 1; + } goto nfsmout; } if ((nd-nd_flag (ND_NFSV4 | ND_NOMOREDATA)) == ND_NFSV4) { - NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - if (*(tl + 1)) { - nd-nd_flag |= ND_NOMOREDATA; + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error != 0) goto nfsmout; - } + *dattrflagp = 1; + /* Skip over the Lookup and GetFH operation status values. */ + NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); } error = nfsm_getfh(nd, nfhpp); if (error) @@ -2702,14 +2711,6 @@ nfsrpc_readdir(vnode_t vp, struct uio *u * Joy, oh joy. For V4 we get to hand craft '.' and '..'. */ if (uiop-uio_offset == 0) { -#if defined(__FreeBSD_version) __FreeBSD_version = 80 - error = VOP_GETATTR(vp, nfsva.na_vattr, cred); -#else -
svn commit: r265466 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Tue May 6 21:47:43 2014 New Revision: 265466 URL: http://svnweb.freebsd.org/changeset/base/265466 Log: MFC: r264681 Modify the NFSv4 client open/create RPC so that it acquires post-open/create directory attributes. This allows the RPC to name cache the newly created file and reduces the lookup RPC count by about 10% for software builds. Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c == --- stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue May 6 21:34:01 2014 (r265465) +++ stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue May 6 21:47:43 2014 (r265466) @@ -66,7 +66,7 @@ static struct { { NFSV4OP_READLINK, 2, Readlink, 8, }, { NFSV4OP_READ, 1, Read, 4, }, { NFSV4OP_WRITE, 2, Write, 5, }, - { NFSV4OP_OPEN, 3, Open, 4, }, + { NFSV4OP_OPEN, 5, Open, 4, }, { NFSV4OP_CREATE, 3, Create, 6, }, { NFSV4OP_CREATE, 1, Create, 6, }, { NFSV4OP_CREATE, 3, Create, 6, }, Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue May 6 21:34:01 2014 (r265465) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue May 6 21:47:43 2014 (r265466) @@ -1956,6 +1956,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, struct nfsmount *nmp; nmp = VFSTONFS(dvp-v_mount); + np = VTONFS(dvp); *unlockedp = 0; *nfhpp = NULL; *dpp = NULL; @@ -2005,17 +2006,22 @@ nfsrpc_createv4(vnode_t dvp, char *name, NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OPEN_CLAIMNULL); (void) nfsm_strtom(nd, name, namelen); + /* Get the new file's handle and attributes. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OP_GETFH); *tl = txdr_unsigned(NFSV4OP_GETATTR); NFSGETATTR_ATTRBIT(attrbits); (void) nfsrv_putattrbit(nd, attrbits); + /* Get the directory's post-op attributes. */ + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_PUTFH); + (void) nfsm_fhtom(nd, np-n_fhp-nfh_fh, np-n_fhp-nfh_len, 0); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + (void) nfsrv_putattrbit(nd, attrbits); error = nfscl_request(nd, dvp, p, cred, dstuff); if (error) return (error); - error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff); - if (error) - goto nfsmout; NFSCL_INCRSEQID(owp-nfsow_seqid, nd); if (nd-nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + @@ -2087,6 +2093,13 @@ nfsrpc_createv4(vnode_t dvp, char *name, error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp); if (error) goto nfsmout; + /* Get rid of the PutFH and Getattr status values. */ + NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error) + goto nfsmout; + *dattrflagp = 1; if (dp != NULL *attrflagp) { dp-nfsdl_change = nnap-na_filerev; dp-nfsdl_modtime = nnap-na_mtime; @@ -2130,7 +2143,6 @@ nfsrpc_createv4(vnode_t dvp, char *name, if ((rflags NFSV4OPEN_RESULTCONFIRM) (owp-nfsow_clp-nfsc_flags NFSCLFLAGS_GOTDELEG) !error dp == NULL) { - np = VTONFS(dvp); do { ret = nfsrpc_openrpc(VFSTONFS(vnode_mount(dvp)), dvp, np-n_fhp-nfh_fh, np-n_fhp-nfh_len, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265469 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Tue May 6 21:54:52 2014 New Revision: 265469 URL: http://svnweb.freebsd.org/changeset/base/265469 Log: MFC: r264705, r264749 Modify the NFSv4 client create/mkdir RPC so that it acquires post-create/mkdir directory attributes. This allows the RPC to name cache the newly created directory and reduces the lookup RPC count for applications creating a lot of directories. Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c == --- stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue May 6 21:54:05 2014 (r265468) +++ stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue May 6 21:54:52 2014 (r265469) @@ -67,7 +67,7 @@ static struct { { NFSV4OP_READ, 1, Read, 4, }, { NFSV4OP_WRITE, 2, Write, 5, }, { NFSV4OP_OPEN, 5, Open, 4, }, - { NFSV4OP_CREATE, 3, Create, 6, }, + { NFSV4OP_CREATE, 5, Create, 6, }, { NFSV4OP_CREATE, 1, Create, 6, }, { NFSV4OP_CREATE, 3, Create, 6, }, { NFSV4OP_REMOVE, 1, Remove, 6, }, Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue May 6 21:54:05 2014 (r265468) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue May 6 21:54:52 2014 (r265469) @@ -2545,10 +2545,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in struct nfsrv_descript nfsd, *nd = nfsd; nfsattrbit_t attrbits; int error = 0; + struct nfsfh *fhp; *nfhpp = NULL; *attrflagp = 0; *dattrflagp = 0; + fhp = VTONFS(dvp)-n_fhp; if (namelen NFS_MAXNAMLEN) return (ENAMETOOLONG); NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp); @@ -2564,6 +2566,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in *tl++ = txdr_unsigned(NFSV4OP_GETFH); *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, attrbits); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_PUTFH); + (void) nfsm_fhtom(nd, fhp-nfh_fh, fhp-nfh_len, 0); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + (void) nfsrv_putattrbit(nd, attrbits); } error = nfscl_request(nd, dvp, p, cred, dstuff); if (error) @@ -2577,6 +2585,14 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in } if (!error) error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp); + if (error == 0 (nd-nd_flag ND_NFSV4) != 0) { + /* Get rid of the PutFH and Getattr status values. */ + NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error == 0) + *dattrflagp = 1; + } } if ((nd-nd_flag ND_NFSV3) !error) error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265470 - stable/10/sys/fs/nfsclient
Author: rmacklem Date: Tue May 6 21:59:48 2014 New Revision: 265470 URL: http://svnweb.freebsd.org/changeset/base/265470 Log: MFC: r264738 For an NFSv4 mount with the nocto option, don't get the up to date file attributes upon close. This reduces the Getattr RPC count by about 65% for software builds. Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c == --- stable/10/sys/fs/nfsclient/nfs_clvnops.cTue May 6 21:54:52 2014 (r265469) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.cTue May 6 21:59:48 2014 (r265470) @@ -768,7 +768,9 @@ nfs_close(struct vop_close_args *ap) /* * Get attributes so change is up to date. */ - if (error == 0 nfscl_mustflush(vp) != 0) { + if (error == 0 nfscl_mustflush(vp) != 0 + vp-v_type == VREG + (VFSTONFS(vp-v_mount)-nm_flag NFSMNT_NOCTO) == 0) { ret = nfsrpc_getattr(vp, cred, ap-a_td, nfsva, NULL); if (!ret) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265471 - stable/10/sys/netinet
Author: rmacklem Date: Tue May 6 22:04:50 2014 New Revision: 265471 URL: http://svnweb.freebsd.org/changeset/base/265471 Log: MFC: r264739 Add {} braces so that the code conforms to the indentation. Fortunately, I don't think doing the assignment of cap-tsomax unconditionally causes any problem. Modified: stable/10/sys/netinet/tcp_subr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_subr.c == --- stable/10/sys/netinet/tcp_subr.cTue May 6 21:59:48 2014 (r265470) +++ stable/10/sys/netinet/tcp_subr.cTue May 6 22:04:50 2014 (r265471) @@ -1805,9 +1805,10 @@ tcp_maxmtu(struct in_conninfo *inc, stru /* Report additional interface capabilities. */ if (cap != NULL) { if (ifp-if_capenable IFCAP_TSO4 - ifp-if_hwassist CSUM_TSO) + ifp-if_hwassist CSUM_TSO) { cap-ifcap |= CSUM_TSO; cap-tsomax = ifp-if_hw_tsomax; + } } RTFREE(sro.ro_rt); } @@ -1843,9 +1844,10 @@ tcp_maxmtu6(struct in_conninfo *inc, str /* Report additional interface capabilities. */ if (cap != NULL) { if (ifp-if_capenable IFCAP_TSO6 - ifp-if_hwassist CSUM_TSO) + ifp-if_hwassist CSUM_TSO) { cap-ifcap |= CSUM_TSO; cap-tsomax = ifp-if_hw_tsomax; + } } RTFREE(sro6.ro_rt); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265357 - stable/9/sys/netinet
Author: rmacklem Date: Mon May 5 11:30:45 2014 New Revision: 265357 URL: http://svnweb.freebsd.org/changeset/base/265357 Log: MFC: r264739 Add {} braces so that the code conforms to the indentation. Fortunately, I don't think doing the assignment of cap-tsomax unconditionally causes any problem. Modified: stable/9/sys/netinet/tcp_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_subr.c == --- stable/9/sys/netinet/tcp_subr.c Mon May 5 10:54:36 2014 (r265356) +++ stable/9/sys/netinet/tcp_subr.c Mon May 5 11:30:45 2014 (r265357) @@ -1741,9 +1741,10 @@ tcp_maxmtu(struct in_conninfo *inc, stru /* Report additional interface capabilities. */ if (cap != NULL) { if (ifp-if_capenable IFCAP_TSO4 - ifp-if_hwassist CSUM_TSO) + ifp-if_hwassist CSUM_TSO) { cap-ifcap |= CSUM_TSO; cap-tsomax = ifp-if_hw_tsomax; + } } RTFREE(sro.ro_rt); } @@ -1779,9 +1780,10 @@ tcp_maxmtu6(struct in_conninfo *inc, str /* Report additional interface capabilities. */ if (cap != NULL) { if (ifp-if_capenable IFCAP_TSO6 - ifp-if_hwassist CSUM_TSO) + ifp-if_hwassist CSUM_TSO) { cap-ifcap |= CSUM_TSO; cap-tsomax = ifp-if_hw_tsomax; + } } RTFREE(sro6.ro_rt); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265389 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Mon May 5 20:48:36 2014 New Revision: 265389 URL: http://svnweb.freebsd.org/changeset/base/265389 Log: MFC: r264705, r264749 Modify the NFSv4 client create/mkdir RPC so that it acquires post-create/mkdir directory attributes. This allows the RPC to name cache the newly created directory and reduces the lookup RPC count for applications creating a lot of directories. Modified: stable/9/sys/fs/nfsclient/nfs_clcomsubs.c stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clcomsubs.c == --- stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Mon May 5 20:35:35 2014 (r265388) +++ stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Mon May 5 20:48:36 2014 (r265389) @@ -66,7 +66,7 @@ static struct { { NFSV4OP_READ, 1, Read, 4, }, { NFSV4OP_WRITE, 2, Write, 5, }, { NFSV4OP_OPEN, 5, Open, 4, }, - { NFSV4OP_CREATE, 3, Create, 6, }, + { NFSV4OP_CREATE, 5, Create, 6, }, { NFSV4OP_CREATE, 1, Create, 6, }, { NFSV4OP_CREATE, 3, Create, 6, }, { NFSV4OP_REMOVE, 1, Remove, 6, }, Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/9/sys/fs/nfsclient/nfs_clrpcops.cMon May 5 20:35:35 2014 (r265388) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.cMon May 5 20:48:36 2014 (r265389) @@ -2409,10 +2409,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in struct nfsrv_descript nfsd, *nd = nfsd; nfsattrbit_t attrbits; int error = 0; + struct nfsfh *fhp; *nfhpp = NULL; *attrflagp = 0; *dattrflagp = 0; + fhp = VTONFS(dvp)-n_fhp; if (namelen NFS_MAXNAMLEN) return (ENAMETOOLONG); NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp); @@ -2428,6 +2430,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in *tl++ = txdr_unsigned(NFSV4OP_GETFH); *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, attrbits); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_PUTFH); + (void) nfsm_fhtom(nd, fhp-nfh_fh, fhp-nfh_len, 0); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + (void) nfsrv_putattrbit(nd, attrbits); } error = nfscl_request(nd, dvp, p, cred, dstuff); if (error) @@ -2441,6 +2449,14 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in } if (!error) error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp); + if (error == 0 (nd-nd_flag ND_NFSV4) != 0) { + /* Get rid of the PutFH and Getattr status values. */ + NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error == 0) + *dattrflagp = 1; + } } if ((nd-nd_flag ND_NFSV3) !error) error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265390 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Mon May 5 20:55:37 2014 New Revision: 265390 URL: http://svnweb.freebsd.org/changeset/base/265390 Log: MFC: r264738 For an NFSv4 mount with the nocto option, don't get the up to date file attributes upon close. This reduces the Getattr RPC count by about 65% for software builds. Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c == --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon May 5 20:48:36 2014 (r265389) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon May 5 20:55:37 2014 (r265390) @@ -762,7 +762,9 @@ nfs_close(struct vop_close_args *ap) /* * Get attributes so change is up to date. */ - if (error == 0 nfscl_mustflush(vp) != 0) { + if (error == 0 nfscl_mustflush(vp) != 0 + vp-v_type == VREG + (VFSTONFS(vp-v_mount)-nm_flag NFSMNT_NOCTO) == 0) { ret = nfsrpc_getattr(vp, cred, ap-a_td, nfsva, NULL); if (!ret) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265412 - stable/10/sys/net
Author: rmacklem Date: Tue May 6 02:44:01 2014 New Revision: 265412 URL: http://svnweb.freebsd.org/changeset/base/265412 Log: MFC: r264469, r264498 Lagg did not set the value of if_hw_tsomax, so when lagg was stacked on top of network interfaces that set if_hw_tsomax, tcp_output() would see the default value instead of the value set by the network interface(s). This patch modifies lagg so that it sets if_hw_tsomax to the minimum of the value(s) for the underlying network interfaces. Modified: stable/10/sys/net/if_lagg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_lagg.c == --- stable/10/sys/net/if_lagg.c Tue May 6 02:32:27 2014(r265411) +++ stable/10/sys/net/if_lagg.c Tue May 6 02:44:01 2014(r265412) @@ -54,11 +54,11 @@ __FBSDID($FreeBSD$); #if defined(INET) || defined(INET6) #include netinet/in.h +#include netinet/ip.h #endif #ifdef INET #include netinet/in_systm.h #include netinet/if_ether.h -#include netinet/ip.h #endif #ifdef INET6 @@ -448,6 +448,11 @@ lagg_capabilities(struct lagg_softc *sc) struct lagg_port *lp; int cap = ~0, ena = ~0; u_long hwa = ~0UL; +#if defined(INET) || defined(INET6) + u_int hw_tsomax = IP_MAXPACKET; /* Initialize to the maximum value. */ +#else + u_int hw_tsomax = ~0; /* if_hw_tsomax is only for INET/INET6, but.. */ +#endif LAGG_WLOCK_ASSERT(sc); @@ -456,6 +461,10 @@ lagg_capabilities(struct lagg_softc *sc) cap = lp-lp_ifp-if_capabilities; ena = lp-lp_ifp-if_capenable; hwa = lp-lp_ifp-if_hwassist; + /* Set to the minimum value of the lagg ports. */ + if (lp-lp_ifp-if_hw_tsomax hw_tsomax + lp-lp_ifp-if_hw_tsomax 0) + hw_tsomax = lp-lp_ifp-if_hw_tsomax; } cap = (cap == ~0 ? 0 : cap); ena = (ena == ~0 ? 0 : ena); @@ -463,10 +472,12 @@ lagg_capabilities(struct lagg_softc *sc) if (sc-sc_ifp-if_capabilities != cap || sc-sc_ifp-if_capenable != ena || - sc-sc_ifp-if_hwassist != hwa) { + sc-sc_ifp-if_hwassist != hwa || + sc-sc_ifp-if_hw_tsomax != hw_tsomax) { sc-sc_ifp-if_capabilities = cap; sc-sc_ifp-if_capenable = ena; sc-sc_ifp-if_hwassist = hwa; + sc-sc_ifp-if_hw_tsomax = hw_tsomax; getmicrotime(sc-sc_ifp-if_lastchange); if (sc-sc_ifflags IFF_DEBUG) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265413 - stable/10/sys/net
Author: rmacklem Date: Tue May 6 02:49:31 2014 New Revision: 265413 URL: http://svnweb.freebsd.org/changeset/base/265413 Log: MFC: r264517 Vlan did not set the value of if_hw_tsomax, so when vlan was stacked on top of a network interface that set if_hw_tsomax, tcp_output() would see the default value instead of the value set by the network interface. This patch modifies vlan so that it sets if_hw_tsomax to the value of the parent interface. Modified: stable/10/sys/net/if_vlan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_vlan.c == --- stable/10/sys/net/if_vlan.c Tue May 6 02:44:01 2014(r265412) +++ stable/10/sys/net/if_vlan.c Tue May 6 02:49:31 2014(r265413) @@ -1509,6 +1509,8 @@ vlan_capabilities(struct ifvlan *ifv) * propagate the hardware-assisted flag. TSO on VLANs * does not necessarily require hardware VLAN tagging. */ + if (p-if_hw_tsomax 0) + ifp-if_hw_tsomax = p-if_hw_tsomax; if (p-if_capabilities IFCAP_VLAN_HWTSO) ifp-if_capabilities |= p-if_capabilities IFCAP_TSO; if (p-if_capenable IFCAP_VLAN_HWTSO) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265414 - stable/10/sys/net
Author: rmacklem Date: Tue May 6 02:54:59 2014 New Revision: 265414 URL: http://svnweb.freebsd.org/changeset/base/265414 Log: MFC: r264630 For NFS mounts using rsize,wsize=65536 over TSO enabled network interfaces limited to 32 transmit segments, there are two known issues. The more serious one is that for an I/O of slightly less than 64K, the net device driver prepends an ethernet header, resulting in a TSO segment slightly larger than 64K. Since m_defrag() copies this into 33 mbuf clusters, the transmit fails with EFBIG. A tester indicated observing a similar failure using iSCSI. The second less critical problem is that the network device driver must copy the mbuf chain via m_defrag() (m_collapse() is not sufficient), resulting in measurable overhead. This patch reduces the default size of if_hw_tsomax slightly, so that the first issue is avoided. Fixing the second issue will require a way for the network device driver to inform tcp_output() that it is limited to 32 transmit segments. Modified: stable/10/sys/net/if.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if.c == --- stable/10/sys/net/if.c Tue May 6 02:49:31 2014(r265413) +++ stable/10/sys/net/if.c Tue May 6 02:54:59 2014(r265414) @@ -74,6 +74,7 @@ #include net/vnet.h #if defined(INET) || defined(INET6) +#include net/ethernet.h #include netinet/in.h #include netinet/in_var.h #include netinet/ip.h @@ -658,7 +659,8 @@ if_attach_internal(struct ifnet *ifp, in #if defined(INET) || defined(INET6) /* Initialize to max value. */ if (ifp-if_hw_tsomax == 0) - ifp-if_hw_tsomax = IP_MAXPACKET; + ifp-if_hw_tsomax = min(IP_MAXPACKET, 32 * MCLBYTES - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)); KASSERT(ifp-if_hw_tsomax = IP_MAXPACKET ifp-if_hw_tsomax = IP_MAXPACKET / 8, (%s: tsomax outside of range, __func__)); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r265339 - in stable/9/sys/fs: nfs nfsclient
Author: rmacklem Date: Mon May 5 01:01:30 2014 New Revision: 265339 URL: http://svnweb.freebsd.org/changeset/base/265339 Log: MFC: r264672 Modify the Lookup RPC for NFSv4 so that it acquires directory attributes. This allows the client to cache directory names when they are looked up, reducing the Lookup RPC count by about 40% for software builds. Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c stable/9/sys/fs/nfsclient/nfs_clcomsubs.c stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c == --- stable/9/sys/fs/nfs/nfs_commonsubs.cSun May 4 23:25:32 2014 (r265338) +++ stable/9/sys/fs/nfs/nfs_commonsubs.cMon May 5 01:01:30 2014 (r265339) @@ -101,8 +101,8 @@ struct nfsv4_opflag nfsv4_opflag[NFSV4OP { 0, 1, 0, 0, LK_EXCLUSIVE }, /* Lock */ { 0, 1, 0, 0, LK_EXCLUSIVE }, /* LockT */ { 0, 1, 0, 0, LK_EXCLUSIVE }, /* LockU */ - { 1, 1, 0, 0, LK_EXCLUSIVE }, /* Lookup */ - { 1, 1, 0, 0, LK_EXCLUSIVE }, /* Lookupp */ + { 1, 2, 0, 0, LK_EXCLUSIVE }, /* Lookup */ + { 1, 2, 0, 0, LK_EXCLUSIVE }, /* Lookupp */ { 0, 1, 0, 0, LK_EXCLUSIVE }, /* NVerify */ { 1, 1, 0, 1, LK_EXCLUSIVE }, /* Open */ { 1, 1, 0, 0, LK_EXCLUSIVE }, /* OpenAttr */ Modified: stable/9/sys/fs/nfsclient/nfs_clcomsubs.c == --- stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Sun May 4 23:25:32 2014 (r265338) +++ stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Mon May 5 01:01:30 2014 (r265339) @@ -167,9 +167,18 @@ nfscl_reqstart(struct nfsrv_descript *nd if (nfsv4_opflag[nfsv4_opmap[procnum].op].needscfh==2){ NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); - NFSWCCATTR_ATTRBIT(attrbits); + /* +* For Lookup Ops, we want all the directory +* attributes, so we can load the name cache. +*/ + if (procnum == NFSPROC_LOOKUP || + procnum == NFSPROC_LOOKUPP) + NFSGETATTR_ATTRBIT(attrbits); + else { + NFSWCCATTR_ATTRBIT(attrbits); + nd-nd_flag |= ND_V4WCCATTR; + } (void) nfsrv_putattrbit(nd, attrbits); - nd-nd_flag |= ND_V4WCCATTR; } NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); } Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/9/sys/fs/nfsclient/nfs_clrpcops.cSun May 4 23:25:32 2014 (r265338) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.cMon May 5 01:01:30 2014 (r265339) @@ -1135,14 +1135,23 @@ nfsrpc_lookup(vnode_t dvp, char *name, i } if (nd-nd_flag ND_NFSV3) error = nfscl_postop_attr(nd, dnap, dattrflagp, stuff); + else if ((nd-nd_flag (ND_NFSV4 | ND_NOMOREDATA)) == + ND_NFSV4) { + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error == 0) + *dattrflagp = 1; + } goto nfsmout; } if ((nd-nd_flag (ND_NFSV4 | ND_NOMOREDATA)) == ND_NFSV4) { - NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - if (*(tl + 1)) { - nd-nd_flag |= ND_NOMOREDATA; + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error != 0) goto nfsmout; - } + *dattrflagp = 1; + /* Skip over the Lookup and GetFH operation status values. */ + NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); } error = nfsm_getfh(nd, nfhpp); if (error) @@ -2566,14 +2575,6 @@ nfsrpc_readdir(vnode_t vp, struct uio *u * Joy, oh joy. For V4 we get to hand craft '.' and '..'. */ if (uiop-uio_offset == 0) { -#if defined(__FreeBSD_version) __FreeBSD_version = 80 - error = VOP_GETATTR(vp, nfsva.na_vattr, cred); -#else -
svn commit: r265340 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Mon May 5 01:07:56 2014 New Revision: 265340 URL: http://svnweb.freebsd.org/changeset/base/265340 Log: MFC: r264681 Modify the NFSv4 client open/create RPC so that it acquires post-open/create directory attributes. This allows the RPC to name cache the newly created file and reduces the lookup RPC count by about 10% for software builds. Modified: stable/9/sys/fs/nfsclient/nfs_clcomsubs.c stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clcomsubs.c == --- stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Mon May 5 01:01:30 2014 (r265339) +++ stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Mon May 5 01:07:56 2014 (r265340) @@ -65,7 +65,7 @@ static struct { { NFSV4OP_READLINK, 2, Readlink, 8, }, { NFSV4OP_READ, 1, Read, 4, }, { NFSV4OP_WRITE, 2, Write, 5, }, - { NFSV4OP_OPEN, 3, Open, 4, }, + { NFSV4OP_OPEN, 5, Open, 4, }, { NFSV4OP_CREATE, 3, Create, 6, }, { NFSV4OP_CREATE, 1, Create, 6, }, { NFSV4OP_CREATE, 3, Create, 6, }, Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/9/sys/fs/nfsclient/nfs_clrpcops.cMon May 5 01:01:30 2014 (r265339) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.cMon May 5 01:07:56 2014 (r265340) @@ -1846,6 +1846,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, nfsv4stateid_t stateid; u_int32_t rflags; + np = VTONFS(dvp); *unlockedp = 0; *nfhpp = NULL; *dpp = NULL; @@ -1879,17 +1880,22 @@ nfsrpc_createv4(vnode_t dvp, char *name, NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OPEN_CLAIMNULL); (void) nfsm_strtom(nd, name, namelen); + /* Get the new file's handle and attributes. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OP_GETFH); *tl = txdr_unsigned(NFSV4OP_GETATTR); NFSGETATTR_ATTRBIT(attrbits); (void) nfsrv_putattrbit(nd, attrbits); + /* Get the directory's post-op attributes. */ + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_PUTFH); + (void) nfsm_fhtom(nd, np-n_fhp-nfh_fh, np-n_fhp-nfh_len, 0); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + (void) nfsrv_putattrbit(nd, attrbits); error = nfscl_request(nd, dvp, p, cred, dstuff); if (error) return (error); - error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff); - if (error) - goto nfsmout; NFSCL_INCRSEQID(owp-nfsow_seqid, nd); if (nd-nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID + @@ -1961,6 +1967,13 @@ nfsrpc_createv4(vnode_t dvp, char *name, error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp); if (error) goto nfsmout; + /* Get rid of the PutFH and Getattr status values. */ + NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error) + goto nfsmout; + *dattrflagp = 1; if (dp != NULL *attrflagp) { dp-nfsdl_change = nnap-na_filerev; dp-nfsdl_modtime = nnap-na_mtime; @@ -2004,7 +2017,6 @@ nfsrpc_createv4(vnode_t dvp, char *name, if ((rflags NFSV4OPEN_RESULTCONFIRM) (owp-nfsow_clp-nfsc_flags NFSCLFLAGS_GOTDELEG) !error dp == NULL) { - np = VTONFS(dvp); do { ret = nfsrpc_openrpc(VFSTONFS(vnode_mount(dvp)), dvp, np-n_fhp-nfh_fh, np-n_fhp-nfh_len, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org