Skip to content

Commit e13300b

Browse files
committed
Merge tag '5.11-rc-smb3' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs updates from Steve French: "The largest part are for support of the newer mount API which has been needed for cifs/smb3 mounts for a long time due to the new API's better handling of remount, and better error reporting. There are three additional small cleanup patches for this being tested, that are not included yet. This series also includes addition of support for the SMB3 witness protocol which can provide important notifications from the server to client on server address or export or network changes. This can be useful for example in order to be notified before the failure - when a server's IP address changes (in the future it will allow us to support server notifications of when a share is moved). It also includes three patches for stable e.g. some that better handle some confusing error messages during session establishment" * tag '5.11-rc-smb3' of git://git.samba.org/sfrench/cifs-2.6: (55 commits) cifs: update internal module version number cifs: Fix support for remount when not changing rsize/wsize cifs: handle "guest" mount parameter cifs: correct four aliased mount parms to allow use of previous names cifs: Tracepoints and logs for tracing credit changes. cifs: fix use after free in cifs_smb3_do_mount() cifs: fix rsize/wsize to be negotiated values cifs: Fix some error pointers handling detected by static checker smb3: remind users that witness protocol is experimental cifs: update super_operations to show_devname cifs: fix uninitialized variable in smb3_fs_context_parse_param cifs: update mnt_cifs_flags during reconfigure cifs: move update of flags into a separate function cifs: remove ctx argument from cifs_setup_cifs_sb cifs: do not allow changing posix_paths during remount cifs: uncomplicate printing the iocharset parameter cifs: don't create a temp nls in cifs_setup_ipc cifs: simplify handling of cifs_sb/ctx->local_nls cifs: we do not allow changing username/password/unc/... during remount cifs: add initial reconfigure support ...
2 parents d64c6f9 + afee441 commit e13300b

41 files changed

Lines changed: 3623 additions & 2354 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

fs/cifs/Kconfig

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ config CIFS_STATS2
6060
Enabling this option will allow more detailed statistics on SMB
6161
request timing to be displayed in /proc/fs/cifs/DebugData and also
6262
allow optional logging of slow responses to dmesg (depending on the
63-
value of /proc/fs/cifs/cifsFYI, see fs/cifs/README for more details).
64-
These additional statistics may have a minor effect on performance
65-
and memory utilization.
63+
value of /proc/fs/cifs/cifsFYI). See Documentation/admin-guide/cifs/usage.rst
64+
for more details. These additional statistics may have a minor effect
65+
on performance and memory utilization.
6666

6767
Unless you are a developer or are doing network performance analysis
6868
or tuning, say N.
@@ -102,10 +102,10 @@ config CIFS_WEAK_PW_HASH
102102
is enabled in the kernel build, LANMAN authentication will not be
103103
used automatically. At runtime LANMAN mounts are disabled but
104104
can be set to required (or optional) either in
105-
/proc/fs/cifs (see fs/cifs/README for more detail) or via an
106-
option on the mount command. This support is disabled by
107-
default in order to reduce the possibility of a downgrade
108-
attack.
105+
/proc/fs/cifs (see Documentation/admin-guide/cifs/usage.rst for
106+
more detail) or via an option on the mount command. This support
107+
is disabled by default in order to reduce the possibility of a
108+
downgrade attack.
109109

110110
If unsure, say N.
111111

@@ -190,6 +190,17 @@ config CIFS_DFS_UPCALL
190190
servers if their addresses change or for implicit mounts of
191191
DFS junction points. If unsure, say Y.
192192

193+
config CIFS_SWN_UPCALL
194+
bool "SWN feature support"
195+
depends on CIFS
196+
help
197+
The Service Witness Protocol (SWN) is used to get notifications
198+
from a highly available server of resource state changes. This
199+
feature enables an upcall mechanism for CIFS which contacts a
200+
userspace daemon to establish the DCE/RPC connection to retrieve
201+
the cluster available interfaces and resource change notifications.
202+
If unsure, say Y.
203+
193204
config CIFS_NFSD_EXPORT
194205
bool "Allow nfsd to export CIFS file system"
195206
depends on CIFS && BROKEN

fs/cifs/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ obj-$(CONFIG_CIFS) += cifs.o
88
cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \
99
inode.o link.o misc.o netmisc.o smbencrypt.o transport.o asn1.o \
1010
cifs_unicode.o nterr.o cifsencrypt.o \
11-
readdir.o ioctl.o sess.o export.o smb1ops.o winucase.o \
11+
readdir.o ioctl.o sess.o export.o smb1ops.o unc.o winucase.o \
1212
smb2ops.o smb2maperror.o smb2transport.o \
1313
smb2misc.o smb2pdu.o smb2inode.o smb2file.o cifsacl.o fs_context.o
1414

@@ -18,6 +18,8 @@ cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o
1818

1919
cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o dfs_cache.o
2020

21+
cifs-$(CONFIG_CIFS_SWN_UPCALL) += netlink.o cifs_swn.o
22+
2123
cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
2224

2325
cifs-$(CONFIG_CIFS_SMB_DIRECT) += smbdirect.o

fs/cifs/cache.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,6 @@ const struct fscache_cookie_def cifs_fscache_server_index_def = {
5353
.type = FSCACHE_COOKIE_TYPE_INDEX,
5454
};
5555

