From owner-svn-src-all@FreeBSD.ORG Mon Jul 21 22:21:10 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB500DCD; Mon, 21 Jul 2014 22:21:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 A760E2B43; Mon, 21 Jul 2014 22:21:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6LMLA7u080689; Mon, 21 Jul 2014 22:21:10 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6LMLAst080686; Mon, 21 Jul 2014 22:21:10 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201407212221.s6LMLAst080686@svn.freebsd.org> From: Bryan Drewery Date: Mon, 21 Jul 2014 22:21:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268961 - in stable/10/sys: fs/nfsserver nfsserver X-SVN-Group: stable-10 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.18 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: Mon, 21 Jul 2014 22:21:10 -0000 Author: bdrewery Date: Mon Jul 21 22:21:09 2014 New Revision: 268961 URL: http://svnweb.freebsd.org/changeset/base/268961 Log: MFC r268114: Change NFS readdir() to only ignore cookies preceding the given offset for UFS rather than for all but ZFS. 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 Mon Jul 21 22:10:29 2014 (r268960) +++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c Mon Jul 21 22:21:09 2014 (r268961) @@ -1551,7 +1551,7 @@ nfsrvd_readdir(struct nfsrv_descript *nd u_long *cookies = NULL, *cookiep; struct uio io; struct iovec iv; - int not_zfs; + int is_ufs; if (nd->nd_repstat) { nfsrv_postopattr(nd, getret, &at); @@ -1606,7 +1606,7 @@ nfsrvd_readdir(struct nfsrv_descript *nd nfsrv_postopattr(nd, getret, &at); goto out; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs"); + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: eofflag = 0; @@ -1686,12 +1686,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff))) { + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff))) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++; @@ -1804,7 +1802,7 @@ nfsrvd_readdirplus(struct nfsrv_descript struct uio io; struct iovec iv; struct componentname cn; - int at_root, needs_unbusy, not_zfs, supports_nfsv4acls; + int at_root, is_ufs, is_zfs, needs_unbusy, supports_nfsv4acls; struct mount *mp, *new_mp; uint64_t mounted_on_fileno; @@ -1884,7 +1882,8 @@ nfsrvd_readdirplus(struct nfsrv_descript nfsrv_postopattr(nd, getret, &at); goto out; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs"); + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; + is_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") == 0; MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: @@ -1957,12 +1956,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff) || + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff) || ((nd->nd_flag & ND_NFSV4) && ((dp->d_namlen == 1 && dp->d_name[0] == '.') || (dp->d_namlen==2 && dp->d_name[0]=='.' && dp->d_name[1]=='.'))))) { @@ -2004,7 +2001,7 @@ again: * This needs to be done here for NFSv4, since NFSv4 never does * a VFS_VGET() for "." or "..". */ - if (not_zfs == 0) { + if (is_zfs == 1) { r = VFS_VGET(mp, at.na_fileid, LK_SHARED, &nvp); if (r == EOPNOTSUPP) { usevget = 0; @@ -2153,7 +2150,7 @@ again: if (!r) r = nfsvno_getattr(nvp, nvap, nd->nd_cred, p, 1); - if (r == 0 && not_zfs == 0 && + if (r == 0 && is_zfs == 1 && nfsrv_enable_crossmntpt != 0 && (nd->nd_flag & ND_NFSV4) != 0 && nvp->v_type == VDIR && Modified: stable/10/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/10/sys/nfsserver/nfs_serv.c Mon Jul 21 22:10:29 2014 (r268960) +++ stable/10/sys/nfsserver/nfs_serv.c Mon Jul 21 22:21:09 2014 (r268961) @@ -2627,7 +2627,7 @@ nfsrv_readdir(struct nfsrv_descript *nfs int v3 = (nfsd->nd_flag & ND_NFSV3); u_quad_t off, toff, verf; u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */ - int not_zfs; + int is_ufs; nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); fhp = &nfh.fh_generic; @@ -2690,7 +2690,7 @@ nfsrv_readdir(struct nfsrv_descript *nfs error = 0; goto nfsmout; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") != 0; + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; VOP_UNLOCK(vp, 0); /* @@ -2777,12 +2777,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff))) { + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff))) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++; @@ -2928,7 +2926,7 @@ nfsrv_readdirplus(struct nfsrv_descript int usevget = 1; struct componentname cn; struct mount *mntp = NULL; - int not_zfs; + int is_ufs; nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); vp_locked = 0; @@ -2988,7 +2986,7 @@ nfsrv_readdirplus(struct nfsrv_descript error = 0; goto nfsmout; } - not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") != 0; + is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0; VOP_UNLOCK(vp, 0); vp_locked = 0; rbuf = malloc(siz, M_TEMP, M_WAITOK); @@ -3068,12 +3066,10 @@ again: * skip over the records that precede the requested offset. This * requires the assumption that file offset cookies monotonically * increase. - * Since the offset cookies don't monotonically increase for ZFS, - * this is not done when ZFS is the file system. */ while (cpos < cend && ncookies > 0 && (dp->d_fileno == 0 || dp->d_type == DT_WHT || - (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff))) { + (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff))) { cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++;