linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: Invalidate fscache cookie
@ 2022-02-01  7:36 Rohith Surabattula
  2022-02-04  9:07 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Rohith Surabattula @ 2022-02-01  7:36 UTC (permalink / raw)
  To: Steve French, linux-cifs, Shyam Prasad N, David Howells, ronnie sahlberg

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

Hi All,

Currently, FScache is getting invalidated during close of the file. It
should be invalidated only when there is change in inode attributes.

Please find the below patch which will address the fscache invalidation.

Regards,
Rohith

[-- Attachment #2: Invalidate-fscache-cookie-only-when-inode-attributes.patch --]
[-- Type: application/octet-stream, Size: 1769 bytes --]

From 9651307e90755ac82e6a1ff3e82c294cde2c7eb2 Mon Sep 17 00:00:00 2001
From: Rohith Surabattula <rohiths@microsoft.com>
Date: Tue, 1 Feb 2022 07:22:02 +0000
Subject: [PATCH] Invalidate fscache cookie only when inode attributes are
 changed.

Signed-off-by: Rohith Surabattula <rohiths@microsoft.com>
---
 fs/cifs/inode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 7d8b3ceb2af3..60d853c92f6a 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -83,6 +83,7 @@ static void cifs_set_ops(struct inode *inode)
 static void
 cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
 {
+	struct cifs_fscache_inode_coherency_data cd;
 	struct cifsInodeInfo *cifs_i = CIFS_I(inode);
 
 	cifs_dbg(FYI, "%s: revalidating inode %llu\n",
@@ -113,6 +114,9 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
 	cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n",
 		 __func__, cifs_i->uniqueid);
 	set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);
+	/* Invalidate fscache cookie */
+	cifs_fscache_fill_coherency(&cifs_i->vfs_inode, &cd);
+	fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);
 }
 
 /*
@@ -2261,8 +2265,6 @@ cifs_dentry_needs_reval(struct dentry *dentry)
 int
 cifs_invalidate_mapping(struct inode *inode)
 {
-	struct cifs_fscache_inode_coherency_data cd;
-	struct cifsInodeInfo *cifsi = CIFS_I(inode);
 	int rc = 0;
 
 	if (inode->i_mapping && inode->i_mapping->nrpages != 0) {
@@ -2272,8 +2274,6 @@ cifs_invalidate_mapping(struct inode *inode)
 				 __func__, inode);
 	}
 
-	cifs_fscache_fill_coherency(&cifsi->vfs_inode, &cd);
-	fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);
 	return rc;
 }
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cifs: Invalidate fscache cookie
  2022-02-01  7:36 [PATCH] cifs: Invalidate fscache cookie Rohith Surabattula
@ 2022-02-04  9:07 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2022-02-04  9:07 UTC (permalink / raw)
  To: Rohith Surabattula
  Cc: dhowells, Steve French, linux-cifs, Shyam Prasad N, ronnie sahlberg

Rohith Surabattula <rohiths.msft@gmail.com> wrote:

> +	/* Invalidate fscache cookie */
> +	cifs_fscache_fill_coherency(&cifs_i->vfs_inode, &cd);
> +	fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);

There's a helper for that - cifs_invalidate_cache(inode, 0) - I should've made
it use it.

David


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-04  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01  7:36 [PATCH] cifs: Invalidate fscache cookie Rohith Surabattula
2022-02-04  9:07 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).