Skip to content

Commit 3803d5e

Browse files
committed
Merge tag '5.8-rc-smb3-fixes-part-1' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs updates from Steve French: "22 changesets, 2 for stable. Includes big performance improvement for large i/o when using multichannel, also includes DFS fixes" * tag '5.8-rc-smb3-fixes-part-1' of git://git.samba.org/sfrench/cifs-2.6: (22 commits) cifs: update internal module version number cifs: multichannel: try to rebind when reconnecting a channel cifs: multichannel: use pointer for binding channel smb3: remove static checker warning cifs: multichannel: move channel selection above transport layer cifs: multichannel: always zero struct cifs_io_parms cifs: dump Security Type info in DebugData smb3: fix incorrect number of credits when ioctl MaxOutputResponse > 64K smb3: default to minimum of two channels when multichannel specified cifs: multichannel: move channel selection in function cifs: fix minor typos in comments and log messages smb3: minor update to compression header definitions cifs: minor fix to two debug messages cifs: Standardize logging output smb3: Add new parm "nodelete" cifs: move some variables off the stack in smb2_ioctl_query_info cifs: reduce stack use in smb2_compound_op cifs: get rid of unused parameter in reconn_setup_dfs_targets() cifs: handle hostnames that resolve to same ip in failover cifs: set up next DFS target before generic_ip_connect() ...
2 parents 9daa0a2 + 331cc66 commit 3803d5e

27 files changed

+1041
-729
lines changed

fs/cifs/cifs_debug.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
221221
struct cifs_ses *ses;
222222
struct cifs_tcon *tcon;
223223
int i, j;
224+
const char *security_types[] = {"Unspecified", "LANMAN", "NTLM",
225+
"NTLMv2", "RawNTLMSSP", "Kerberos"};
224226

