aboutsummaryrefslogtreecommitdiff
path: root/sys/nfsclient/nfs_node.c
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>1999-12-14 19:07:54 +0000
committerMatthew Dillon <dillon@FreeBSD.org>1999-12-14 19:07:54 +0000
commitb7303db36ed97078d6ec0742d7e1fc18ebc2a7ae (patch)
tree57f25cf6bafa2de95e2c5c840374d11e04df2ecc /sys/nfsclient/nfs_node.c
parent43657887733590bb8a3be29d29043640ba52063f (diff)
downloadsrc-b7303db36ed97078d6ec0742d7e1fc18ebc2a7ae.tar.gz
src-b7303db36ed97078d6ec0742d7e1fc18ebc2a7ae.zip
Fix two problems: First, fix the append seek position race that can
occur due to np->n_size potentially changing if nfs_getcacheblk() blocks in nfs_write(). Second, under -current we must supply the proper bufsize when obtaining buffers that straddle the EOF, but due to the fact that np->n_size can change out from under us it is possible that we may specify the wrong buffer size and wind up truncating dirty data written by another process. Both problems are solved by implementing nfs_rslock(), which allows us to lock around sensitive buffer cache operations such as those that occur when appending to a file. It is believed that this race is responsible for causing dirtyoff/dirtyend and (in stable) validoff/validend to exceed the buffer size. Therefore we have now added a warning printf for the dirtyoff/end case in current. However, we have introduced a new problem which we need to fix at some point, and that is that soft or intr NFS mounts may become uninterruptable from the point of view of process A which is stuck waiting on rslock while process B is stuck doing the rpc. To unstick process A, process B would have to be interrupted first. Reviewed by: Alfred Perlstein <bright@wintelcom.net>
Notes
Notes: svn path=/head/; revision=54605
Diffstat (limited to 'sys/nfsclient/nfs_node.c')
-rw-r--r--sys/nfsclient/nfs_node.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c
index 53c73a165d9e..4db6fc2fa0cd 100644
--- a/sys/nfsclient/nfs_node.c
+++ b/sys/nfsclient/nfs_node.c
@@ -180,6 +180,7 @@ loop:
np->n_fhp = &np->n_fh;
bcopy((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize);
np->n_fhsize = fhsize;
+ lockinit(&np->n_rslock, PVFS, "nfrslk", 0, LK_NOPAUSE);
*npp = np;
if (nfs_node_hash_lock < 0)