Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Aug 2011 00:05:09 +0000 (UTC)
From:      Zack Kirsch <zack@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r224953 - stable/8/sys/fs/nfsserver
Message-ID:  <201108180005.p7I059rB028461@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zack
Date: Thu Aug 18 00:05:09 2011
New Revision: 224953
URL: http://svn.freebsd.org/changeset/base/224953

Log:
  MFC r224637:
  
  Fix an NFS server issue where it was not correctly setting the eof flag when a
  READ had hit the end of the file. Also, clean up some cruft in the code.

Modified:
  stable/8/sys/fs/nfsserver/nfs_nfsdserv.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Wed Aug 17 23:59:55 2011	(r224952)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Thu Aug 18 00:05:09 2011	(r224953)
@@ -620,7 +620,7 @@ nfsrvd_read(struct nfsrv_descript *nd, _
     vnode_t vp, NFSPROC_T *p, struct nfsexstuff *exp)
 {
 	u_int32_t *tl;
-	int error = 0, cnt, len, getret = 1, reqlen, eof = 0;
+	int error = 0, cnt, getret = 1, reqlen, eof = 0;
 	mbuf_t m2, m3;
 	struct nfsvattr nva;
 	off_t off = 0x0;
@@ -714,11 +714,11 @@ nfsrvd_read(struct nfsrv_descript *nd, _
 		eof = 1;
 	} else if (reqlen == 0)
 		cnt = 0;
-	else if ((off + reqlen) > nva.na_size)
+	else if ((off + reqlen) >= nva.na_size) {
 		cnt = nva.na_size - off;
-	else
+		eof = 1;
+	} else
 		cnt = reqlen;
-	len = NFSM_RNDUP(cnt);
 	m3 = NULL;
 	if (cnt > 0) {
 		nd->nd_repstat = nfsvno_read(vp, off, cnt, nd->nd_cred, p,
@@ -748,7 +748,7 @@ nfsrvd_read(struct nfsrv_descript *nd, _
 			*tl++ = txdr_unsigned(cnt);
 		} else
 			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
-		if (len < reqlen || eof)
+		if (eof)
 			*tl++ = newnfs_true;
 		else
 			*tl++ = newnfs_false;



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