Skip to content

Commit 7a39682

Browse files
committed
Merge tag 'v6.8-rc-part2-smb-client' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client updates from Steve French: "Various smb client fixes, including multichannel and for SMB3.1.1 POSIX extensions: - debugging improvement (display start time for stats) - two reparse point handling fixes - various multichannel improvements and fixes - SMB3.1.1 POSIX extensions open/create parsing fix - retry (reconnect) improvement including new retrans mount parm, and handling of two additional return codes that need to be retried on - two minor cleanup patches and another to remove duplicate query info code - two documentation cleanup, and one reviewer email correction" * tag 'v6.8-rc-part2-smb-client' of git://git.samba.org/sfrench/cifs-2.6: cifs: update iface_last_update on each query-and-update cifs: handle servers that still advertise multichannel after disabling cifs: new mount option called retrans cifs: reschedule periodic query for server interfaces smb: client: don't clobber ->i_rdev from cached reparse points smb: client: get rid of smb311_posix_query_path_info() smb: client: parse owner/group when creating reparse points smb: client: fix parsing of SMB3.1.1 POSIX create context cifs: update known bugs mentioned in kernel docs for cifs cifs: new nt status codes from MS-SMB2 cifs: pick channel for tcon and tdis cifs: open_cached_dir should not rely on primary channel smb3: minor documentation updates Update MAINTAINERS email address cifs: minor comment cleanup smb3: show beginning time for per share stats cifs: remove redundant variable tcon_exist
2 parents 65163d1 + 78e727e commit 7a39682

19 files changed

+244
-257
lines changed

Documentation/admin-guide/cifs/todo.rst

+21-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
TODO
33
====
44

5-
Version 2.14 December 21, 2018
5+
As of 6.7 kernel. See https://wiki.samba.org/index.php/LinuxCIFSKernel
6+
for list of features added by release
67

78
A Partial List of Missing Features
89
==================================
@@ -12,22 +13,22 @@ for visible, important contributions to this module. Here
1213
is a partial list of the known problems and missing features:
1314

1415
a) SMB3 (and SMB3.1.1) missing optional features:
16+
multichannel performance optimizations, algorithmic channel selection,
17+
directory leases optimizations,
18+
support for faster packet signing (GMAC),
19+
support for compression over the network,
20+
T10 copy offload ie "ODX" (copy chunk, and "Duplicate Extents" ioctl
21+
are currently the only two server side copy mechanisms supported)
1522

16-
- multichannel (partially integrated), integration of multichannel with RDMA
17-
- directory leases (improved metadata caching). Currently only implemented for root dir
18-
- T10 copy offload ie "ODX" (copy chunk, and "Duplicate Extents" ioctl
19-
currently the only two server side copy mechanisms supported)
23+
b) Better optimized compounding and error handling for sparse file support,
24+
perhaps addition of new optional SMB3.1.1 fsctls to make collapse range
25+
and insert range more atomic
2026

21-
b) improved sparse file support (fiemap and SEEK_HOLE are implemented
22-
but additional features would be supportable by the protocol such
23-
as FALLOC_FL_COLLAPSE_RANGE and FALLOC_FL_INSERT_RANGE)
24-
25-
c) Directory entry caching relies on a 1 second timer, rather than
26-
using Directory Leases, currently only the root file handle is cached longer
27-
by leveraging Directory Leases
27+
c) Support for SMB3.1.1 over QUIC (and perhaps other socket based protocols
28+
like SCTP)
2829

2930
d) quota support (needs minor kernel change since quota calls otherwise
30-
won't make it to network filesystems or deviceless filesystems).
31+
won't make it to network filesystems or deviceless filesystems).
3132

3233
e) Additional use cases can be optimized to use "compounding" (e.g.
3334
open/query/close and open/setinfo/close) to reduce the number of
@@ -92,23 +93,20 @@ t) split cifs and smb3 support into separate modules so legacy (and less
9293

9394
v) Additional testing of POSIX Extensions for SMB3.1.1
9495

