freebsd-skq/sys/fs/nfsclient
Rick Macklem a820822ec8 A problem with the old NFS client where large writes to large files
would sometimes result in a corrupted file was reported via email.
This problem appears to have been caused by r251719 (reverting
r251719 fixed the problem). Although I have not been able to
reproduce this problem, I suspect it is caused by another thread
increasing np->n_size after the mtx_unlock(&np->n_mtx) but before
the vnode_pager_setsize() call. Since the np->n_mtx mutex serializes
updates to np->n_size, doing the vnode_pager_setsize() with the
mutex locked appears to avoid the problem.
Unfortunately, vnode_pager_setsize() where the new size is smaller,
cannot be called with a mutex held.
This patch returns the semantics to be close to pre-r251719 (actually
pre-r248567, r248581, r248567 for the new client) such that the call to
vnode_pager_setsize() is only delayed until after the mutex is
unlocked when np->n_size is shrinking. Since the file is growing
when being written, I believe this will fix the corruption.
A better solution might be to replace the mutex with a sleep lock,
but that is a non-trivial conversion, so this fix is hoped to be
sufficient in the meantime.

Reported by:	David G. Lawrence (dg@dglawrence.com)
Tested by:	David G. Lawrence (to be done soon)
Reviewed by:	kib
MFC after:	1 week
2013-07-03 00:19:03 +00:00
..
nfs_clbio.c When the NFSv4.1 client is writing to a pNFS Data Server (DS), the 2013-06-21 22:26:18 +00:00
nfs_clcomsubs.c Move the NFSv4.1 client patches over from projects/nfsv4.1-client 2012-12-08 22:52:39 +00:00
nfs_clkdtrace.c Move the NFSv4.1 client patches over from projects/nfsv4.1-client 2012-12-08 22:52:39 +00:00
nfs_clkrpc.c Revamp the old NFS server's File Handle Affinity (FHA) code so that 2013-04-17 21:00:22 +00:00
nfs_clnfsiod.c When an NFS unmount occurs, once vflush() writes the last dirty 2013-04-18 23:20:16 +00:00
nfs_clnode.c Switch the vm_object mutex to be a rwlock. This will enable in the 2013-03-09 02:32:23 +00:00
nfs_clport.c A problem with the old NFS client where large writes to large files 2013-07-03 00:19:03 +00:00
nfs_clrpcops.c Be conservative and do not try to consume more bytes than was 2013-01-27 09:34:25 +00:00
nfs_clstate.c Fix r252074 so that it builds on 64bit arches. 2013-06-22 21:58:21 +00:00
nfs_clsubs.c Replace the MNT_VNODE_FOREACH interface with MNT_VNODE_FOREACH_ALL. 2012-04-17 16:28:22 +00:00
nfs_clvfsops.c Since some NFSv4 servers enforce the requirement for a reserved port#, 2013-06-21 19:41:30 +00:00
nfs_clvnops.c When the NFSv4.1 client is writing to a pNFS Data Server (DS), the 2013-06-21 22:26:18 +00:00
nfs_kdtrace.h Add DTrace support to the new NFS client. This is essentially 2011-06-18 23:02:53 +00:00
nfs.h Modify the experimental (newnfs) NFS client so that it uses the 2011-04-25 23:12:18 +00:00
nfsmount.h Move the NFSv4.1 client patches over from projects/nfsv4.1-client 2012-12-08 22:52:39 +00:00
nfsnode.h Move the NFSv4.1 client patches over from projects/nfsv4.1-client 2012-12-08 22:52:39 +00:00
nlminfo.h