freebsd-skq/sys
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
..
amd64 Ignore guest PAT settings by default in EPT mappings. 2013-07-01 20:05:43 +00:00
arm Enable VFP on Raspberry Pi. This has worked as of r251712. 2013-07-02 19:35:04 +00:00
boot Add a new gptboot(8) man page. Factor out the redundant information 2013-07-01 22:38:36 +00:00
bsm Implement chflagsat(2) system call, similar to fchmodat(2), but operates on 2013-03-21 22:59:01 +00:00
cam Introduce accessors for the ccb status word. Convert one (of many more) 2013-06-29 17:48:59 +00:00
cddl Be sure to destory the fasttrap cleanup mutex when unloading the fasttrap 2013-07-01 23:12:59 +00:00
compat aio_mlock() added: 2013-06-08 13:30:13 +00:00
conf - Update newvers.sh to include svn revision in uname(1) if the 2013-07-02 10:36:57 +00:00
contrib Check the return value from ath_hal_malloc() 2013-06-29 16:49:00 +00:00
crypto When porting XTS-related code from OpenBSD I forgot to update copyright (only 2013-02-20 22:59:53 +00:00
ddb
dev Add Planex MZK-UE150N. 2013-07-02 07:35:57 +00:00
fs A problem with the old NFS client where large writes to large files 2013-07-03 00:19:03 +00:00
gdb
geom - Add a general purpose resource allocator, vmem, from NetBSD. It was 2013-06-28 03:51:20 +00:00
gnu/fs/reiserfs Garbage collect XFS bits which are now already completely disconnected 2013-03-02 15:33:54 +00:00
i386 Fix issues with zeroing and fetching the counters, on x86 and ppc64. 2013-07-01 02:48:27 +00:00
ia64 Fix issues with zeroing and fetching the counters, on x86 and ppc64. 2013-07-01 02:48:27 +00:00
isa
kern Fix receiving fd over unix socket broken in r247740. 2013-07-02 07:36:04 +00:00
kgssapi Isilon reported that sec=krb5p NFS mounts had a problem when m_len == 0 2013-05-01 22:07:55 +00:00
libkern Attempt to mitigate poor initialization of arc4 by one-shot 2013-04-19 00:30:52 +00:00
mips Fix issues with zeroing and fetching the counters, on x86 and ppc64. 2013-07-01 02:48:27 +00:00
modules Import an implementation of the CAIA Delay-Gradient (CDG) congestion control 2013-07-02 08:44:56 +00:00
net - Allow ND6_IFF_AUTO_LINKLOCAL for IFT_BRIDGE. An interface with IFT_BRIDGE 2013-07-02 16:58:15 +00:00
net80211 Don't panic the kernel if we run wpa_supplicant on a hostap VAP. 2013-06-29 06:36:42 +00:00
netatalk Add const qualifier to the dst parameter of the ifnet if_output method. 2013-04-26 12:50:32 +00:00
netgraph Fix several typos 2013-05-12 16:43:26 +00:00
netinet Fix a panic when leaving MC group in a kernel with VIMAGE enabled. 2013-07-02 16:39:12 +00:00
netinet6 - Allow ND6_IFF_AUTO_LINKLOCAL for IFT_BRIDGE. An interface with IFT_BRIDGE 2013-07-02 16:58:15 +00:00
netipsec Use corresponding macros to update statistics for AH, ESP, IPIP, IPCOMP, 2013-06-20 11:44:16 +00:00
netipx
netnatm
netpfil Improve locking strategy between keys hash and ID hash. 2013-06-13 06:07:19 +00:00
netsmb Remove a reference to LK_DRAIN now that lockmgr(9) is gone from this 2013-06-28 20:21:13 +00:00
nfs Move the NFS FHA (File Handle Affinity) code from sys/nfsserver to 2013-04-17 22:42:43 +00:00
nfsclient A recent version of the oldnfs NFS client in head/current 2013-07-01 21:16:19 +00:00
nfsserver - Convert the bufobj lock to rwlock. 2013-05-31 00:43:41 +00:00
nlm
ofed Store a reference to the vnode associated with a file descriptor in the 2013-06-11 15:37:07 +00:00
opencrypto When porting XTS-related code from OpenBSD I forgot to update copyright (only 2013-02-20 22:59:53 +00:00
pc98 MFi386: revision 251039 2013-06-01 12:21:59 +00:00
pci - Corrrect mispellings of word useful 2013-04-17 11:45:15 +00:00
powerpc Fix indentation. 2013-07-02 07:17:56 +00:00
rpc Fix a potential socket leak in the NFS server. If a client closes its 2013-04-08 19:03:01 +00:00
security Relax the vm object locking in mac_proc_vm_revoke_recurse(). A read lock 2013-06-04 17:23:09 +00:00
sparc64 Fix issues with zeroing and fetching the counters, on x86 and ppc64. 2013-07-01 02:48:27 +00:00
sys Make atomic_fetch_add() and atomic_fetch_sub() work for pointers with GCC 4.2. 2013-06-30 10:38:20 +00:00
teken
tools Further refine the handling of stop signals in the NFS client. The 2013-02-21 19:02:50 +00:00
ufs Make better use of metadata area by avoiding using it for data blocks 2013-07-02 21:07:08 +00:00
vm Remove a spurious keg lock acquisition. 2013-06-28 21:13:19 +00:00
x86 Fix a KTR_BUSDMA format string. 2013-06-18 06:55:58 +00:00
xdr Use m_get() and m_getcl() instead of compat macros. 2013-03-15 10:21:18 +00:00
xen Adjust i386 Xen PV support for updated Xen interface files. 2013-06-17 01:43:07 +00:00
Makefile Remove netncp cscope entry missed in r248097 2013-03-12 14:21:52 +00:00