struct tcon_link *master_tlink;
struct nls_table *local_nls;
struct smb3_fs_context *ctx;
- unsigned int bsize;
- unsigned int rsize;
- unsigned int wsize;
atomic_t active;
unsigned int mnt_cifs_flags;
struct delayed_work prune_tlinks;
if (rc)
goto out_no_root;
/* tune readahead according to rsize */
- sb->s_bdi->ra_pages = cifs_sb->rsize / PAGE_SIZE;
+ sb->s_bdi->ra_pages = cifs_sb->ctx->rsize / PAGE_SIZE;
sb->s_blocksize = CIFS_MAX_MSGSIZE;
sb->s_blocksize_bits = 14; /* default 2**14 = CIFS_MAX_MSGSIZE */
from_kgid_munged(&init_user_ns,
cifs_sb->ctx->backupgid));
- seq_printf(s, ",rsize=%u", cifs_sb->rsize);
- seq_printf(s, ",wsize=%u", cifs_sb->wsize);
- seq_printf(s, ",bsize=%u", cifs_sb->bsize);
+ 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);
if (tcon->ses->server->min_offload)
seq_printf(s, ",esize=%u", tcon->ses->server->min_offload);
seq_printf(s, ",echo_interval=%lu",
* We want to share sb only if we don't specify an r/wsize or
* specified r/wsize is greater than or equal to existing one.
*/
- if (new->wsize && new->wsize < old->wsize)
+ if (new->ctx->wsize && new->ctx->wsize < old->ctx->wsize)
return 0;
- if (new->rsize && new->rsize < old->rsize)
+ if (new->ctx->rsize && new->ctx->rsize < old->ctx->rsize)
return 0;
if (!uid_eq(old->ctx->linux_uid, new->ctx->linux_uid) ||
spin_lock_init(&cifs_sb->tlink_tree_lock);
cifs_sb->tlink_tree = RB_ROOT;
- cifs_sb->bsize = ctx->bsize;
- /*
- * Temporarily set r/wsize for matching superblock. If we end up using
- * new sb then client will later negotiate it downward if needed.
- */
- cifs_sb->rsize = ctx->rsize;
- cifs_sb->wsize = ctx->wsize;
-
cifs_dbg(FYI, "file mode: %04ho dir mode: %04ho\n",
cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode);
}
}
- cifs_sb->wsize = server->ops->negotiate_wsize(tcon, ctx);
- cifs_sb->rsize = server->ops->negotiate_rsize(tcon, ctx);
+ /*
+ * Clamp the rsize/wsize mount arguments if they are too big for the server
+ */
+ if (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))
+ cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx);
return 0;
}
* If wsize is smaller than the page cache size, default to writing
* one page at a time via cifs_writepage
*/
- if (cifs_sb->wsize < PAGE_SIZE)
+ if (cifs_sb->ctx->wsize < PAGE_SIZE)
return generic_writepages(mapping, wbc);
xid = get_xid();
if (rc)
get_file_rc = rc;
- rc = server->ops->wait_mtu_credits(server, cifs_sb->wsize,
+ rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->wsize,
&wsize, credits);
if (rc != 0) {
done = true;
break;
}
- rc = server->ops->wait_mtu_credits(server, cifs_sb->wsize,
+ rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->wsize,
&wsize, credits);
if (rc)
break;
break;
}
- rc = server->ops->wait_mtu_credits(server, cifs_sb->rsize,
+ rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
&rsize, credits);
if (rc)
break;
cifs_sb = CIFS_FILE_SB(file);
/* FIXME: set up handlers for larger reads and/or convert to async */
- rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize);
+ rsize = min_t(unsigned int, cifs_sb->ctx->rsize, CIFSMaxBufSize);
if (file->private_data == NULL) {
rc = -EBADF;
break;
}
- rc = server->ops->wait_mtu_credits(server, cifs_sb->rsize,
+ rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
&rsize, credits);
if (rc)
break;
goto cifs_parse_mount_err;
}
ctx->bsize = result.uint_32;
+ ctx->got_bsize = true;
break;
case Opt_rsize:
ctx->rsize = result.uint_32;
+ ctx->got_rsize = true;
break;
case Opt_wsize:
ctx->wsize = result.uint_32;
+ ctx->got_wsize = true;
break;
case Opt_actimeo:
ctx->actimeo = HZ * result.uint_32;
char *nodename;
bool got_ip;
bool got_version;
+ bool got_rsize;
+ bool got_wsize;
+ bool got_bsize;
unsigned short port;
char *username;
}
generic_fillattr(inode, stat);
- stat->blksize = cifs_sb->bsize;
+ stat->blksize = cifs_sb->ctx->bsize;
stat->ino = CIFS_I(inode)->uniqueid;
/* old CIFS Unix Extensions doesn't return create time */
static unsigned int
cifs_wp_retry_size(struct inode *inode)
{
- return CIFS_SB(inode->i_sb)->wsize;
+ return CIFS_SB(inode->i_sb)->ctx->wsize;
}
static bool
static unsigned int
smb2_wp_retry_size(struct inode *inode)
{
- return min_t(unsigned int, CIFS_SB(inode->i_sb)->wsize,
+ return min_t(unsigned int, CIFS_SB(inode->i_sb)->ctx->wsize,
SMB2_MAX_BUFFER_SIZE);
}