Skip to content

Commit 2275c6b

Browse files
committed
Merge tag '5.19-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs client fixes from Steve French: "Three reconnect fixes, all for stable as well. One of these three reconnect fixes does address a problem with multichannel reconnect, but this does not include the additional fix (still being tested) for dynamically detecting multichannel adapter changes which will improve those reconnect scenarios even more" * tag '5.19-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: populate empty hostnames for extra channels cifs: return errors during session setup during reconnects cifs: fix reconnect on smb3 mount types
2 parents 3cae0d8 + 4c14d70 commit 2275c6b

File tree

6 files changed

+29
-14
lines changed

6 files changed

+29
-14
lines changed

fs/cifs/cifsfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ struct file_system_type cifs_fs_type = {
10861086
};
10871087
MODULE_ALIAS_FS("cifs");
10881088

1089-
static struct file_system_type smb3_fs_type = {
1089+
struct file_system_type smb3_fs_type = {
10901090
.owner = THIS_MODULE,
10911091
.name = "smb3",
10921092
.init_fs_context = smb3_init_fs_context,

fs/cifs/cifsfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static inline unsigned long cifs_get_time(struct dentry *dentry)
3838
return (unsigned long) dentry->d_fsdata;
3939
}
4040

41-
extern struct file_system_type cifs_fs_type;
41+
extern struct file_system_type cifs_fs_type, smb3_fs_type;
4242
extern const struct address_space_operations cifs_addr_ops;
4343
extern const struct address_space_operations cifs_addr_ops_smallbuf;
4444

fs/cifs/connect.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
9797
if (!server->hostname)
9898
return -EINVAL;
9999

100+
/* if server hostname isn't populated, there's nothing to do here */
101+
if (server->hostname[0] == '\0')
102+
return 0;
103+
100104
len = strlen(server->hostname) + 3;
101105

102106
unc = kmalloc(len, GFP_KERNEL);

fs/cifs/misc.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,18 +1211,23 @@ static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void
12111211
.data = data,
12121212
.sb = NULL,
12131213
};
1214+
struct file_system_type **fs_type = (struct file_system_type *[]) {
1215+
&cifs_fs_type, &smb3_fs_type, NULL,
1216+
};
12141217

1215-
iterate_supers_type(&cifs_fs_type, f, &sd);
1216-
1217-
if (!sd.sb)
1218-
return ERR_PTR(-EINVAL);
1219-
/*
1220-
* Grab an active reference in order to prevent automounts (DFS links)
1221-
* of expiring and then freeing up our cifs superblock pointer while
1222-
* we're doing failover.
1223-
*/
1224-
cifs_sb_active(sd.sb);
1225-
return sd.sb;
1218+
for (; *fs_type; fs_type++) {
1219+
iterate_supers_type(*fs_type, f, &sd);
1220+
if (sd.sb) {
1221+
/*
1222+
* Grab an active reference in order to prevent automounts (DFS links)
1223+
* of expiring and then freeing up our cifs superblock pointer while
1224+
* we're doing failover.
1225+
*/
1226+
cifs_sb_active(sd.sb);
1227+
return sd.sb;
1228+
}
1229+
}
1230+
return ERR_PTR(-EINVAL);
12261231
}
12271232

12281233
static void __cifs_put_super(struct super_block *sb)

fs/cifs/sess.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
301301
/* Auth */
302302
ctx.domainauto = ses->domainAuto;
303303
ctx.domainname = ses->domainName;
304-
ctx.server_hostname = ses->server->hostname;
304+
305+
/* no hostname for extra channels */
306+
ctx.server_hostname = "";
307+
305308
ctx.username = ses->user_name;
306309
ctx.password = ses->password;
307310
ctx.sectype = ses->sectype;

fs/cifs/smb2pdu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
288288
mutex_unlock(&ses->session_mutex);
289289
rc = -EHOSTDOWN;
290290
goto failed;
291+
} else if (rc) {
292+
mutex_unlock(&ses->session_mutex);
293+
goto out;
291294
}
292295
} else {
293296
mutex_unlock(&ses->session_mutex);

0 commit comments

Comments
 (0)