Date: Wed, 3 Aug 2011 18:50:19 +0000 (UTC) From: Zack Kirsch <zack@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r224637 - head/sys/fs/nfsserver Message-ID: <201108031850.p73IoJ9f025305@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zack Date: Wed Aug 3 18:50:19 2011 New Revision: 224637 URL: http://svn.freebsd.org/changeset/base/224637 Log: 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. Approved by: re (kib) Reviewed by: rmacklem MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Wed Aug 3 18:11:53 2011 (r224636) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Wed Aug 3 18:50:19 2011 (r224637) @@ -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?201108031850.p73IoJ9f025305>