Skip to content

Commit b774302

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: ignore resource_id while getting fscache super cookie
We have a cyclic dependency between fscache super cookie and root inode cookie. The super cookie relies on tcon->resource_id, which gets populated from the root inode number. However, fetching the root inode initializes inode cookie as a child of super cookie, which is yet to be populated. resource_id is only used as auxdata to check the validity of super cookie. We can completely avoid setting resource_id to remove the circular dependency. Since vol creation time and vol serial numbers are used for auxdata, we should be fine. Additionally, there will be auxiliary data check for each inode cookie as well. Fixes: 5bf91ef ("cifs: wait for tcon resource_id before getting fscache super") CC: David Howells <[email protected]> Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 2585cf9 commit b774302

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

fs/cifs/connect.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,6 +3064,13 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
30643064
(cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)))
30653065
cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx);
30663066

3067+
/*
3068+
* The cookie is initialized from volume info returned above.
3069+
* Inside cifs_fscache_get_super_cookie it checks
3070+
* that we do not get super cookie twice.
3071+
*/
3072+
cifs_fscache_get_super_cookie(tcon);
3073+
30673074
out:
30683075
mnt_ctx->server = server;
30693076
mnt_ctx->ses = ses;

fs/cifs/inode.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,11 +1356,6 @@ struct inode *cifs_root_iget(struct super_block *sb)
13561356
goto out;
13571357
}
13581358

1359-
#ifdef CONFIG_CIFS_FSCACHE
1360-
/* populate tcon->resource_id */
1361-
tcon->resource_id = CIFS_I(inode)->uniqueid;
1362-
#endif
1363-
13641359
if (rc && tcon->pipe) {
13651360
cifs_dbg(FYI, "ipc connection - fake read inode\n");
13661361
spin_lock(&inode->i_lock);
@@ -1375,14 +1370,6 @@ struct inode *cifs_root_iget(struct super_block *sb)
13751370
iget_failed(inode);
13761371
inode = ERR_PTR(rc);
13771372
}
1378-
1379-
/*
1380-
* The cookie is initialized from volume info returned above.
1381-
* Inside cifs_fscache_get_super_cookie it checks
1382-
* that we do not get super cookie twice.
1383-
*/
1384-
cifs_fscache_get_super_cookie(tcon);
1385-
13861373
out:
13871374
kfree(path);
13881375
free_xid(xid);

0 commit comments

Comments
 (0)