Bug 435443 - Add patch to prevent NFS cache invalidation after write calls
Add patch to prevent NFS cache invalidation after write calls
Status: CLOSED DUPLICATE of bug 427385
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.6
All Linux
low Severity low
: rc
: ---
Assigned To: Jeff Layton
Martin Jenner
:
Depends On:
Blocks: 436132 461304
  Show dependency treegraph
 
Reported: 2008-02-29 06:56 EST by Jeff Layton
Modified: 2008-09-22 10:53 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-09-22 10:53:39 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch1 -- NFSv4: Add post-op attributes to NFSv4 write and commit callbacks. (5.51 KB, patch)
2008-02-29 11:11 EST, Jeff Layton
no flags Details | Diff
patch2 -- NFS: Clean up inode metadata updates (2.41 KB, patch)
2008-02-29 11:12 EST, Jeff Layton
no flags Details | Diff
patch3 -- NFS: Fake up 'wcc' attributes to prevent cache invalidation after write (6.41 KB, patch)
2008-02-29 11:12 EST, Jeff Layton
no flags Details | Diff
patch1 -- NFSv4: Add post-op attributes to NFSv4 write and commit callbacks (5.51 KB, patch)
2008-03-04 16:29 EST, Jeff Layton
no flags Details | Diff

  None (edit)
Description Jeff Layton 2008-02-29 06:56:38 EST
During a discussion on the phone the other day, it was mentioned that we should
not be trying to invalidate the cache after a write call completes. 

With a cursory look, I think we'll likely need this patch backported for RHEL4
(commitid is from Trond's nfs-2.6 git tree):

commit 70ca88521fc7bee8ef0fc22033a439d4b9a2c70d
Author: Trond Myklebust <Trond.Myklebust@netapp.com>
Date:   Sun Sep 30 15:21:24 2007 -0400

    NFS: Fake up 'wcc' attributes to prevent cache invalidation after write
    
    NFSv2 and v4 don't offer weak cache consistency attributes on WRITE calls.
    In NFSv3, returning wcc data is optional. In all cases, we want to prevent
    the client from invalidating our cached data whenever ->write_done()
    attempts to update the inode attributes.
    
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

We'll probably need to come up with some sort of reproducer for this so that we
can quantify whether this actually helps things.
Comment 1 Jeff Layton 2008-02-29 06:57:40 EST
For RHEL5, it looks like the above patch went in as part of Peter's big
performance update in bug 321111.
Comment 2 Jeff Layton 2008-02-29 10:36:21 EST
I suppose we can start by trying this test. Presumably the first read should be
as fast as the "reread" if the patch is working correctly. Sniffing traffic
should also tell us (and maybe looking at nfsstat -c).

# /opt/iozone/bin/iozone -azc -f /mnt/test/testfile -s 64k -r 64 -i 0 -i 1
Comment 3 Jeff Layton 2008-02-29 11:11:47 EST
Created attachment 296373 [details]
patch1 -- NFSv4: Add post-op attributes to NFSv4 write and commit callbacks.
Comment 4 Jeff Layton 2008-02-29 11:12:22 EST
Created attachment 296374 [details]
patch2 -- NFS: Clean up inode metadata updates
Comment 5 Jeff Layton 2008-02-29 11:12:55 EST
Created attachment 296376 [details]
patch3 -- NFS: Fake up 'wcc' attributes to prevent cache invalidation after write
Comment 6 Jeff Layton 2008-02-29 11:15:12 EST
I've attached a set of 3 experimental patches to implement what Peter suggested
the other day in our meeting. This seems to correct the iozone slowdowns in the
testing I've done.

I'm building a new set of test kernels now and will post them on my people page
once they're done...

Comment 7 Jeff Layton 2008-02-29 11:25:57 EST
I've put this on 4.8 proposed, but I'm not opposed to considering this for 4.7
if it's deemed important enough. This of course presumes no regressions show up
in testing.

That said, it seems like this might cause a few more problems with cache
consistency. Consider:

client writes to file and has up to date cache
client writes to file again and doesn't invalidate cache since we've faked up
the wcc preattrs local timestamp is set to mtime of file
server races in with a write from local process or another client within the
same second
client doesn't realize the file has changed

...before this patchset, the client would have probably invalidated the cache
after the second write. Given the other possible races due to coarse mtime
granularity, this probably isn't a huge issue but its something we should keep
in mind.
Comment 8 Jeff Layton 2008-02-29 13:27:48 EST
I've put some patches up on my people page with this patchset:

http://people.redhat.com/jlayton/
Comment 9 Jeff Layton 2008-02-29 13:30:08 EST
Steven,
   Would it be possible for your customer to test
kernel-2.6.9-68.16.EL.jtltest.31 someplace non-critical and let us know if this
helps them at all?

Note that this kernel *also* contains a patch to fix a lockd race that can
seriously affect performance as well, so if it does help we'll still likely need
to have them verify whether it's this patch that actually helps...
Comment 10 Jeff Layton 2008-03-04 16:29:38 EST
Created attachment 296811 [details]
patch1 -- NFSv4: Add post-op attributes to NFSv4 write and commit callbacks

Fixed patch1 -- the original one had a bad merge of nops changes for write and
commit. So much of this file looks alike that it confuses the patch program and
it ends up merging changes into the wrong place.

Building a new test kernel now. The problem should only have affected NFSv4, so
it's doubtful this will make any difference on NFSv2/3.
Comment 11 RHEL Product and Program Management 2008-09-03 09:17:12 EDT
Updating PM score.
Comment 12 Jeff Layton 2008-09-22 10:53:39 EDT

*** This bug has been marked as a duplicate of bug 427385 ***

Note You need to log in before you can comment on or make changes to this bug.