Commit 3bc1bc0b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag '5.20-rc-smb3-client-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs updates from Steve French:
 "Mostly cleanup, including smb1 refactoring:

   - multichannel perf improvement

   - move additional SMB1 code to not be compiled in when legacy support
     is disabled.

   - bug fixes, including one important one for memory leak

   - various cleanup patches

  We are still working on and testing some deferred close improvements
  including an important lease break fix for case when multiple deferred
  closes are still open, and also some additional perf improvements -
  those are not included here"

* tag '5.20-rc-smb3-client-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: update internal module number
  cifs: alloc_mid function should be marked as static
  cifs: remove "cifs_" prefix from init/destroy mids functions
  cifs: remove useless DeleteMidQEntry()
  cifs: when insecure legacy is disabled shrink amount of SMB1 code
  cifs: trivial style fixup
  cifs: fix wrong unlock before return from cifs_tree_connect()
  cifs: avoid use of global locks for high contention data
  cifs: remove remaining build warnings
  cifs: list_for_each() -> list_for_each_entry()
  cifs: update MAINTAINERS file with reviewers
  smb2: small refactor in smb2_check_message()
  cifs: Fix memory leak when using fscache
  cifs: remove minor build warning
  cifs: remove some camelCase and also some static build warnings
  cifs: remove unnecessary (void*) conversions.
  cifs: remove unnecessary type castings
  cifs: remove redundant initialization to variable mnt_sign_enabled
  smb3: check xattr value length earlier
parents eb5699ba 0d168a58
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -5123,12 +5123,15 @@ F: include/linux/clk/
F:	include/linux/of_clk.h
X:	drivers/clk/clkdev.c
COMMON INTERNET FILE SYSTEM CLIENT (CIFS)
COMMON INTERNET FILE SYSTEM CLIENT (CIFS and SMB3)
M:	Steve French <sfrench@samba.org>
R:	Paulo Alcantara <pc@cjr.nz> (DFS, global name space)
R:	Ronnie Sahlberg <lsahlber@redhat.com> (directory leases, sparse files)
R:	Shyam Prasad N <sprasad@microsoft.com> (multichannel)
L:	linux-cifs@vger.kernel.org
L:	samba-technical@lists.samba.org (moderated for non-subscribers)
S:	Supported
W:	http://linux-cifs.samba.org/
W:	https://wiki.samba.org/index.php/LinuxCIFS
T:	git git://git.samba.org/sfrench/cifs-2.6.git
F:	Documentation/admin-guide/cifs/
F:	fs/cifs/
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
ccflags-y += -I$(src)		# needed for trace events
obj-$(CONFIG_CIFS) += cifs.o

cifs-y := trace.o cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o \
cifs-y := trace.o cifsfs.o cifs_debug.o connect.o dir.o file.o \
	  inode.o link.o misc.o netmisc.o smbencrypt.o transport.o \
	  cifs_unicode.o nterr.o cifsencrypt.o \
	  readdir.o ioctl.o sess.o export.o unc.o winucase.o \
@@ -31,4 +31,4 @@ cifs-$(CONFIG_CIFS_SMB_DIRECT) += smbdirect.o

cifs-$(CONFIG_CIFS_ROOT) += cifsroot.o

cifs-$(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) += smb1ops.o
cifs-$(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) += smb1ops.o cifssmb.o
+23 −49
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ cifs_dump_mem(char *label, void *data, int length)
void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
{
#ifdef CONFIG_CIFS_DEBUG2
	struct smb_hdr *smb = (struct smb_hdr *)buf;
	struct smb_hdr *smb = buf;

	cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d\n",
		 smb->Command, smb->Status.CifsError,
@@ -55,7 +55,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
		return;

	cifs_dbg(VFS, "Dump pending requests:\n");
	spin_lock(&GlobalMid_Lock);
	spin_lock(&server->mid_lock);
	list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
		cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n",
			 mid_entry->mid_state,
@@ -78,7 +78,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
				mid_entry->resp_buf, 62);
		}
	}
	spin_unlock(&GlobalMid_Lock);
	spin_unlock(&server->mid_lock);
