@@ -4141,14 +4141,13 @@ static int target_share_matches_server(struct TCP_Server_Info *server, const cha
4141
4141
}
4142
4142
4143
4143
static int __tree_connect_dfs_target (const unsigned int xid , struct cifs_tcon * tcon ,
4144
- struct cifs_sb_info * cifs_sb , char * tree ,
4145
- struct dfs_cache_tgt_list * tl , struct dfs_info3_param * ref )
4144
+ struct cifs_sb_info * cifs_sb , char * tree , bool islink ,
4145
+ struct dfs_cache_tgt_list * tl )
4146
4146
{
4147
4147
int rc ;
4148
4148
struct TCP_Server_Info * server = tcon -> ses -> server ;
4149
4149
const struct smb_version_operations * ops = server -> ops ;
4150
4150
struct cifs_tcon * ipc = tcon -> ses -> tcon_ipc ;
4151
- bool islink ;
4152
4151
char * share = NULL , * prefix = NULL ;
4153
4152
const char * tcp_host ;
4154
4153
size_t tcp_host_len ;
@@ -4157,9 +4156,6 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
4157
4156
4158
4157
extract_unc_hostname (server -> hostname , & tcp_host , & tcp_host_len );
4159
4158
4160
- islink = ref -> server_type == DFS_TYPE_LINK ;
4161
- free_dfs_info_param (ref );
4162
-
4163
4159
tit = dfs_cache_get_tgt_iterator (tl );
4164
4160
if (!tit ) {
4165
4161
rc = - ENOENT ;
@@ -4173,6 +4169,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
4173
4169
4174
4170
kfree (share );
4175
4171
kfree (prefix );
4172
+ share = prefix = NULL ;
4176
4173
4177
4174
/* Check if share matches with tcp ses */
4178
4175
rc = dfs_cache_get_tgt_share (server -> current_fullpath + 1 , tit , & share , & prefix );
@@ -4209,25 +4206,23 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
4209
4206
* newly resolved target.
4210
4207
*/
4211
4208
if (dfs_cache_find (xid , tcon -> ses , cifs_sb -> local_nls , cifs_remap (cifs_sb ), target ,
4212
- ref , & ntl )) {
4209
+ NULL , & ntl )) {
4213
4210
rc = ops -> tree_connect (xid , tcon -> ses , tree , tcon , cifs_sb -> local_nls );
4214
4211
if (rc )
4215
4212
continue ;
4216
4213
rc = dfs_cache_noreq_update_tgthint (server -> current_fullpath + 1 , tit );
4217
4214
if (!rc )
4218
4215
rc = cifs_update_super_prepath (cifs_sb , prefix );
4219
- break ;
4220
- }
4221
- /* Target is another dfs share */
4222
- rc = update_server_fullpath (server , cifs_sb , target );
4223
- dfs_cache_free_tgts (tl );
4224
-
4225
- if (!rc ) {
4226
- rc = - EREMOTE ;
4227
- list_replace_init (& ntl .tl_list , & tl -> tl_list );
4228
4216
} else {
4229
- dfs_cache_free_tgts (& ntl );
4230
- free_dfs_info_param (ref );
4217
+ /* Target is another dfs share */
4218
+ rc = update_server_fullpath (server , cifs_sb , target );
4219
+ dfs_cache_free_tgts (tl );
4220
+
4221
+ if (!rc ) {
4222
+ rc = - EREMOTE ;
4223
+ list_replace_init (& ntl .tl_list , & tl -> tl_list );
4224
+ } else
4225
+ dfs_cache_free_tgts (& ntl );
4231
4226
}
4232
4227
break ;
4233
4228
}
@@ -4240,15 +4235,15 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t
4240
4235
}
4241
4236
4242
4237
static int tree_connect_dfs_target (const unsigned int xid , struct cifs_tcon * tcon ,
4243
- struct cifs_sb_info * cifs_sb , char * tree ,
4244
- struct dfs_cache_tgt_list * tl , struct dfs_info3_param * ref )
4238
+ struct cifs_sb_info * cifs_sb , char * tree , bool islink ,
4239
+ struct dfs_cache_tgt_list * tl )
4245
4240
{
4246
4241
int rc ;
4247
4242
int num_links = 0 ;
4248
4243
struct TCP_Server_Info * server = tcon -> ses -> server ;
4249
4244
4250
4245
do {
4251
- rc = __tree_connect_dfs_target (xid , tcon , cifs_sb , tree , tl , ref );
4246
+ rc = __tree_connect_dfs_target (xid , tcon , cifs_sb , tree , islink , tl );
4252
4247
if (!rc || rc != - EREMOTE )
4253
4248
break ;
4254
4249
} while (rc = - ELOOP , ++ num_links < MAX_NESTED_LINKS );
@@ -4302,7 +4297,9 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru
4302
4297
goto out ;
4303
4298
}
4304
4299
4305
- rc = tree_connect_dfs_target (xid , tcon , cifs_sb , tree , & tl , & ref );
4300
+ rc = tree_connect_dfs_target (xid , tcon , cifs_sb , tree , ref .server_type == DFS_TYPE_LINK ,
4301
+ & tl );
4302
+ free_dfs_info_param (& ref );
4306
4303
4307
4304
out :
4308
4305
kfree (tree );
0 commit comments