Skip to content

Commit 74b54e9

Browse files
committed
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()
2 parents 08d0d34 + c208a2b commit 74b54e9

4 files changed

Lines changed: 12 additions & 33 deletions

File tree

fs/smb/client/cifsproto.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ int cifs_handle_standard(struct TCP_Server_Info *server,
8989
struct mid_q_entry *mid);
9090
char *smb3_fs_context_fullpath(const struct smb3_fs_context *ctx, char dirsep);
9191
int smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx);
92-
int smb3_parse_opt(const char *options, const char *key, char **val);
9392
int cifs_ipaddr_cmp(struct sockaddr *srcaddr, struct sockaddr *rhs);
9493
bool cifs_match_ipaddr(struct sockaddr *srcaddr, struct sockaddr *rhs);
9594
int cifs_discard_remaining_data(struct TCP_Server_Info *server);

fs/smb/client/fs_context.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -536,37 +536,6 @@ cifs_parse_smb_version(struct fs_context *fc, char *value, struct smb3_fs_contex
536536
return 0;
537537
}
538538

539-
int smb3_parse_opt(const char *options, const char *key, char **val)
540-
{
541-
int rc = -ENOENT;
542-
char *opts, *orig, *p;
543-
544-
orig = opts = kstrdup(options, GFP_KERNEL);
545-
if (!opts)
546-
return -ENOMEM;
547-
548-
while ((p = strsep(&opts, ","))) {
549-
char *nval;
550-
551-
if (!*p)
552-
continue;
553-
if (strncasecmp(p, key, strlen(key)))
554-
continue;
555-
nval = strchr(p, '=');
556-
if (nval) {
557-
if (nval == p)
558-
continue;
559-
*nval++ = 0;
560-
*val = kstrdup(nval, GFP_KERNEL);
561-
rc = !*val ? -ENOMEM : 0;
562-
goto out;
563-
}
564-
}
565-
out:
566-
kfree(orig);
567-
return rc;
568-
}
569-
570539
/*
571540
* Remove duplicate path delimiters. Windows is supposed to do that
572541
* but there are some bugs that prevent rename from working if there are

fs/smb/client/smb2inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
230230
num_rqst = 0;
231231
server = cifs_pick_channel(ses);
232232

233-
vars = kzalloc_obj(*vars, GFP_ATOMIC);
233+
vars = kzalloc_obj(*vars, GFP_KERNEL);
234234
if (vars == NULL) {
235235
rc = -ENOMEM;
236236
goto out;

fs/smb/client/smb2ops.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,21 @@ smb2_add_credits(struct TCP_Server_Info *server,
111111
cifs_trace_rw_credits_zero_in_flight);
112112
}
113113
server->in_flight--;
114+
115+
/*
116+
* Rebalance credits when an op drains in_flight. For session setup,
117+
* do this only when the total accumulated credits are high enough (>2)
118+
* so that a newly established secondary channel can reserve credits for
119+
* echoes and oplocks. We expect this to happen at the end of the final
120+
* session setup response.
121+
*/
114122
if (server->in_flight == 0 &&
115123
((optype & CIFS_OP_MASK) != CIFS_NEG_OP) &&
116124
((optype & CIFS_OP_MASK) != CIFS_SESS_OP))
117125
rc = change_conf(server);
126+
else if (server->in_flight == 0 &&
127+
((optype & CIFS_OP_MASK) == CIFS_SESS_OP) && *val > 2)
128+
rc = change_conf(server);
118129
/*
119130
* Sometimes server returns 0 credits on oplock break ack - we need to
120131
* rebalance credits in this case.

0 commit comments

Comments
 (0)