95-
w) Add support for additional strong encryption types, and additional spnego
96-
authentication mechanisms (see MS-SMB2). GCM-256 is now partially implemented.
96+
w) Support for the Mac SMB3.1.1 extensions to improve interop with Apple servers
97+
98+
x) Support for additional authentication options (e.g. IAKERB, peer-to-peer
99+
Kerberos, SCRAM and others supported by existing servers)
97100

98-
x) Finish support for SMB3.1.1 compression
101+
y) Improved tracing, more eBPF trace points, better scripts for performance
102+
analysis
99103

100104
Known Bugs
101105
==========
102106

103107
See https://bugzilla.samba.org - search on product "CifsVFS" for
104108
current bug list. Also check http://bugzilla.kernel.org (Product = File System, Component = CIFS)
105-
106-
1) existing symbolic links (Windows reparse points) are recognized but
107-
can not be created remotely. They are implemented for Samba and those that
108-
support the CIFS Unix extensions, although earlier versions of Samba
109-
overly restrict the pathnames.
110-
2) follow_link and readdir code does not follow dfs junctions
111-
but recognizes them
109+
and xfstest results e.g. https://wiki.samba.org/index.php/Xfstest-results-smb3
112110

113111
Misc testing to do
114112
==================

Documentation/admin-guide/cifs/usage.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ much older and less secure than the default dialect SMB3 which includes
8181
many advanced security features such as downgrade attack detection
8282
and encrypted shares and stronger signing and authentication algorithms.
8383
There are additional mount options that may be helpful for SMB3 to get
84-
improved POSIX behavior (NB: can use vers=3.0 to force only SMB3, never 2.1):
84+
improved POSIX behavior (NB: can use vers=3 to force SMB3 or later, never 2.1):
8585

8686
``mfsymlinks`` and either ``cifsacl`` or ``modefromsid`` (usually with ``idsfromsid``)
8787

@@ -715,6 +715,7 @@ DebugData Displays information about active CIFS sessions and
715715
Stats Lists summary resource usage information as well as per
716716
share statistics.
717717
open_files List all the open file handles on all active SMB sessions.
718+
mount_params List of all mount parameters available for the module
718719
======================= =======================================================
719720

720721
Configuration pseudo-files:
@@ -864,6 +865,11 @@ i.e.::
864865

865866
echo "value" > /sys/module/cifs/parameters/<param>
866867

868+
More detailed descriptions of the available module parameters and their values
869+
can be seen by doing:
870+
871+
modinfo cifs (or modinfo smb3)
872+
867873
================= ==========================================================
868874
1. enable_oplocks Enable or disable oplocks. Oplocks are enabled by default.
869875
[Y/y/1]. To disable use any of [N/n/0].

MAINTAINERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -5236,7 +5236,7 @@ X: drivers/clk/clkdev.c
52365236
COMMON INTERNET FILE SYSTEM CLIENT (CIFS and SMB3)
52375237
M: Steve French <[email protected]>
52385238
R: Paulo Alcantara <[email protected]> (DFS, global name space)
5239-
R: Ronnie Sahlberg <lsahlber@redhat.com> (directory leases, sparse files)
5239+
R: Ronnie Sahlberg <ronniesahlberg@gmail.com> (directory leases, sparse files)
52405240
R: Shyam Prasad N <[email protected]> (multichannel)
52415241
R: Tom Talpey <[email protected]> (RDMA, smbdirect)
52425242

fs/smb/client/cached_dir.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
151151
return -EOPNOTSUPP;
152152

153153
ses = tcon->ses;
154-
server = ses->server;
154+
server = cifs_pick_channel(ses);
155155
cfids = tcon->cfids;
156156

157157
if (!server->ops->new_lease_key)

