diff mbox series

[3/3] cifs: fix find_root_ses() when refresing dfs cache

Message ID 20210511163609.11019-4-pc@cjr.nz (mailing list archive)
State New, archived
Headers show
Series Support multiple ips per hostname | expand

Commit Message

Paulo Alcantara May 11, 2021, 4:36 p.m. UTC
get_tcp_server() and cifs_get_smb_ses() require most of the fs context
info in order to find the respective tcp and ses pointers, so before
calling them, dup original fs context and set new unc path with
cifs_setup_volume_info().

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
 fs/cifs/dfs_cache.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index 5c3129d4af1d..972aba397fdb 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -1430,6 +1430,12 @@  static struct cifs_ses *find_root_ses(struct vol_info *vi,
 	if (IS_ERR(rpath))
 		return ERR_CAST(rpath);
 
+	rc = smb3_fs_context_dup(&ctx, &vi->ctx);
+	if (rc) {
+		ses = ERR_PTR(rc);
+		goto out;
+	}
+
 	down_read(&htable_rw_lock);
 
 	ce = lookup_cache_entry(rpath, NULL);