@@ -152,117 +152,6 @@ smb2_hdr_assemble(struct smb2_sync_hdr *shdr, __le16 smb2_cmd,
152152 return ;
153153}
154154
155- #ifdef CONFIG_CIFS_DFS_UPCALL
156- static int __smb2_reconnect (const struct nls_table * nlsc ,
157- struct cifs_tcon * tcon )
158- {
159- int rc ;
160- struct TCP_Server_Info * server = tcon -> ses -> server ;
161- struct dfs_cache_tgt_list tl ;
162- struct dfs_cache_tgt_iterator * it = NULL ;
163- char * tree ;
164- const char * tcp_host ;
165- size_t tcp_host_len ;
166- const char * dfs_host ;
167- size_t dfs_host_len ;
168-
169- tree = kzalloc (MAX_TREE_SIZE , GFP_KERNEL );
170- if (!tree )
171- return - ENOMEM ;
172-
173- if (!tcon -> dfs_path ) {
174- if (tcon -> ipc ) {
175- scnprintf (tree , MAX_TREE_SIZE , "\\\\%s\\IPC$" ,
176- server -> hostname );
177- rc = SMB2_tcon (0 , tcon -> ses , tree , tcon , nlsc );
178- } else {
179- rc = SMB2_tcon (0 , tcon -> ses , tcon -> treeName , tcon ,
180- nlsc );
181- }
182- goto out ;
183- }
184-
185- rc = dfs_cache_noreq_find (tcon -> dfs_path + 1 , NULL , & tl );
186- if (rc )
187- goto out ;
188-
189- extract_unc_hostname (server -> hostname , & tcp_host , & tcp_host_len );
190-
191- for (it = dfs_cache_get_tgt_iterator (& tl ); it ;
192- it = dfs_cache_get_next_tgt (& tl , it )) {
193- const char * share , * prefix ;
194- size_t share_len , prefix_len ;
195- bool target_match ;
196-
197- rc = dfs_cache_get_tgt_share (it , & share , & share_len , & prefix ,
198- & prefix_len );
199- if (rc ) {
200- cifs_dbg (VFS , "%s: failed to parse target share %d\n" ,
201- __func__ , rc );
202- continue ;
203- }
204-
205- extract_unc_hostname (share , & dfs_host , & dfs_host_len );
206-
207- if (dfs_host_len != tcp_host_len
208- || strncasecmp (dfs_host , tcp_host , dfs_host_len ) != 0 ) {
209- cifs_dbg (FYI , "%s: %.*s doesn't match %.*s\n" ,
210- __func__ ,
211- (int )dfs_host_len , dfs_host ,
212- (int )tcp_host_len , tcp_host );
213-
214- rc = match_target_ip (server , dfs_host , dfs_host_len ,
215- & target_match );
216- if (rc ) {
217- cifs_dbg (VFS , "%s: failed to match target ip: %d\n" ,
218- __func__ , rc );
219- break ;
220- }
221-
222- if (!target_match ) {
223- cifs_dbg (FYI , "%s: skipping target\n" , __func__ );
224- continue ;
225- }
226- }
227-
228- if (tcon -> ipc ) {
229- scnprintf (tree , MAX_TREE_SIZE , "\\\\%.*s\\IPC$" ,
230- (int )share_len , share );
231- rc = SMB2_tcon (0 , tcon -> ses , tree , tcon , nlsc );
232- } else {
233- scnprintf (tree , MAX_TREE_SIZE , "\\%.*s" , (int )share_len ,
234- share );
235- rc = SMB2_tcon (0 , tcon -> ses , tree , tcon , nlsc );
236- if (!rc ) {
237- rc = update_super_prepath (tcon , prefix ,
238- prefix_len );
239- break ;
240- }
241- }
242- if (rc == - EREMOTE )
243- break ;
244- }
245-
246- if (!rc ) {
247- if (it )
248- rc = dfs_cache_noreq_update_tgthint (tcon -> dfs_path + 1 ,
249- it );
250- else
251- rc = - ENOENT ;
252- }
253- dfs_cache_free_tgts (& tl );
254- out :
255- kfree (tree );
256- return rc ;
257- }
258- #else
259- static inline int __smb2_reconnect (const struct nls_table * nlsc ,
260- struct cifs_tcon * tcon )
261- {
262- return SMB2_tcon (0 , tcon -> ses , tcon -> treeName , tcon , nlsc );
263- }
264- #endif
265-
266155static int
267156smb2_reconnect (__le16 smb2_command , struct cifs_tcon * tcon ,
268157 struct TCP_Server_Info * server )
@@ -409,7 +298,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
409298 if (tcon -> use_persistent )
410299 tcon -> need_reopen_files = true;
411300
412- rc = __smb2_reconnect ( nls_codepage , tcon );
301+ rc = cifs_tree_connect ( 0 , tcon , nls_codepage );
413302 mutex_unlock (& tcon -> ses -> session_mutex );
414303
415304 cifs_dbg (FYI , "reconnect tcon rc = %d\n" , rc );
0 commit comments