[PATCH] nfs: reset cookieverf even when no cached pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nagendra S Tomar <natomar@xxxxxxxxxxxxx>

If NFS_INO_INVALID_DATA cache_validity flag is set, a subsequent call
to nfs_invalidate_mapping() does the following two things:

 1. Clears mapping.
 2. Resets cookieverf to 0, if inode refers to a directory.

If there are no mapped pages, we don't need #1, but we still need #2.

Signed-off-by: Nagendra S Tomar <natomar@xxxxxxxxxxxxx>
---
 fs/nfs/inode.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index aa6493905bbe..40f2bfaa4e46 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -209,8 +209,13 @@ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
 				| NFS_INO_INVALID_XATTR);
 	}
 
-	if (inode->i_mapping->nrpages == 0)
+	if (inode->i_mapping->nrpages == 0) {
+		if (S_ISDIR(inode->i_mode) &&
+		    (flags & (NFS_INO_INVALID_DATA | NFS_INO_DATA_INVAL_DEFER)))
+			memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
 		flags &= ~(NFS_INO_INVALID_DATA|NFS_INO_DATA_INVAL_DEFER);
+	}
+
 	nfsi->cache_validity |= flags;
 	if (flags & NFS_INO_INVALID_DATA)
 		nfs_fscache_invalidate(inode);




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux