summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2015-11-17 01:44:26 +0000
committerrmacklem <rmacklem@FreeBSD.org>2015-11-17 01:44:26 +0000
commitc1f03546222121af51741ee167587bb73e30ba19 (patch)
treea44ec854fee3cfb96022828d08a5fe590865a791 /sys/fs
parentaa15bac7dfa9fc33dfb7052a8393286e0585944f (diff)
downloadFreeBSD-src-c1f03546222121af51741ee167587bb73e30ba19.zip
FreeBSD-src-c1f03546222121af51741ee167587bb73e30ba19.tar.gz
mnt_stat.f_iosize (which is used to set bo_bsize) must be set to
the largest size of buffer cache block or the mapping of the buffer is bogus. When a mount with rsize=4096,wsize=4096 was done, f_iosize would be set to 4096. This resulted in corrupted directory data, since the buffer cache block size for directories is NFS_DIRBLKSIZ (8192). This patch fixes the code so that it always sets f_iosize to at least NFS_DIRBLKSIZ. Tested by: krichy@cflinux.hu PR: 177971 MFC after: 2 weeks
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index b165b96..14a4d18 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -216,10 +216,12 @@ newnfs_iosize(struct nfsmount *nmp)
* Calculate the size used for io buffers. Use the larger
* of the two sizes to minimise nfs requests but make sure
* that it is at least one VM page to avoid wasting buffer
- * space.
+ * space. It must also be at least NFS_DIRBLKSIZ, since
+ * that is the buffer size used for directories.
*/
iosize = imax(nmp->nm_rsize, nmp->nm_wsize);
iosize = imax(iosize, PAGE_SIZE);
+ iosize = imax(iosize, NFS_DIRBLKSIZ);
nmp->nm_mountp->mnt_stat.f_iosize = iosize;
return (iosize);
}
OpenPOWER on IntegriCloud