From 0c2b5f7ce50c24099e8ed7d35936e89fe9ca26ff Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 15 Dec 2020 13:28:50 -0600 Subject: cifs: fix rsize/wsize to be negotiated values Also make sure these are displayed in /proc/mounts Signed-off-by: Steve French Reviewed-by: Ronnie Sahlberg --- fs/cifs/cifsfs.c | 9 +++------ fs/cifs/connect.c | 8 ++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'fs/cifs') diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index a19387fe8b47..4c9e12b46810 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -621,12 +621,9 @@ cifs_show_options(struct seq_file *s, struct dentry *root) from_kgid_munged(&init_user_ns, cifs_sb->ctx->backupgid)); - if (cifs_sb->ctx->got_rsize) - seq_printf(s, ",rsize=%u", cifs_sb->ctx->rsize); - if (cifs_sb->ctx->got_wsize) - seq_printf(s, ",wsize=%u", cifs_sb->ctx->wsize); - if (cifs_sb->ctx->got_bsize) - seq_printf(s, ",bsize=%u", cifs_sb->ctx->bsize); + seq_printf(s, ",rsize=%u", cifs_sb->ctx->rsize); + seq_printf(s, ",wsize=%u", cifs_sb->ctx->wsize); + seq_printf(s, ",bsize=%u", cifs_sb->ctx->bsize); if (tcon->ses->server->min_offload) seq_printf(s, ",esize=%u", tcon->ses->server->min_offload); seq_printf(s, ",echo_interval=%lu", diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index de747ee40e87..64a41b32fbb1 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2859,10 +2859,14 @@ static int mount_get_conns(struct smb3_fs_context *ctx, struct cifs_sb_info *cif /* * Clamp the rsize/wsize mount arguments if they are too big for the server + * and set the rsize/wsize to the negotiated values if not passed in by + * the user on mount */ - if (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx)) + if ((cifs_sb->ctx->wsize == 0) || + (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) cifs_sb->ctx->wsize = server->ops->negotiate_wsize(tcon, ctx); - if (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)) + if ((cifs_sb->ctx->rsize == 0) || + (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); return 0; -- cgit v1.2.3