Subject: Relaxing NFS wcc checks
To: None <tech-kern@netbsd.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 11/01/2006 00:00:19
------=_Part_14318_12884597.1162335619236
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello,

[ please CC me any replies ]

While debugging some problems with exporting tmpfs volumes, I was
getting messages from the kernel similar to these:

/tmp/remote: inaccurate wcc data (mtime) detected, disabling wcc
(or in other cases, ctime)

These were appearing quite randomly though.  Upon further inspection
(and from my very limited understanding of NFS), I found that wcc data
is considered invalid if the real file's times are less or _equal_ to
the cached file's times.  This causes problems when a file is
accessed/created/whatever and the cached data is inserted on the exact
same nanosecond in the wcc.

How to reproduce that?  You only need to keep the nfs server and
client on the same machine.  tmpfs needn't be involved (although it
raises the errors much faster because it's internally simpler than ffs
and therefore has higher chances of finalizing in the same
nanosecond), as I've seen this pop up with ffs too.  Plus you do not
need a very fast machine; I see it within qemu on an Ahtlon XP 2600+.

The attached fix relaxes the condition checks to verifying if the
cached data is strictly older than the real one.  Is it correct?  Are
there any invalid situations in which a real file's time is equal to
the cached file's times and therefore wcc shall be disabled?

Thank you.

PS: BTW, what does wcc stand for?

-- 
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/

------=_Part_14318_12884597.1162335619236
Content-Type: text/plain; name=patch.diff; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="patch.diff"

SW5kZXg6IG5mc19zdWJzLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2N2c3Jvb3Qvc3JjL3N5cy9u
ZnMvbmZzX3N1YnMuYyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4xNzYKZGlmZiAtdSAtcCAtcjEu
MTc2IG5mc19zdWJzLmMKLS0tIG5mc19zdWJzLmMJMjAgT2N0IDIwMDYgMTg6NTg6MTIgLTAwMDAJ
MS4xNzYKKysrIG5mc19zdWJzLmMJMzEgT2N0IDIwMDYgMjI6NDg6MjQgLTAwMDAKQEAgLTE5NDgs
NyArMTk0OCw3IEBAIG5mc19jaGVja193Y2NkYXRhKAogCQljb25zdCBjaGFyICpyZWFzb24gPSBO
VUxMOyAvKiBYWFg6IGdjYyAqLwogI2VuZGlmCiAKLQkJaWYgKHRpbWVzcGVjY21wKCZucC0+bl92
YXR0ci0+dmFfbXRpbWUsIG10aW1lLCA8PSkpIHsKKwkJaWYgKHRpbWVzcGVjY21wKCZucC0+bl92
YXR0ci0+dmFfbXRpbWUsIG10aW1lLCA8KSkgewogI2lmIGRlZmluZWQoREVCVUcpCiAJCQlyZWFz
b24gPSAibXRpbWUiOwogI2VuZGlmCkBAIC0xOTU2LDcgKzE5NTYsNyBAQCBuZnNfY2hlY2tfd2Nj
ZGF0YSgKIAkJfQogCiAJCWlmICh2cC0+dl90eXBlID09IFZESVIgJiYKLQkJICAgIHRpbWVzcGVj
Y21wKCZucC0+bl92YXR0ci0+dmFfY3RpbWUsIGN0aW1lLCA8PSkpIHsKKwkJICAgIHRpbWVzcGVj
Y21wKCZucC0+bl92YXR0ci0+dmFfY3RpbWUsIGN0aW1lLCA8KSkgewogI2lmIGRlZmluZWQoREVC
VUcpCiAJCQlyZWFzb24gPSAiY3RpbWUiOwogI2VuZGlmCg==
------=_Part_14318_12884597.1162335619236--