Commit 74b54e9b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'v7.1-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - multichannel crediting fix

 - memory allocation improvement for smb2_compound_op

 - remove some dead code

* tag 'v7.1-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: change_conf needs to be called for session setup
  smb: client: change allocation requirements in smb2_compound_op
  smb/client: remove unused smb3_parse_opt()
parents 08d0d346 c208a2b9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ int cifs_handle_standard(struct TCP_Server_Info *server,
			 struct mid_q_entry *mid);
char *smb3_fs_context_fullpath(const struct smb3_fs_context *ctx, char dirsep);
int smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx);
int smb3_parse_opt(const char *options, const char *key, char **val);
int cifs_ipaddr_cmp(struct sockaddr *srcaddr, struct sockaddr *rhs);
bool cifs_match_ipaddr(struct sockaddr *srcaddr, struct sockaddr *rhs);
int cifs_discard_remaining_data(struct TCP_Server_Info *server);
+0 −31
Original line number Diff line number Diff line
@@ -536,37 +536,6 @@ cifs_parse_smb_version(struct fs_context *fc, char *value, struct smb3_fs_contex
	return 0;
}

int smb3_parse_opt(const char *options, const char *key, char **val)
{
	int rc = -ENOENT;
	char *opts, *orig, *p;

	orig = opts = kstrdup(options, GFP_KERNEL);
	if (!opts)
		return -ENOMEM;

	while ((p = strsep(&opts, ","))) {
		char *nval;

		if (!*p)
			continue;
		if (strncasecmp(p, key, strlen(key)))
			continue;
		nval = strchr(p, '=');
		if (nval) {
			if (nval == p)
				continue;
			*nval++ = 0;
			*val = kstrdup(nval, GFP_KERNEL);
			rc = !*val ? -ENOMEM : 0;
			goto out;
		}
	}
out:
	kfree(orig);
	return rc;
}

/*
 * Remove duplicate path delimiters. Windows is supposed to do that
 * but there are some bugs that prevent rename from working if there are
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
	num_rqst = 0;
	server = cifs_pick_channel(ses);

	vars = kzalloc_obj(*vars, GFP_ATOMIC);
	vars = kzalloc_obj(*vars, GFP_KERNEL);
	if (vars == NULL) {
		rc = -ENOMEM;
		goto out;
+11 −0
Original line number Diff line number Diff line
@@ -111,10 +111,21 @@ smb2_add_credits(struct TCP_Server_Info *server,
				      cifs_trace_rw_credits_zero_in_flight);
	}
	server->in_flight--;

	/*
	 * Rebalance credits when an op drains in_flight. For session setup,
	 * do this only when the total accumulated credits are high enough (>2)
	 * so that a newly established secondary channel can reserve credits for
	 * echoes and oplocks. We expect this to happen at the end of the final
	 * session setup response.
	 */
	if (server->in_flight == 0 &&
	   ((optype & CIFS_OP_MASK) != CIFS_NEG_OP) &&
	   ((optype & CIFS_OP_MASK) != CIFS_SESS_OP))
		rc = change_conf(server);
	else if (server->in_flight == 0 &&
		 ((optype & CIFS_OP_MASK) == CIFS_SESS_OP) && *val > 2)
		rc = change_conf(server);
	/*
	 * Sometimes server returns 0 credits on oplock break ack - we need to
	 * rebalance credits in this case.