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: 5bf91ef03d98 ("cifs: wait for tcon resource_id before getting fscache super")
CC: David Howells <dhowells@redhat.com>
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by Shyam Prasad N and committed by Steve French b774302e 2585cf9d

+7 -13
+7
fs/cifs/connect.c
··· 3064 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) 3065 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); 3066 3067 out: 3068 mnt_ctx->server = server; 3069 mnt_ctx->ses = ses;
··· 3064 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) 3065 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); 3066 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 + 3074 out: 3075 mnt_ctx->server = server; 3076 mnt_ctx->ses = ses;
-13
fs/cifs/inode.c
··· 1356 goto out; 1357 } 1358 1359 - #ifdef CONFIG_CIFS_FSCACHE 1360 - /* populate tcon->resource_id */ 1361 - tcon->resource_id = CIFS_I(inode)->uniqueid; 1362 - #endif 1363 - 1364 if (rc && tcon->pipe) { 1365 cifs_dbg(FYI, "ipc connection - fake read inode\n"); 1366 spin_lock(&inode->i_lock); ··· 1370 iget_failed(inode); 1371 inode = ERR_PTR(rc); 1372 } 1373 - 1374 - /* 1375 - * The cookie is initialized from volume info returned above. 1376 - * Inside cifs_fscache_get_super_cookie it checks 1377 - * that we do not get super cookie twice. 1378 - */ 1379 - cifs_fscache_get_super_cookie(tcon); 1380 - 1381 out: 1382 kfree(path); 1383 free_xid(xid);
··· 1356 goto out; 1357 } 1358 1359 if (rc && tcon->pipe) { 1360 cifs_dbg(FYI, "ipc connection - fake read inode\n"); 1361 spin_lock(&inode->i_lock); ··· 1375 iget_failed(inode); 1376 inode = ERR_PTR(rc); 1377 } 1378 out: 1379 kfree(path); 1380 free_xid(xid);