56-
char *extract_sharename(const char *treename)
57-
{
58-
const char *src;
59-
char *delim, *dst;
60-
int len;
61-
62-
/* skip double chars at the beginning */
63-
src = treename + 2;
64-
65-
/* share name is always preceded by '\\' now */
66-
delim = strchr(src, '\\');
67-
if (!delim)
68-
return ERR_PTR(-EINVAL);
69-
delim++;
70-
len = strlen(delim);
71-
72-
/* caller has to free the memory */
73-
dst = kstrndup(delim, len, GFP_KERNEL);
74-
if (!dst)
75-
return ERR_PTR(-ENOMEM);
76-
77-
return dst;
78-
}
79-
8056
static enum
8157
fscache_checkaux cifs_fscache_super_check_aux(void *cookie_netfs_data,
8258
const void *data,

fs/cifs/cifs_debug.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#ifdef CONFIG_CIFS_SMB_DIRECT
2424
#include "smbdirect.h"
2525
#endif
26+
#ifdef CONFIG_CIFS_SWN_UPCALL
27+
#include "cifs_swn.h"
28+
#endif
2629

2730
void
2831
cifs_dump_mem(char *label, void *data, int length)
@@ -115,6 +118,10 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
115118
seq_printf(m, " POSIX Extensions");
116119
if (tcon->ses->server->ops->dump_share_caps)
117120
tcon->ses->server->ops->dump_share_caps(m, tcon);
121+
#ifdef CONFIG_CIFS_SWN_UPCALL
122+
if (tcon->use_witness)
123+
seq_puts(m, " Witness");
124+
#endif
118125

119126
if (tcon->need_reconnect)
120127
seq_puts(m, "\tDISCONNECTED ");
@@ -262,6 +269,9 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
262269
seq_printf(m, ",XATTR");
263270
#endif
264271
seq_printf(m, ",ACL");
272+
#ifdef CONFIG_CIFS_SWN_UPCALL
273+
seq_puts(m, ",WITNESS");
274+
#endif
265275
seq_putc(m, '\n');
266276
seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize);
267277
seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
@@ -462,6 +472,9 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
462472
spin_unlock(&cifs_tcp_ses_lock);
463473
seq_putc(m, '\n');
464474

475+
#ifdef CONFIG_CIFS_SWN_UPCALL
476+
cifs_swn_dump(m);
477+
#endif
465478
/* BB add code to dump additional info such as TCP session info now */
466479
return 0;
467480
}

fs/cifs/cifs_dfs_ref.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "cifs_debug.h"
2424
#include "cifs_unicode.h"
2525
#include "dfs_cache.h"
26+
#include "fs_context.h"
2627

2728
static LIST_HEAD(cifs_dfs_automount_list);
2829

@@ -124,7 +125,6 @@ cifs_build_devname(char *nodename, const char *prepath)
124125
* @sb_mountdata: parent/root DFS mount options (template)
125126
* @fullpath: full path in UNC format
126127
* @ref: optional server's referral
127-
* @devname: optional pointer for saving device name
128128
*
129129
* creates mount options for submount based on template options sb_mountdata
130130
* and replacing unc,ip,prefixpath options with ones we've got form ref_unc.
@@ -134,8 +134,7 @@ cifs_build_devname(char *nodename, const char *prepath)
134134
*/
135135
char *cifs_compose_mount_options(const char *sb_mountdata,
136136
const char *fullpath,
137-
const struct dfs_info3_param *ref,
138-
char **devname)
137+
const struct dfs_info3_param *ref)
139138
{
140139
int rc;
141140
char *name;
@@ -232,10 +231,7 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
232231
strcat(mountdata, "ip=");
233232
strcat(mountdata, srvIP);
234233

235-
if (devname)
236-
*devname = name;
237-
else
238-
kfree(name);
234+
kfree(name);
239235

240236
/*cifs_dbg(FYI, "%s: parent mountdata: %s\n", __func__, sb_mountdata);*/
241237
/*cifs_dbg(FYI, "%s: submount mountdata: %s\n", __func__, mountdata );*/
@@ -258,6 +254,7 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
258254
* to perform failover in case we failed to connect to the first target in the
259255
* referral.
260256
*
257+
* @mntpt: directory entry for the path we are trying to automount
261258
* @cifs_sb: parent/root superblock
262259
* @fullpath: full path in UNC format
263260
*/
@@ -275,9 +272,13 @@ static struct vfsmount *cifs_dfs_do_mount(struct dentry *mntpt,
275272

276273
convert_delimiter(devname, '/');
277274

275+
/* TODO: change to call fs_context_for_mount(), fill in context directly, call fc_mount */
276+
277+
/* See afs_mntpt_do_automount in fs/afs/mntpt.c for an example */
278+
278279
/* strip first '\' from fullpath */
279-
mountdata = cifs_compose_mount_options(cifs_sb->mountdata,
280-
fullpath + 1, NULL, NULL);
280+
mountdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options,
281+
fullpath + 1, NULL);
281282
if (IS_ERR(mountdata)) {
282283
kfree(devname);
283284
return (struct vfsmount *)mountdata;

fs/cifs/cifs_fs_sb.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,9 @@ struct cifs_sb_info {
6161
spinlock_t tlink_tree_lock;
6262
struct tcon_link *master_tlink;
6363
struct nls_table *local_nls;
64-
unsigned int bsize;
65-
unsigned int rsize;
66-
unsigned int wsize;
67-
unsigned long actimeo; /* attribute cache timeout (jiffies) */
64+
struct smb3_fs_context *ctx;
6865
atomic_t active;
69-
kuid_t mnt_uid;
70-
kgid_t mnt_gid;
71-
kuid_t mnt_backupuid;
72-
kgid_t mnt_backupgid;
73-
umode_t mnt_file_mode;
74-
umode_t mnt_dir_mode;
7566
unsigned int mnt_cifs_flags;
76-
char *mountdata; /* options received at mount time or via DFS refs */
7767
struct delayed_work prune_tlinks;
7868
struct rcu_head rcu;
7969

0 commit comments

Comments
 (0)