Skip to content

Commit 0210274

Browse files
committed
smb3: do not setup the fscache_super_cookie until fsinfo initialized
We were calling cifs_fscache_get_super_cookie after tcon but before we queried the info (QFS_Info) we need to initialize the cookie properly. Also includes an additional check suggested by Paulo to make sure we don't initialize super cookie twice. Suggested-by: David Howells <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 7f28af9 commit 0210274

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

fs/cifs/connect.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,8 +2350,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
23502350
list_add(&tcon->tcon_list, &ses->tcon_list);
23512351
spin_unlock(&cifs_tcp_ses_lock);
23522352

2353-
cifs_fscache_get_super_cookie(tcon);
2354-
23552353
return tcon;
23562354

23572355
out_fail:
@@ -3003,6 +3001,12 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
30033001
cifs_dbg(VFS, "read only mount of RW share\n");
30043002
/* no need to log a RW mount of a typical RW share */
30053003
}
3004+
/*
3005+
* The cookie is initialized from volume info returned above.
3006+
* Inside cifs_fscache_get_super_cookie it checks
3007+
* that we do not get super cookie twice.
3008+
*/
3009+
cifs_fscache_get_super_cookie(tcon);
30063010
}
30073011

30083012
/*

fs/cifs/fscache.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ void cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
8787
char *sharename;
8888
struct cifs_fscache_super_auxdata auxdata;
8989

90+
/*
91+
* Check if cookie was already initialized so don't reinitialize it.
92+
* In the future, as we integrate with newer fscache features,
93+
* we may want to instead add a check if cookie has changed
94+
*/
95+
if (tcon->fscache == NULL)
96+
return;
97+
9098
sharename = extract_sharename(tcon->treeName);
9199
if (IS_ERR(sharename)) {
92100
cifs_dbg(FYI, "%s: couldn't extract sharename\n", __func__);

0 commit comments

Comments
 (0)