Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Dec 2010 21:04:10 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r216808 - releng/8.2/sys/fs/nfsserver
Message-ID:  <201012292104.oBTL4Adi013193@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Wed Dec 29 21:04:10 2010
New Revision: 216808
URL: http://svn.freebsd.org/changeset/base/216808

Log:
  MFC: r216691
  Since VOP_READDIR() for ZFS does not return monotonically
  increasing directory offset cookies, disable the UFS related
  loop that skips over directory entries at the beginning of
  the block for the experimental NFS server. This loop is
  required for UFS since it always returns directory entries
  starting at the beginning of the block that
  the requested directory offset is in. In discussion with pjd@
  and mckusick@ it seems that this behaviour of UFS should maybe
  change, with this fix being an interim patch until then.
  This patch only fixes the experimental server, since pjd@ is
  working on a patch for the regular server.
  
  Approved by:	re (kib)

Modified:
  releng/8.2/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  releng/8.2/sys/   (props changed)
  releng/8.2/sys/amd64/include/xen/   (props changed)
  releng/8.2/sys/cddl/contrib/opensolaris/   (props changed)
  releng/8.2/sys/contrib/dev/acpica/   (props changed)
  releng/8.2/sys/contrib/pf/   (props changed)

Modified: releng/8.2/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- releng/8.2/sys/fs/nfsserver/nfs_nfsdport.c	Wed Dec 29 20:35:36 2010	(r216807)
+++ releng/8.2/sys/fs/nfsserver/nfs_nfsdport.c	Wed Dec 29 21:04:10 2010	(r216808)
@@ -1432,6 +1432,7 @@ nfsrvd_readdir(struct nfsrv_descript *nd
 	u_long *cookies = NULL, *cookiep;
 	struct uio io;
 	struct iovec iv;
+	int not_zfs;
 
 	if (nd->nd_repstat) {
 		nfsrv_postopattr(nd, getret, &at);
@@ -1484,6 +1485,7 @@ nfsrvd_readdir(struct nfsrv_descript *nd
 			nfsrv_postopattr(nd, getret, &at);
 		return (0);
 	}
+	not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs");
 	NFSVOPUNLOCK(vp, 0, p);
 	MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK);
 again:
@@ -1566,10 +1568,12 @@ 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 ||
-	     ((u_quad_t)(*cookiep)) <= toff)) {
+	     (not_zfs != 0 && ((u_quad_t)(*cookiep)) <= toff))) {
 		cpos += dp->d_reclen;
 		dp = (struct dirent *)cpos;
 		cookiep++;
@@ -1678,6 +1682,7 @@ nfsrvd_readdirplus(struct nfsrv_descript
 	struct uio io;
 	struct iovec iv;
 	struct componentname cn;
+	int not_zfs;
 
 	if (nd->nd_repstat) {
 		nfsrv_postopattr(nd, getret, &at);
@@ -1755,6 +1760,7 @@ nfsrvd_readdirplus(struct nfsrv_descript
 			nfsrv_postopattr(nd, getret, &at);
 		return (0);
 	}
+	not_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs");
 
 	MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK);
 again:
@@ -1827,10 +1833,12 @@ 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 ||
-	   ((u_quad_t)(*cookiep)) <= toff ||
+	   (not_zfs != 0 && ((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]=='.'))))) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012292104.oBTL4Adi013193>