Skip to contentSkip to conversation

Patch "NFS: Don't revalidate the mapping if both size and change attr are up to date" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Aug 8, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

NFS: Don't revalidate the mapping if both size and change attr are up to date

to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
nfs-don-t-revalidate-the-mapping-if-both-size-and-change-attr-are-up-to-date.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 85a23cee3f2c928475f31777ead5a71340a12fc3 Mon Sep 17 00:00:00 2001

From: Trond Myklebust <[email protected]>
Date: Sun, 5 Jul 2015 11:02:53 -0400
Subject: NFS: Don't revalidate the mapping if both size and change attr are up to date

From: Trond Myklebust <[email protected]>

commit 85a23cee3f2c928475f31777ead5a71340a12fc3 upstream.

If we've ensured that the size and the change attribute are both correct, then there is no point in marking those attributes as needing revalidation again. Only do so if we know the size is incorrect and was not updated.

Fixes f2467b6f64da ("NFS: Clear NFS_INO_REVAL_PAGECACHE when...")
---
 fs/nfs/inode.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/nfs/inode.c +4 -4
@@ -1242,9 +1242,11 @@ static int nfs_check_inode_attributes(st
 	if (fattr->valid & NFS_ATTR_FATTR_SIZE) {
 		cur_size = i_size_read(inode);
 		new_isize = nfs_size_to_loff_t(fattr->size);
-		if (cur_size != new_isize && nfsi->nrequests == 0)
+		if (cur_size != new_isize)
 			invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
 	}
+	if (nfsi->nrequests != 0)
+		invalid &= ~NFS_INO_REVAL_PAGECACHE;
 
 	/* Have any file permissions changed? */
 	if ((fattr->valid & NFS_ATTR_FATTR_MODE) && (inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO))
@@ -1682,8 +1684,7 @@ static int nfs_update_inode(struct inode
 			invalid |= NFS_INO_INVALID_ATTR
 				| NFS_INO_INVALID_DATA
 				| NFS_INO_INVALID_ACCESS
-				| NFS_INO_INVALID_ACL
-				| NFS_INO_REVAL_PAGECACHE;
+				| NFS_INO_INVALID_ACL;
 			if (S_ISDIR(inode->i_mode))
 				nfs_force_lookup_revalidate(inode);
 			inode->i_version = fattr->change_attr;
@@ -1715,7 +1716,6 @@ static int nfs_update_inode(struct inode
 			if ((nfsi->nrequests == 0) || new_isize > cur_isize) {
 				i_size_write(inode, new_isize);
 				invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
-				invalid &= ~NFS_INO_REVAL_PAGECACHE;
 			}
 			dprintk("NFS: isize change on server for file %s/%ld "
 					"(%Ld to %Ld)\n",

Patches currently in stable-queue which might be from [email protected] are

queue-4.1/nfsv4-we-must-set-nfs_open_state-flag-in-nfs_resync_open_stateid_locked.patch queue-4.1/nfs-fix-a-memory-leak-in-nfs_do_recoalesce.patch queue-4.1/nfs-don-t-revalidate-the-mapping-if-both-size-and-change-attr-are-up-to-date.patch