Skip to content

Commit 17e7124

Browse files
committed
Merge tag '5.12-rc6-smb3' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Three cifs/smb3 fixes, two for stable: a reconnect fix and a fix for display of devnames with special characters" * tag '5.12-rc6-smb3' of git://git.samba.org/sfrench/cifs-2.6: cifs: escape spaces in share names fs: cifs: Remove unnecessary struct declaration cifs: On cifs_reconnect, resolve the hostname again.
2 parents 4fa56ad + 0fc9322 commit 17e7124

5 files changed

Lines changed: 22 additions & 8 deletions

File tree

fs/cifs/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ config CIFS
1818
select CRYPTO_AES
1919
select CRYPTO_LIB_DES
2020
select KEYS
21+
select DNS_RESOLVER
2122
help
2223
This is the client VFS module for the SMB3 family of NAS protocols,
2324
(including support for the most recent, most secure dialect SMB3.1.1)
@@ -112,7 +113,6 @@ config CIFS_WEAK_PW_HASH
112113
config CIFS_UPCALL
113114
bool "Kerberos/SPNEGO advanced session setup"
114115
depends on CIFS
115-
select DNS_RESOLVER
116116
help
117117
Enables an upcall mechanism for CIFS which accesses userspace helper
118118
utilities to provide SPNEGO packaged (RFC 4178) Kerberos tickets
@@ -179,7 +179,6 @@ config CIFS_DEBUG_DUMP_KEYS
179179
config CIFS_DFS_UPCALL
180180
bool "DFS feature support"
181181
depends on CIFS
182-
select DNS_RESOLVER
183182
help
184183
Distributed File System (DFS) support is used to access shares
185184
transparently in an enterprise name space, even if the share

fs/cifs/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \
1010
cifs_unicode.o nterr.o cifsencrypt.o \
1111
readdir.o ioctl.o sess.o export.o smb1ops.o unc.o winucase.o \
1212
smb2ops.o smb2maperror.o smb2transport.o \
13-
smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o
13+
smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o \
14+
dns_resolve.o
1415

1516
cifs-$(CONFIG_CIFS_XATTR) += xattr.o
1617

1718
cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o
1819

19-
cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o dfs_cache.o
20+
cifs-$(CONFIG_CIFS_DFS_UPCALL) += cifs_dfs_ref.o dfs_cache.o
2021

2122
cifs-$(CONFIG_CIFS_SWN_UPCALL) += netlink.o cifs_swn.o
2223

fs/cifs/cifsfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ static int cifs_show_devname(struct seq_file *m, struct dentry *root)
476476
seq_puts(m, "none");
477477
else {
478478
convert_delimiter(devname, '/');
479-
seq_puts(m, devname);
479+
/* escape all spaces in share names */
480+
seq_escape(m, devname, " \t");
480481
kfree(devname);
481482
}
482483
return 0;

fs/cifs/cifsglob.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,8 +1283,6 @@ struct cifs_aio_ctx {
12831283
bool direct_io;
12841284
};
12851285

1286-
struct cifs_readdata;
1287-
12881286
/* asynchronous read support */
12891287
struct cifs_readdata {
12901288
struct kref refcount;

fs/cifs/connect.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ static void cifs_prune_tlinks(struct work_struct *work);
8787
*
8888
* This should be called with server->srv_mutex held.
8989
*/
90-
#ifdef CONFIG_CIFS_DFS_UPCALL
9190
static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
9291
{
9392
int rc;
@@ -124,6 +123,7 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
124123
return !rc ? -1 : 0;
125124
}
126125

126+
#ifdef CONFIG_CIFS_DFS_UPCALL
127127
/* These functions must be called with server->srv_mutex held */
128128
static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
129129
struct cifs_sb_info *cifs_sb,
@@ -321,14 +321,29 @@ cifs_reconnect(struct TCP_Server_Info *server)
321321
#endif
322322

323323
#ifdef CONFIG_CIFS_DFS_UPCALL
324+
if (cifs_sb && cifs_sb->origin_fullpath)
324325
/*
325326
* Set up next DFS target server (if any) for reconnect. If DFS
326327
* feature is disabled, then we will retry last server we
327328
* connected to before.
328329
*/
329330
reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
331+
else {
332+
#endif
333+
/*
334+
* Resolve the hostname again to make sure that IP address is up-to-date.
335+
*/
336+
rc = reconn_set_ipaddr_from_hostname(server);
337+
if (rc) {
338+
cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n",
339+
__func__, rc);
340+
}
341+
342+
#ifdef CONFIG_CIFS_DFS_UPCALL
343+
}
330344
#endif
331345

346+
332347
#ifdef CONFIG_CIFS_SWN_UPCALL
333348
}
334349
#endif

0 commit comments

Comments
 (0)