diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2012-01-27 02:46:12 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2012-01-27 02:46:12 +0000 |
commit | 67ad565252d3d34bb8ca2cf69cd14196e9cde25a (patch) | |
tree | 20a610ef86d52095dc46dd3bd040e3c75437f1a9 /sys/nfsclient | |
parent | e7de0310724405390676f8aecbe28e852265b02a (diff) | |
download | FreeBSD-src-67ad565252d3d34bb8ca2cf69cd14196e9cde25a.zip FreeBSD-src-67ad565252d3d34bb8ca2cf69cd14196e9cde25a.tar.gz |
A problem with respect to data read through the buffer cache for both
NFS clients was reported to freebsd-fs@ under the subject "NFS
corruption in recent HEAD" on Nov. 26, 2011. This problem occurred when
a TCP mounted root fs was changed to using UDP. I believe that this
problem was caused by the change in mnt_stat.f_iosize that occurred
because rsize was decreased to the maximum supported by UDP. This
patch fixes the problem by using v_bufobj.bo_bsize instead of f_iosize,
since the latter is set to f_iosize when the vnode is allocated, but
does not change for a given vnode when f_iosize changes.
Reported by: pjd
Reviewed by: kib
MFC after: 2 weeks
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 97e878a..d564c08 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -474,7 +474,7 @@ nfs_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) /* No caching/ no readaheads. Just read data into the user buffer */ return nfs_readrpc(vp, uio, cred); - biosize = vp->v_mount->mnt_stat.f_iosize; + biosize = vp->v_bufobj.bo_bsize; seqcount = (int)((off_t)(ioflag >> IO_SEQSHIFT) * biosize / BKVASIZE); error = nfs_bioread_check_cons(vp, td, cred); @@ -951,7 +951,7 @@ flush_and_restart: if (vn_rlimit_fsize(vp, uio, td)) return (EFBIG); - biosize = vp->v_mount->mnt_stat.f_iosize; + biosize = vp->v_bufobj.bo_bsize; /* * Find all of this file's B_NEEDCOMMIT buffers. If our writes * would exceed the local maximum per-file write commit size when @@ -1255,12 +1255,8 @@ nfs_getcacheblk(struct vnode *vp, daddr_t bn, int size, struct thread *td) bp = getblk(vp, bn, size, 0, 0, 0); } - if (vp->v_type == VREG) { - int biosize; - - biosize = mp->mnt_stat.f_iosize; - bp->b_blkno = bn * (biosize / DEV_BSIZE); - } + if (vp->v_type == VREG) + bp->b_blkno = bn * (vp->v_bufobj.bo_bsize / DEV_BSIZE); return (bp); } @@ -1767,7 +1763,7 @@ nfs_meta_setsize(struct vnode *vp, struct ucred *cred, struct thread *td, u_quad { struct nfsnode *np = VTONFS(vp); u_quad_t tsize; - int biosize = vp->v_mount->mnt_stat.f_iosize; + int biosize = vp->v_bufobj.bo_bsize; int error = 0; mtx_lock(&np->n_mtx); |