fs/smb/client/cifs_debug.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
659659
spin_lock(&tcon->stat_lock);
660660
tcon->bytes_read = 0;
661661
tcon->bytes_written = 0;
662+
tcon->stats_from_time = ktime_get_real_seconds();
662663
spin_unlock(&tcon->stat_lock);
663664
if (server->ops->clear_stats)
664665
server->ops->clear_stats(tcon);
@@ -737,8 +738,9 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
737738
seq_printf(m, "\n%d) %s", i, tcon->tree_name);
738739
if (tcon->need_reconnect)
739740
seq_puts(m, "\tDISCONNECTED ");
740-
seq_printf(m, "\nSMBs: %d",
741-
atomic_read(&tcon->num_smbs_sent));
741+
seq_printf(m, "\nSMBs: %d since %ptTs UTC",
742+
atomic_read(&tcon->num_smbs_sent),
743+
&tcon->stats_from_time);
742744
if (server->ops->print_stats)
743745
server->ops->print_stats(m, tcon);
744746
}

fs/smb/client/cifsfs.c

+2
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
681681
seq_printf(s, ",rasize=%u", cifs_sb->ctx->rasize);
682682
if (tcon->ses->server->min_offload)
683683
seq_printf(s, ",esize=%u", tcon->ses->server->min_offload);
684+
if (tcon->ses->server->retrans)
685+
seq_printf(s, ",retrans=%u", tcon->ses->server->retrans);
684686
seq_printf(s, ",echo_interval=%lu",
685687
tcon->ses->server->echo_interval / HZ);
686688

fs/smb/client/cifsglob.h

