From owner-svn-src-all@freebsd.org Tue Dec 19 19:18:50 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 572F1E993EE; Tue, 19 Dec 2017 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2868466C82; Tue, 19 Dec 2017 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJJInxV072228; Tue, 19 Dec 2017 19:18:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJJImA5072223; Tue, 19 Dec 2017 19:18:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201712191918.vBJJImA5072223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 19 Dec 2017 19:18:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326991 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 326991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Dec 2017 19:18:50 -0000 Author: jhb Date: Tue Dec 19 19:18:48 2017 New Revision: 326991 URL: https://svnweb.freebsd.org/changeset/base/326991 Log: Update NFS to handle larger link counts post ino64. - Define a NFS_LINK_MAX as UINT32_MAX to match the wire protocol. - Use NFS_LINK_MAX instead of LINK_MAX as the fallback value reported for a PATHCONF RPC by the NFS server. - Use NFS_LINK_MAX instead of LINK_MAX as the default value reported by the NFS client pathconf() if not overridden by the NFS server. - When reading the link count out of an RPC reply, read the full 32 bits instead of the lower 16 bits. Reviewed by: rmacklem (earlier version) Sponsored by: Chelsio Communications Modified: head/sys/fs/nfs/nfs_commonport.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfsproto.h head/sys/fs/nfsclient/nfs_clcomsubs.c head/sys/fs/nfsclient/nfs_clvnops.c Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Tue Dec 19 19:14:01 2017 (r326990) +++ head/sys/fs/nfs/nfs_commonport.c Tue Dec 19 19:18:48 2017 (r326991) @@ -331,7 +331,7 @@ nfsvno_pathconf(struct vnode *vp, int flag, register_t */ switch (flag) { case _PC_LINK_MAX: - *retf = LINK_MAX; + *retf = NFS_LINK_MAX; break; case _PC_NAME_MAX: *retf = NAME_MAX; Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Tue Dec 19 19:14:01 2017 (r326990) +++ head/sys/fs/nfs/nfs_commonsubs.c Tue Dec 19 19:18:48 2017 (r326991) @@ -883,7 +883,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSV3_FSFHOMOGENEOUS | NFSV3_FSFCANSETTIME); } if (pc != NULL) { - pc->pc_linkmax = LINK_MAX; + pc->pc_linkmax = NFS_LINK_MAX; pc->pc_namemax = NAME_MAX; pc->pc_notrunc = 0; pc->pc_chownrestricted = 0; @@ -1320,7 +1320,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); if (compare) { if (!(*retcmpp)) { - if (fxdr_unsigned(int, *tl) != LINK_MAX) + if (fxdr_unsigned(int, *tl) != NFS_LINK_MAX) *retcmpp = NFSERR_NOTSAME; } } else if (pc != NULL) { Modified: head/sys/fs/nfs/nfsproto.h ============================================================================== --- head/sys/fs/nfs/nfsproto.h Tue Dec 19 19:14:01 2017 (r326990) +++ head/sys/fs/nfs/nfsproto.h Tue Dec 19 19:18:48 2017 (r326991) @@ -785,6 +785,8 @@ struct nfs_fattr { #define fa3_mtime fa_un.fa_nfsv3.nfsv3fa_mtime #define fa3_ctime fa_un.fa_nfsv3.nfsv3fa_ctime +#define NFS_LINK_MAX UINT32_MAX + struct nfsv2_sattr { u_int32_t sa_mode; u_int32_t sa_uid; Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clcomsubs.c Tue Dec 19 19:14:01 2017 (r326990) +++ head/sys/fs/nfsclient/nfs_clcomsubs.c Tue Dec 19 19:18:48 2017 (r326991) @@ -433,7 +433,7 @@ nfsm_loadattr(struct nfsrv_descript *nd, struct nfsvat nap->na_mode = fxdr_unsigned(u_short, fp->fa_mode); nap->na_rdev = makedev(fxdr_unsigned(u_char, fp->fa3_rdev.specdata1), fxdr_unsigned(u_char, fp->fa3_rdev.specdata2)); - nap->na_nlink = fxdr_unsigned(u_short, fp->fa_nlink); + nap->na_nlink = fxdr_unsigned(uint32_t, fp->fa_nlink); nap->na_uid = fxdr_unsigned(uid_t, fp->fa_uid); nap->na_gid = fxdr_unsigned(gid_t, fp->fa_gid); nap->na_size = fxdr_hyper(&fp->fa3_size); Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue Dec 19 19:14:01 2017 (r326990) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Dec 19 19:18:48 2017 (r326991) @@ -3450,7 +3450,7 @@ nfs_pathconf(struct vop_pathconf_args *ap) * For NFSv2 (or NFSv3 when not one of the above 4 a_names), * just fake them. */ - pc.pc_linkmax = LINK_MAX; + pc.pc_linkmax = NFS_LINK_MAX; pc.pc_namemax = NFS_MAXNAMLEN; pc.pc_notrunc = 1; pc.pc_chownrestricted = 1; @@ -3460,7 +3460,7 @@ nfs_pathconf(struct vop_pathconf_args *ap) } switch (ap->a_name) { case _PC_LINK_MAX: - *ap->a_retval = pc.pc_linkmax; + *ap->a_retval = MIN(LONG_MAX, pc.pc_linkmax); break; case _PC_NAME_MAX: *ap->a_retval = pc.pc_namemax;