Commit b774302e authored by Shyam Prasad N's avatar Shyam Prasad N Committed by Steve French

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: 5bf91ef0 ("cifs: wait for tcon resource_id before getting fscache super")
CC: David Howells <dhowells@redhat.com>
Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 2585cf9d
...@@ -3064,6 +3064,13 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx) ...@@ -3064,6 +3064,13 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
(cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)))
cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx);
/*
* 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);
out: out:
mnt_ctx->server = server; mnt_ctx->server = server;
mnt_ctx->ses = ses; mnt_ctx->ses = ses;
......
...@@ -1356,11 +1356,6 @@ struct inode *cifs_root_iget(struct super_block *sb) ...@@ -1356,11 +1356,6 @@ struct inode *cifs_root_iget(struct super_block *sb)
goto out; goto out;
} }
#ifdef CONFIG_CIFS_FSCACHE
/* populate tcon->resource_id */
tcon->resource_id = CIFS_I(inode)->uniqueid;
#endif
if (rc && tcon->pipe) { if (rc && tcon->pipe) {
cifs_dbg(FYI, "ipc connection - fake read inode\n"); cifs_dbg(FYI, "ipc connection - fake read inode\n");
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
...@@ -1375,14 +1370,6 @@ struct inode *cifs_root_iget(struct super_block *sb) ...@@ -1375,14 +1370,6 @@ struct inode *cifs_root_iget(struct super_block *sb)
iget_failed(inode); iget_failed(inode);
inode = ERR_PTR(rc); inode = ERR_PTR(rc);
} }
/*
* 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);
out: out:
kfree(path); kfree(path);
free_xid(xid); free_xid(xid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment