file locking, NFS, and cache invalidation

Miquel van Smoorenburg (miquels@cistron.nl)
Tue, 31 Aug 1999 23:10:15 +0200


Normally fcntl() locking is a cache coherency point for NFS. However
in 2.2.x the cache isn't invalidated after a fcntl() lock if the
partition was mounted with the "nolock" option.

This recently came up on the debian development mailing list,
in a thread about mail loss over NFS and 2.2 kernels. A patch
was posted, originally by Olaf Kirch, and this should probably go
into 2.2.13.

Note that the same problem exist in the current 2.3.15 kernel.

filename="nfs.nolock.okir.patch"

--- fs/nfs/file.c.org Tue Jun 1 13:09:01 1999
+++ fs/nfs/file.c Thu Aug 19 22:35:33 1999
@@ -214,7 +214,7 @@

/* Fake OK code if mounted without NLM support */
if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)
- return 0;
+ /* return 0; */ goto out_okay;

/*
* No BSD flocks over NFS allowed.
@@ -241,6 +241,7 @@
* Make sure we re-validate anything we've got cached.
* This makes locking act as a cache coherency point.
*/
+out_okay:
NFS_CACHEINV(inode);
return 0;
}

Mike.

-- 
... somehow I have a feeling the hurting hasn't even begun yet
	-- Bill, "The Terrible Thunderlizards"

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/