Re: [PATCH v6] cifs: Support fscache indexing rewrite
From: David Howells
Date: Thu Jan 13 2022 - 11:20:43 EST
David Howells <dhowells@xxxxxxxxxx> wrote:
> - /*
> - * The cookie is initialized from volume info returned above.
> - * Inside cifs_fscache_get_super_cookie it checks
> - * that we do not get super cookie twice.
> - */
> - cifs_fscache_get_super_cookie(tcon);
> + if (!rc &&
> + (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE)) {
> + /*
> + * The cookie is initialized from volume info returned above.
> + * Inside cifs_fscache_get_super_cookie it checks
> + * that we do not get super cookie twice.
> + */
> + rc = cifs_fscache_get_super_cookie(tcon);
> + if (rc < 0) {
> + iget_failed(inode);
> + inode = ERR_PTR(rc);
> + }
> + }
This bit should've been removed - and the bit it is modifying was removed by
commit b774302e885697dde027825f8de9beb985d037bd which is now upstream.
The invocation of cifs_fscache_get_super_cookie() added by that commit should
be altered to make it conditional.
To this end, I've rebased the patch on linus/master and something
approximating the attached change needs to be made.
David
---
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index f977e02bd21e..598be9890f2a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3057,7 +3057,8 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
* Inside cifs_fscache_get_super_cookie it checks
* that we do not get super cookie twice.
*/
- cifs_fscache_get_super_cookie(tcon);
+ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE)
+ cifs_fscache_get_super_cookie(tcon);
out:
mnt_ctx->server = server;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 3c3bc28090d8..9b93e7d3e0e1 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1368,20 +1368,6 @@ struct inode *cifs_root_iget(struct super_block *sb)
inode = ERR_PTR(rc);
}
- if (!rc &&
- (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_FSCACHE)) {
- /*
- * The cookie is initialized from volume info returned above.
- * Inside cifs_fscache_get_super_cookie it checks
- * that we do not get super cookie twice.
- */
- rc = cifs_fscache_get_super_cookie(tcon);
- if (rc < 0) {
- iget_failed(inode);
- inode = ERR_PTR(rc);
- }
- }
-
out:
kfree(path);
free_xid(xid);