225227
seq_puts(m,
226228
"Display Internal CIFS Data Structures for Debugging\n"
@@ -375,6 +377,10 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
375377
ses->ses_count, ses->serverOS, ses->serverNOS,
376378
ses->capabilities, ses->status);
377379
}
380+
381+
seq_printf(m,"Security type: %s\n",
382+
security_types[server->ops->select_sectype(server, ses->sectype)]);
383+
378384
if (server->rdma)
379385
seq_printf(m, "RDMA\n\t");
380386
seq_printf(m, "TCP status: %d Instance: %d\n\tLocal Users To "

fs/cifs/cifs_debug.h

Lines changed: 69 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#ifndef _H_CIFS_DEBUG
99
#define _H_CIFS_DEBUG
1010

11+
#ifdef pr_fmt
12+
#undef pr_fmt
13+
#endif
14+
15+
#define pr_fmt(fmt) "CIFS: " fmt
16+
1117
void cifs_dump_mem(char *label, void *data, int length);
1218
void cifs_dump_detail(void *buf, struct TCP_Server_Info *ptcp_info);
1319
void cifs_dump_mids(struct TCP_Server_Info *);
@@ -46,92 +52,81 @@ extern int cifsFYI;
4652
*/
4753

4854
/* Information level messages, minor events */
49-
#define cifs_info_func(ratefunc, fmt, ...) \
50-
do { \
51-
pr_info_ ## ratefunc("CIFS: " fmt, ##__VA_ARGS__); \
52-
} while (0)
55+
#define cifs_info_func(ratefunc, fmt, ...) \
56+
pr_info_ ## ratefunc(fmt, ##__VA_ARGS__)
5357

54-
#define cifs_info(fmt, ...) \
55-
do { \
56-
cifs_info_func(ratelimited, fmt, ##__VA_ARGS__); \
57-
} while (0)
58+
#define cifs_info(fmt, ...) \
59+
cifs_info_func(ratelimited, fmt, ##__VA_ARGS__)
5860

5961
/* information message: e.g., configuration, major event */
60-
#define cifs_dbg_func(ratefunc, type, fmt, ...) \
61-
do { \
62-
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
63-
pr_debug_ ## ratefunc("%s: " \
64-
fmt, __FILE__, ##__VA_ARGS__); \
65-
} else if ((type) & VFS) { \
66-
pr_err_ ## ratefunc("CIFS VFS: " \
67-
fmt, ##__VA_ARGS__); \
68-
} else if ((type) & NOISY && (NOISY != 0)) { \
69-
pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \
70-
} \
62+
#define cifs_dbg_func(ratefunc, type, fmt, ...) \
63+
do { \
64+
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
65+
pr_debug_ ## ratefunc("%s: " fmt, \
66+
__FILE__, ##__VA_ARGS__); \
67+
} else if ((type) & VFS) { \
68+
pr_err_ ## ratefunc("VFS: " fmt, ##__VA_ARGS__); \
69+
} else if ((type) & NOISY && (NOISY != 0)) { \
70+
pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \
71+
} \
7172
} while (0)
7273

73-
#define cifs_dbg(type, fmt, ...) \
74-
do { \
75-
if ((type) & ONCE) \
76-
cifs_dbg_func(once, \
77-
type, fmt, ##__VA_ARGS__); \
78-
else \
79-
cifs_dbg_func(ratelimited, \
80-
type, fmt, ##__VA_ARGS__); \
74+
#define cifs_dbg(type, fmt, ...) \
75+
do { \
76+
if ((type) & ONCE) \
77+
cifs_dbg_func(once, type, fmt, ##__VA_ARGS__); \
78+
else \
79+
cifs_dbg_func(ratelimited, type, fmt, ##__VA_ARGS__); \
8180
} while (0)
8281

83-
#define cifs_server_dbg_func(ratefunc, type, fmt, ...) \
84-
do { \
85-
const char *sn = ""; \
86-
if (server && server->hostname) \
87-
sn = server->hostname; \
88-
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
89-
pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \
90-
__FILE__, sn, ##__VA_ARGS__); \
91-
} else if ((type) & VFS) { \
92-
pr_err_ ## ratefunc("CIFS VFS: \\\\%s " fmt, \
93-
sn, ##__VA_ARGS__); \
94-
} else if ((type) & NOISY && (NOISY != 0)) { \
95-
pr_debug_ ## ratefunc("\\\\%s " fmt, \
96-
sn, ##__VA_ARGS__); \
97-
} \
82+
#define cifs_server_dbg_func(ratefunc, type, fmt, ...) \
83+
do { \
84+
const char *sn = ""; \
85+
if (server && server->hostname) \
86+
sn = server->hostname; \
87+
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
88+
pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \
89+
__FILE__, sn, ##__VA_ARGS__); \
90+
} else if ((type) & VFS) { \
91+
pr_err_ ## ratefunc("VFS: \\\\%s " fmt, \
92+
sn, ##__VA_ARGS__); \
93+
} else if ((type) & NOISY && (NOISY != 0)) { \
94+
pr_debug_ ## ratefunc("\\\\%s " fmt, \
95+
sn, ##__VA_ARGS__); \
96+
} \
9897
} while (0)
9998

100-
#define cifs_server_dbg(type, fmt, ...) \
101-
do { \
102-
if ((type) & ONCE) \
103-
cifs_server_dbg_func(once, \
104-
type, fmt, ##__VA_ARGS__); \
105-
else \
106-
cifs_server_dbg_func(ratelimited, \
107-
type, fmt, ##__VA_ARGS__); \
99+
#define cifs_server_dbg(type, fmt, ...) \
100+
do { \
101+
if ((type) & ONCE) \
102+
cifs_server_dbg_func(once, type, fmt, ##__VA_ARGS__); \
103+
else \
104+
cifs_server_dbg_func(ratelimited, type, fmt, \
105+
##__VA_ARGS__); \
108106
} while (0)
109107

110-
#define cifs_tcon_dbg_func(ratefunc, type, fmt, ...) \
111-
do { \
112-
const char *tn = ""; \
113-
if (tcon && tcon->treeName) \
114-
tn = tcon->treeName; \
115-
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
116-
pr_debug_ ## ratefunc("%s: %s " fmt, \
117-
__FILE__, tn, ##__VA_ARGS__); \
118-
} else if ((type) & VFS) { \
119-
pr_err_ ## ratefunc("CIFS VFS: %s " fmt, \
120-
tn, ##__VA_ARGS__); \
121-
} else if ((type) & NOISY && (NOISY != 0)) { \
122-
pr_debug_ ## ratefunc("%s " fmt, \
123-
tn, ##__VA_ARGS__); \
124-
} \
108+
#define cifs_tcon_dbg_func(ratefunc, type, fmt, ...) \
109+
do { \
110+
const char *tn = ""; \
111+
if (tcon && tcon->treeName) \
112+
tn = tcon->treeName; \
113+
if ((type) & FYI && cifsFYI & CIFS_INFO) { \
114+
pr_debug_ ## ratefunc("%s: %s " fmt, \
115+
__FILE__, tn, ##__VA_ARGS__); \
116+
} else if ((type) & VFS) { \
117+
pr_err_ ## ratefunc("VFS: %s " fmt, tn, ##__VA_ARGS__); \
118+
} else if ((type) & NOISY && (NOISY != 0)) { \
119+
pr_debug_ ## ratefunc("%s " fmt, tn, ##__VA_ARGS__); \
120+
} \
125121
} while (0)
126122

127-
#define cifs_tcon_dbg(type, fmt, ...) \
128-
do { \
129-
if ((type) & ONCE) \
130-
cifs_tcon_dbg_func(once, \
131-
type, fmt, ##__VA_ARGS__); \
132-
else \
133-
cifs_tcon_dbg_func(ratelimited, \
134-
type, fmt, ##__VA_ARGS__); \
123+
#define cifs_tcon_dbg(type, fmt, ...) \
124+
do { \
125+
if ((type) & ONCE) \
126+
cifs_tcon_dbg_func(once, type, fmt, ##__VA_ARGS__); \
127+
else \
128+
cifs_tcon_dbg_func(ratelimited, type, fmt, \
129+
##__VA_ARGS__); \
135130
} while (0)
136131

137132
/*
@@ -159,9 +154,7 @@ do { \
159154
} while (0)
160155

161156
#define cifs_info(fmt, ...) \
162-
do { \
163-
pr_info("CIFS: "fmt, ##__VA_ARGS__); \
164-
} while (0)
157+
pr_info(fmt, ##__VA_ARGS__)
165158
#endif
166159

167160
#endif /* _H_CIFS_DEBUG */

fs/cifs/cifsencrypt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
520520

521521
rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash);
522522
if (rc) {
523-
cifs_dbg(VFS, "%s: could not init hmacmd5\n", __func__);
523+
cifs_dbg(VFS, "%s: Could not init hmacmd5\n", __func__);
524524
return rc;
525525
}
526526

@@ -624,7 +624,7 @@ CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash)
624624

625625
rc = crypto_shash_init(&ses->server->secmech.sdeschmacmd5->shash);
626626
if (rc) {
627-
cifs_dbg(VFS, "%s: could not init hmacmd5\n", __func__);
627+
cifs_dbg(VFS, "%s: Could not init hmacmd5\n", __func__);
628628
return rc;
629629
}
630630

@@ -723,7 +723,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)
723723
/* calculate ntlmv2_hash */
724724
rc = calc_ntlmv2_hash(ses, ntlmv2_hash, nls_cp);
725725
if (rc) {
726-
cifs_dbg(VFS, "could not get v2 hash rc %d\n", rc);
726+
cifs_dbg(VFS, "Could not get v2 hash rc %d\n", rc);
727727
goto unlock;
728728
}
729729

@@ -783,7 +783,7 @@ calc_seckey(struct cifs_ses *ses)
783783

784784
ctx_arc4 = kmalloc(sizeof(*ctx_arc4), GFP_KERNEL);
785785
if (!ctx_arc4) {
786-
cifs_dbg(VFS, "could not allocate arc4 context\n");
786+
cifs_dbg(VFS, "Could not allocate arc4 context\n");
787787
return -ENOMEM;
788788
}
789789

fs/cifs/cifsfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
534534
seq_puts(s, ",signloosely");
535535
if (tcon->nocase)
536536
seq_puts(s, ",nocase");
537+
if (tcon->nodelete)
538+
seq_puts(s, ",nodelete");
537539
if (tcon->local_lease)
538540
seq_puts(s, ",locallease");
539541
if (tcon->retry)

fs/cifs/cifsfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,5 @@ extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
156156
extern const struct export_operations cifs_export_ops;
157157
#endif /* CONFIG_CIFS_NFSD_EXPORT */
158158

159-
#define CIFS_VERSION "2.26"
159+
#define CIFS_VERSION "2.27"
160160
#endif /* _CIFSFS_H */

fs/cifs/cifsglob.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ struct smb_vol {
562562
bool override_gid:1;
563563
bool dynperm:1;
564564
bool noperm:1;
565+
bool nodelete:1;
565566
bool mode_ace:1;
566567
bool no_psx_acl:1; /* set if posix acl support should be disabled */
567568
bool cifs_acl:1;
@@ -1029,30 +1030,39 @@ struct cifs_ses {
10291030

10301031
#define CIFS_MAX_CHANNELS 16
10311032
struct cifs_chan chans[CIFS_MAX_CHANNELS];
1033+
struct cifs_chan *binding_chan;
10321034
size_t chan_count;
10331035
size_t chan_max;
10341036
atomic_t chan_seq; /* round robin state */
10351037
};
10361038

10371039
/*
10381040
* When binding a new channel, we need to access the channel which isn't fully
1039-
* established yet (one past the established count)
1041+
* established yet.
10401042
*/
10411043

10421044
static inline
10431045
struct cifs_chan *cifs_ses_binding_channel(struct cifs_ses *ses)
10441046
{
10451047
if (ses->binding)
1046-
return &ses->chans[ses->chan_count];
1048+
return ses->binding_chan;
10471049
else
10481050
return NULL;
10491051
}
10501052

1053+
/*
1054+
* Returns the server pointer of the session. When binding a new
1055+
* channel this returns the last channel which isn't fully established
1056+
* yet.
1057+
*
1058+
* This function should be use for negprot/sess.setup codepaths. For
1059+
* the other requests see cifs_pick_channel().
1060+
*/
10511061
static inline
10521062
struct TCP_Server_Info *cifs_ses_server(struct cifs_ses *ses)
10531063
{
10541064
if (ses->binding)
1055-
return ses->chans[ses->chan_count].server;
1065+
return ses->binding_chan->server;
10561066
else
10571067
return ses->server;
10581068
}
@@ -1136,6 +1146,7 @@ struct cifs_tcon {
11361146
bool retry:1;
11371147
bool nocase:1;
11381148
bool nohandlecache:1; /* if strange server resource prob can turn off */
1149+
bool nodelete:1;
11391150
bool seal:1; /* transport encryption for this mounted share */
11401151
bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol
11411152
for this mount even if server would support */
@@ -1333,6 +1344,7 @@ struct cifs_io_parms {
13331344
__u64 offset;
13341345
unsigned int length;
13351346
struct cifs_tcon *tcon;
1347+
struct TCP_Server_Info *server;
13361348
};
13371349

13381350
struct cifs_aio_ctx {
@@ -1380,6 +1392,7 @@ struct cifs_readdata {
13801392
struct cifs_readdata *rdata,
13811393
struct iov_iter *iter);
13821394
struct kvec iov[2];
1395+
struct TCP_Server_Info *server;
13831396
#ifdef CONFIG_CIFS_SMB_DIRECT
13841397
struct smbd_mr *mr;
13851398
#endif
@@ -1406,6 +1419,7 @@ struct cifs_writedata {
14061419
pid_t pid;
14071420
unsigned int bytes;
14081421
int result;
1422+
struct TCP_Server_Info *server;
14091423
#ifdef CONFIG_CIFS_SMB_DIRECT
14101424
struct smbd_mr *mr;
14111425
#endif

0 commit comments

Comments
 (0)