#endif /* CONFIG_CIFS_DEBUG2 */
}

@@ -168,7 +168,6 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)

static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
{
	struct list_head *tmp, *tmp1, *tmp2;
	struct TCP_Server_Info *server;
	struct cifs_ses *ses;
	struct cifs_tcon *tcon;
@@ -184,14 +183,10 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
#endif /* CIFS_DEBUG2 */
	spin_lock(&cifs_tcp_ses_lock);
	list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
		list_for_each(tmp, &server->smb_ses_list) {
			ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
			list_for_each(tmp1, &ses->tcon_list) {
				tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
		list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
			list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
				spin_lock(&tcon->open_file_lock);
				list_for_each(tmp2, &tcon->openFileList) {
					cfile = list_entry(tmp2, struct cifsFileInfo,
						     tlist);
				list_for_each_entry(cfile, &tcon->openFileList, tlist) {
					seq_printf(m,
						"0x%x 0x%llx 0x%x %d %d %d %pd",
						tcon->tid,
@@ -218,7 +213,6 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)

static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
{
	struct list_head *tmp2, *tmp3;
	struct mid_q_entry *mid_entry;
	struct TCP_Server_Info *server;
	struct cifs_ses *ses;
@@ -381,9 +375,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)

		seq_printf(m, "\n\n\tSessions: ");
		i = 0;
		list_for_each(tmp2, &server->smb_ses_list) {
			ses = list_entry(tmp2, struct cifs_ses,
					 smb_ses_list);
		list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
			i++;
			if ((ses->serverDomain == NULL) ||
				(ses->serverOS == NULL) ||
@@ -447,9 +439,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
			else
				seq_puts(m, "none\n");

			list_for_each(tmp3, &ses->tcon_list) {
				tcon = list_entry(tmp3, struct cifs_tcon,
						  tcon_list);
			list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
				++j;
				seq_printf(m, "\n\t%d) ", j);
				cifs_debug_tcon(m, tcon);
@@ -473,10 +463,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
			seq_printf(m, "\n\t\t[NONE]");

		seq_puts(m, "\n\n\tMIDs: ");
		spin_lock(&GlobalMid_Lock);
		list_for_each(tmp3, &server->pending_mid_q) {
			mid_entry = list_entry(tmp3, struct mid_q_entry,
					qhead);
		spin_lock(&server->mid_lock);
		list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
			seq_printf(m, "\n\tState: %d com: %d pid:"
					" %d cbdata: %p mid %llu\n",
					mid_entry->mid_state,
@@ -485,7 +473,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
					mid_entry->callback_data,
					mid_entry->mid);
		}
		spin_unlock(&GlobalMid_Lock);
		spin_unlock(&server->mid_lock);
		seq_printf(m, "\n--\n");
	}
	if (c == 0)
@@ -504,7 +492,6 @@ static ssize_t cifs_stats_proc_write(struct file *file,
{
	bool bv;
	int rc;
	struct list_head *tmp1, *tmp2, *tmp3;
	struct TCP_Server_Info *server;
	struct cifs_ses *ses;
	struct cifs_tcon *tcon;
@@ -514,8 +501,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
#ifdef CONFIG_CIFS_STATS2
		int i;

		atomic_set(&totBufAllocCount, 0);
		atomic_set(&totSmBufAllocCount, 0);
		atomic_set(&total_buf_alloc_count, 0);
		atomic_set(&total_small_buf_alloc_count, 0);
#endif /* CONFIG_CIFS_STATS2 */
		atomic_set(&tcpSesReconnectCount, 0);
		atomic_set(&tconInfoReconnectCount, 0);
@@ -525,9 +512,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
		GlobalCurrentXid = 0;
		spin_unlock(&GlobalMid_Lock);
		spin_lock(&cifs_tcp_ses_lock);
		list_for_each(tmp1, &cifs_tcp_ses_list) {
			server = list_entry(tmp1, struct TCP_Server_Info,
					    tcp_ses_list);
		list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
			server->max_in_flight = 0;
#ifdef CONFIG_CIFS_STATS2
			for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
@@ -538,13 +523,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
				server->fastest_cmd[0] = 0;
			}
#endif /* CONFIG_CIFS_STATS2 */
			list_for_each(tmp2, &server->smb_ses_list) {
				ses = list_entry(tmp2, struct cifs_ses,
						 smb_ses_list);
				list_for_each(tmp3, &ses->tcon_list) {
					tcon = list_entry(tmp3,
							  struct cifs_tcon,
							  tcon_list);
			list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
				list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
					atomic_set(&tcon->num_smbs_sent, 0);
					spin_lock(&tcon->stat_lock);
					tcon->bytes_read = 0;
@@ -569,7 +549,6 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
#ifdef CONFIG_CIFS_STATS2
	int j;
#endif /* STATS2 */
	struct list_head *tmp2, *tmp3;
	struct TCP_Server_Info *server;
	struct cifs_ses *ses;
	struct cifs_tcon *tcon;
@@ -579,17 +558,17 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
	seq_printf(m, "Share (unique mount targets): %d\n",
			tconInfoAllocCount.counter);
	seq_printf(m, "SMB Request/Response Buffer: %d Pool size: %d\n",
			bufAllocCount.counter,
			buf_alloc_count.counter,
			cifs_min_rcv + tcpSesAllocCount.counter);
	seq_printf(m, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
			smBufAllocCount.counter, cifs_min_small);
			small_buf_alloc_count.counter, cifs_min_small);
#ifdef CONFIG_CIFS_STATS2
	seq_printf(m, "Total Large %d Small %d Allocations\n",
				atomic_read(&totBufAllocCount),
				atomic_read(&totSmBufAllocCount));
				atomic_read(&total_buf_alloc_count),
				atomic_read(&total_small_buf_alloc_count));
#endif /* CONFIG_CIFS_STATS2 */

	seq_printf(m, "Operations (MIDs): %d\n", atomic_read(&midCount));
	seq_printf(m, "Operations (MIDs): %d\n", atomic_read(&mid_count));
	seq_printf(m,
		"\n%d session %d share reconnects\n",
		tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
@@ -619,13 +598,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
					atomic_read(&server->smb2slowcmd[j]),
					server->hostname, j);
#endif /* STATS2 */
		list_for_each(tmp2, &server->smb_ses_list) {
			ses = list_entry(tmp2, struct cifs_ses,
					 smb_ses_list);
			list_for_each(tmp3, &ses->tcon_list) {
				tcon = list_entry(tmp3,
						  struct cifs_tcon,
						  tcon_list);
		list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
			list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
				i++;
				seq_printf(m, "\n%d) %s", i, tcon->treeName);
				if (tcon->need_reconnect)
+2 −0
Original line number Diff line number Diff line
@@ -1379,6 +1379,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
	return rc;
}

#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
				      const struct cifs_fid *cifsfid, u32 *pacllen,
				      u32 __maybe_unused unused)
@@ -1512,6 +1513,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
	cifs_put_tlink(tlink);
	return rc;
}
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */

/* Translate the CIFS ACL (similar to NTFS ACL) for a file into mode bits */
int
+3 −3
Original line number Diff line number Diff line
@@ -141,13 +141,13 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
	if ((cifs_pdu == NULL) || (server == NULL))
		return -EINVAL;

	spin_lock(&cifs_tcp_ses_lock);
	spin_lock(&server->srv_lock);
	if (!(cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) ||
	    server->tcpStatus == CifsNeedNegotiate) {
		spin_unlock(&cifs_tcp_ses_lock);
		spin_unlock(&server->srv_lock);
		return rc;
	}
	spin_unlock(&cifs_tcp_ses_lock);
	spin_unlock(&server->srv_lock);

	if (!server->session_estab) {
		memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
Loading