+4
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ struct cifs_open_info_data {
204204
};
205205
} reparse;
206206
char *symlink_target;
207+
struct cifs_sid posix_owner;
208+
struct cifs_sid posix_group;
207209
union {
208210
struct smb2_file_all_info fi;
209211
struct smb311_posix_qinfo posix_fi;
@@ -751,6 +753,7 @@ struct TCP_Server_Info {
751753
unsigned int max_read;
752754
unsigned int max_write;
753755
unsigned int min_offload;
756+
unsigned int retrans;
754757
__le16 compress_algorithm;
755758
__u16 signing_algorithm;
756759
__le16 cipher_type;
@@ -1207,6 +1210,7 @@ struct cifs_tcon {
12071210
__u64 bytes_read;
12081211
__u64 bytes_written;
12091212
spinlock_t stat_lock; /* protects the two fields above */
1213+
time64_t stats_from_time;
12101214
FILE_SYSTEM_DEVICE_INFO fsDevInfo;
12111215
FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */
12121216
FILE_SYSTEM_UNIX_INFO fsUnixInfo;

fs/smb/client/connect.c

+4
Original file line numberDiff line numberDiff line change
@@ -1574,6 +1574,9 @@ static int match_server(struct TCP_Server_Info *server,
15741574
if (server->min_offload != ctx->min_offload)
15751575
return 0;
15761576

1577+
if (server->retrans != ctx->retrans)
1578+
return 0;
1579+
15771580
return 1;
15781581
}
15791582

@@ -1798,6 +1801,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,
17981801
goto out_err_crypto_release;
17991802
}
18001803
tcp_ses->min_offload = ctx->min_offload;
1804+
tcp_ses->retrans = ctx->retrans;
18011805
/*
18021806
* at this point we are the only ones with the pointer
18031807
* to the struct since the kernel thread not created yet

fs/smb/client/fs_context.c

+6
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {
139139
fsparam_u32("dir_mode", Opt_dirmode),
140140
fsparam_u32("port", Opt_port),
141141
fsparam_u32("min_enc_offload", Opt_min_enc_offload),
142+
fsparam_u32("retrans", Opt_retrans),
142143
fsparam_u32("esize", Opt_min_enc_offload),
143144
fsparam_u32("bsize", Opt_blocksize),
144145
fsparam_u32("rasize", Opt_rasize),
@@ -1064,6 +1065,9 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
10641065
case Opt_min_enc_offload:
10651066
ctx->min_offload = result.uint_32;
10661067
break;
1068+
case Opt_retrans:
1069+
ctx->retrans = result.uint_32;
1070+
break;
10671071
case Opt_blocksize:
10681072
/*
10691073
* inode blocksize realistically should never need to be
@@ -1619,6 +1623,8 @@ int smb3_init_fs_context(struct fs_context *fc)
16191623
ctx->backupuid_specified = false; /* no backup intent for a user */
16201624
ctx->backupgid_specified = false; /* no backup intent for a group */
16211625

1626+
ctx->retrans = 1;
1627+
16221628
/*
16231629
* short int override_uid = -1;
16241630
* short int override_gid = -1;

fs/smb/client/fs_context.h

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ enum cifs_param {
118118
Opt_file_mode,
119119
Opt_dirmode,
120120
Opt_min_enc_offload,
121+
Opt_retrans,
121122
Opt_blocksize,
122123
Opt_rasize,
123124
Opt_rsize,
@@ -245,6 +246,7 @@ struct smb3_fs_context {
245246
unsigned int rsize;
246247
unsigned int wsize;
247248
unsigned int min_offload;
249+
unsigned int retrans;
248250
bool sockopt_tcp_nodelay:1;
249251
/* attribute cache timemout for files and directories in jiffies */
250252
unsigned long acregmax;

fs/smb/client/inode.c

+11-18
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,6 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
665665
/* Fill a cifs_fattr struct with info from POSIX info struct */
666666
static void smb311_posix_info_to_fattr(struct cifs_fattr *fattr,
667667
struct cifs_open_info_data *data,
668-
struct cifs_sid *owner,
669-
struct cifs_sid *group,
670668
struct super_block *sb)
671669
{
672670
struct smb311_posix_qinfo *info = &data->posix_fi;
@@ -722,8 +720,8 @@ static void smb311_posix_info_to_fattr(struct cifs_fattr *fattr,
722720
fattr->cf_symlink_target = data->symlink_target;
723721
data->symlink_target = NULL;
724722
}
725-
sid_to_id(cifs_sb, owner, fattr, SIDOWNER);
726-
sid_to_id(cifs_sb, group, fattr, SIDGROUP);
723+
sid_to_id(cifs_sb, &data->posix_owner, fattr, SIDOWNER);
724+
sid_to_id(cifs_sb, &data->posix_group, fattr, SIDGROUP);
727725

728726
cifs_dbg(FYI, "POSIX query info: mode 0x%x uniqueid 0x%llx nlink %d\n",
729727
fattr->cf_mode, fattr->cf_uniqueid, fattr->cf_nlink);
@@ -1070,9 +1068,7 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
10701068
const unsigned int xid,
10711069
struct cifs_tcon *tcon,
10721070
const char *full_path,
1073-
struct cifs_fattr *fattr,
1074-
struct cifs_sid *owner,
1075-
struct cifs_sid *group)
1071+
struct cifs_fattr *fattr)
10761072
{
10771073
struct TCP_Server_Info *server = tcon->ses->server;
10781074
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
@@ -1117,7 +1113,7 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
11171113
}
11181114

11191115
if (tcon->posix_extensions)
1120-
smb311_posix_info_to_fattr(fattr, data, owner, group, sb);
1116+
smb311_posix_info_to_fattr(fattr, data, sb);
11211117
else
11221118
cifs_open_info_to_fattr(fattr, data, sb);
11231119
out:
@@ -1171,8 +1167,7 @@ static int cifs_get_fattr(struct cifs_open_info_data *data,
11711167
*/
11721168
if (cifs_open_data_reparse(data)) {
11731169
rc = reparse_info_to_fattr(data, sb, xid, tcon,
1174-
full_path, fattr,
1175-
NULL, NULL);
1170+
full_path, fattr);
11761171
} else {
11771172
cifs_open_info_to_fattr(fattr, data, sb);
11781173
}
@@ -1317,25 +1312,25 @@ static int smb311_posix_get_fattr(struct cifs_open_info_data *data,
13171312
const unsigned int xid)
13181313
{
13191314
struct cifs_open_info_data tmp_data = {};
1315+
struct TCP_Server_Info *server;
13201316
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
13211317
struct cifs_tcon *tcon;
13221318
struct tcon_link *tlink;
1323-
struct cifs_sid owner, group;
13241319
int tmprc;
13251320
int rc = 0;
13261321

13271322
tlink = cifs_sb_tlink(cifs_sb);
13281323
if (IS_ERR(tlink))
13291324
return PTR_ERR(tlink);
13301325
tcon = tlink_tcon(tlink);
1326+
server = tcon->ses->server;
13311327

13321328
/*
13331329
* 1. Fetch file metadata if not provided (data)
13341330
*/
13351331
if (!data) {
1336-
rc = smb311_posix_query_path_info(xid, tcon, cifs_sb,
1337-
full_path, &tmp_data,
1338-
&owner, &group);
1332+
rc = server->ops->query_path_info(xid, tcon, cifs_sb,
1333+
full_path, &tmp_data);
13391334
data = &tmp_data;
13401335
}
13411336

@@ -1347,11 +1342,9 @@ static int smb311_posix_get_fattr(struct cifs_open_info_data *data,
13471342
case 0:
13481343
if (cifs_open_data_reparse(data)) {
13491344
rc = reparse_info_to_fattr(data, sb, xid, tcon,
1350-
full_path, fattr,
1351-
&owner, &group);
1345+
full_path, fattr);
13521346
} else {
1353-
smb311_posix_info_to_fattr(fattr, data,
1354-
&owner, &group, sb);
1347+
smb311_posix_info_to_fattr(fattr, data, sb);
13551348
}
13561349
break;
13571350
case -EREMOTE:

fs/smb/client/misc.c

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ tcon_info_alloc(bool dir_leases_enabled)
140140
spin_lock_init(&ret_buf->stat_lock);
141141
atomic_set(&ret_buf->num_local_opens, 0);
142142
atomic_set(&ret_buf->num_remote_opens, 0);
143+
ret_buf->stats_from_time = ktime_get_real_seconds();
143144
#ifdef CONFIG_CIFS_DFS_UPCALL
144145
INIT_LIST_HEAD(&ret_buf->dfs_ses_list);
145146
#endif

fs/smb/client/readdir.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
133133
* Query dir responses don't provide enough
134134
* information about reparse points other than
135135
* their reparse tags. Save an invalidation by
136-
* not clobbering the existing mode, size and
137-
* symlink target (if any) when reparse tag and
138-
* ctime haven't changed.
136+
* not clobbering some existing attributes when
137+
* reparse tag and ctime haven't changed.
139138
*/
140139
rc = 0;
141140
if (fattr->cf_cifsattrs & ATTR_REPARSE) {
142141
if (likely(reparse_inode_match(inode, fattr))) {
143142
fattr->cf_mode = inode->i_mode;
143+
fattr->cf_rdev = inode->i_rdev;
144144
fattr->cf_eof = CIFS_I(inode)->server_eof;
145145
fattr->cf_symlink_target = NULL;
146146
} else {
@@ -645,10 +645,10 @@ static int cifs_entry_is_dot(struct cifs_dirent *de, bool is_unicode)
645645
static int is_dir_changed(struct file *file)
646646
{
647647
struct inode *inode = file_inode(file);
648-
struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
648+
struct cifsInodeInfo *cifs_inode_info = CIFS_I(inode);
649649

650-
if (cifsInfo->time == 0)
651-
return 1; /* directory was changed, perhaps due to unlink */
650+
if (cifs_inode_info->time == 0)
651+
return 1; /* directory was changed, e.g. unlink or new file */
652652
else
653653
return 0;
654654

0 commit comments

Comments
 (0)