freebsd-skq/sys/nfsclient
Rick Macklem 913df8fd72 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 such that the
call to the 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.

Reported by:	David G. Lawrence (dg@dglawrence.com)
Tested by:	David G. Lawrence (pending, to happen soon)
Reviewed by:	kib
MFC after:	1 week
2013-07-04 00:54:23 +00:00
..
nfs_bio.c Both NFS clients can deadlock when using the "rdirplus" mount 2013-04-18 13:09:04 +00:00
nfs_kdtrace.c
nfs_krpc.c Further refine the handling of stop signals in the NFS client. The 2013-02-21 19:02:50 +00:00
nfs_nfsiod.c When an NFS unmount occurs, once vflush() writes the last dirty 2013-04-18 23:20:16 +00:00
nfs_node.c r16312 is not any longer real since many years (likely since when VFS 2012-11-19 22:43:45 +00:00
nfs_subs.c A problem with the old NFS client where large writes to large files 2013-07-04 00:54:23 +00:00
nfs_vfsops.c When an NFS unmount occurs, once vflush() writes the last dirty 2013-04-18 23:20:16 +00:00
nfs_vnops.c A recent version of the oldnfs NFS client in head/current 2013-07-01 21:16:19 +00:00
nfs.h
nfsargs.h Move the NFSv4.1 client patches over from projects/nfsv4.1-client 2012-12-08 22:52:39 +00:00
nfsm_subs.h - Use m_get2() instead of nfsm_reqhead(). 2013-03-12 12:23:47 +00:00
nfsmount.h Revert 195703 and 195821 as this special stop handling in NFS is now 2013-03-13 21:06:03 +00:00
nfsnode.h PR# 165923 reported intermittent write failures for dirty 2012-05-12 12:02:51 +00:00
nfsstats.h
nlminfo.h