cifs: move cifs_cleanup_volume_info[_content] to fs_context.c
Subsystems (2)
PATCH 2/12 cifs: move [brw]size from cifs_sb to cifs_sb->ctx
In reply to Ronnie Sahlberg--- fs/cifs/cifs_fs_sb.h | 3 --- fs/cifs/cifsfs.c | 11 +++++++---- fs/cifs/connect.c | 21 +++++++++------------ fs/cifs/file.c | 12 ++++++------ fs/cifs/fs_context.c | 3 +++ fs/cifs/fs_context.h | 3 +++ fs/cifs/inode.c | 2 +- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2ops.c | 2 +- 9 files changed, 31 insertions(+), 28 deletions(-)
fs/cifs/cifs_fs_sb.h +0 -3
@@ -62,9 +62,6 @@ struct cifs_sb_info {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;
fs/cifs/cifsfs.c +7 -4
@@ -218,7 +218,7 @@ cifs_read_super(struct super_block *sb)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 */
@@ -615,9 +615,12 @@ cifs_show_options(struct seq_file *s, struct dentry *root)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",
fs/cifs/connect.c +9 -12
@@ -2234,10 +2234,10 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)* 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) ||
@@ -2700,14 +2700,6 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx,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);
@@ -2911,8 +2903,13 @@ static int mount_get_conns(struct smb3_fs_context *ctx, struct cifs_sb_info *cif } } - 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 ; }
fs/cifs/file.c +6 -6
@@ -2336,7 +2336,7 @@ static int cifs_writepages(struct address_space *mapping,* 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 ();
@@ -2369,7 +2369,7 @@ static int cifs_writepages(struct address_space *mapping,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;
@@ -2911,7 +2911,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,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 ;
@@ -3642,7 +3642,7 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file,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 ;
@@ -4028,7 +4028,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset) 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 ;
@@ -4413,7 +4413,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,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 ;
fs/cifs/fs_context.c +3 -0
@@ -783,12 +783,15 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, 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;
fs/cifs/fs_context.h +3 -0
@@ -152,6 +152,9 @@ struct smb3_fs_context {char *nodename;bool got_ip;bool got_version; +bool got_rsize; +bool got_wsize; +bool got_bsize;unsigned short port;char *username;
fs/cifs/inode.c +1 -1
@@ -2409,7 +2409,7 @@ int cifs_getattr(const struct path *path, struct kstat *stat, }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 */
fs/cifs/smb1ops.c +1 -1
@@ -1006,7 +1006,7 @@ cifs_is_read_op(__u32 oplock)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
fs/cifs/smb2ops.c +1 -1
@@ -3951,7 +3951,7 @@ smb3_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key)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 ); }
Signature · 1 line
2.13.6
PATCH 5/12 cifs: simplify handling of cifs_sb/ctx->local_nls
In reply to Ronnie SahlbergOnly load/unload local_nls from cifs_sb and just make the ctx contain a pointer to cifs_sb->ctx.
--- fs/cifs/cifsproto.h | 4 +--- fs/cifs/connect.c | 29 ++++++++++++++--------------- fs/cifs/fs_context.c | 4 ---- fs/cifs/fs_context.h | 2 +- fs/cifs/sess.c | 23 +++++++++++------------ 5 files changed, 27 insertions(+), 35 deletions(-)
fs/cifs/cifsproto.h +1 -3
@@ -598,9 +598,7 @@ extern void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page, unsigned int *len, unsigned int *offset);struct cifs_chan *cifs_ses_find_chan (struct cifs_ses *ses,struct TCP_Server_Info *server); -int cifs_try_adding_channels (struct cifs_ses *ses); -int cifs_ses_add_channel (struct cifs_ses *ses, -struct cifs_server_iface *iface); +int cifs_try_adding_channels (struct cifs_sb_info *cifs_sb,struct cifs_ses *ses);bool is_server_using_iface (struct TCP_Server_Info *server,struct cifs_server_iface *iface);bool is_ses_using_iface (struct cifs_ses *ses,struct cifs_server_iface *iface);
fs/cifs/connect.c +14 -15
@@ -2703,7 +2703,19 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx,cifs_dbg (FYI ,"file mode: %04ho dir mode: %04ho\n" , cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); - cifs_sb->local_nls = ctx->local_nls; +/* this is needed for ASCII cp to Unicode converts */ +if (ctx->iocharset ==NULL ) { +/* load_nls_default cannot return null */ + cifs_sb->local_nls =load_nls_default (); + }else { + cifs_sb->local_nls =load_nls (ctx->iocharset); +if (cifs_sb->local_nls ==NULL ) { +cifs_dbg (VFS ,"CIFS mount error: iocharset %s not found\n" , + ctx->iocharset); +return -ELIBACC ; + } + } + ctx->local_nls = cifs_sb->local_nls;if (ctx->nodfs) cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NO_DFS ;
@@ -3173,19 +3185,6 @@ cifs_setup_volume_info(struct smb3_fs_context *ctx)return -EINVAL ; } -/* this is needed for ASCII cp to Unicode converts */ -if (ctx->iocharset ==NULL ) { -/* load_nls_default cannot return null */ - ctx->local_nls =load_nls_default (); - }else { - ctx->local_nls =load_nls (ctx->iocharset); -if (ctx->local_nls ==NULL ) { -cifs_dbg (VFS ,"CIFS mount error: iocharset %s not found\n" , - ctx->iocharset); -return -ELIBACC ; - } - } -return rc; }
@@ -3507,7 +3506,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) out:free_xid (xid); -cifs_try_adding_channels (ses); +cifs_try_adding_channels (cifs_sb, ses);return mount_setup_tlink (cifs_sb, ses, tcon); error:
fs/cifs/fs_context.c +0 -4
@@ -303,7 +303,6 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctxmemcpy (new_ctx, ctx,sizeof (*ctx)); new_ctx->prepath =NULL ; new_ctx->mount_options =NULL ; - new_ctx->local_nls =NULL ; new_ctx->nodename =NULL ; new_ctx->username =NULL ; new_ctx->password =NULL ;
@@ -1349,9 +1348,6 @@ smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx) ctx->iocharset =NULL ;kfree (ctx->prepath); ctx->prepath =NULL ; - -unload_nls (ctx->local_nls); - ctx->local_nls =NULL ; }void
fs/cifs/fs_context.h +1 -1
@@ -237,7 +237,7 @@ struct smb3_fs_context {char *prepath;struct sockaddr_storage dstaddr;/* destination address */ struct sockaddr_storage srcaddr;/* allow binding to a local IP */ -struct nls_table *local_nls; +struct nls_table *local_nls;/* This is a copy of the pointer in cifs_sb */ unsigned int echo_interval;/* echo interval in secs */ __u64 snapshot_time;/* needed for timewarp tokens */ __u32 handle_timeout;/* persistent and durable handle timeout in ms */
fs/cifs/sess.c +11 -12
@@ -34,6 +34,10 @@#include "smb2proto.h" #include "fs_context.h" +static int +cifs_ses_add_channel (struct cifs_sb_info *cifs_sb,struct cifs_ses *ses, +struct cifs_server_iface *iface); +bool is_server_using_iface (struct TCP_Server_Info *server,struct cifs_server_iface *iface)
@@ -71,7 +75,7 @@ bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface) }/* returns number of channels added */ -int cifs_try_adding_channels (struct cifs_ses *ses) +int cifs_try_adding_channels (struct cifs_sb_info *cifs_sb,struct cifs_ses *ses) {int old_chan_count = ses->chan_count;int left = ses->chan_max - ses->chan_count;
@@ -134,7 +138,7 @@ int cifs_try_adding_channels(struct cifs_ses *ses)continue ; } - rc =cifs_ses_add_channel (ses, iface); + rc =cifs_ses_add_channel (cifs_sb, ses, iface);if (rc) {cifs_dbg (FYI ,"failed to open extra channel on iface#%d rc=%d\n" , i, rc);
@@ -167,8 +171,9 @@ cifs_ses_find_chan(struct cifs_ses *ses, struct TCP_Server_Info *server)return NULL ; } -int -cifs_ses_add_channel (struct cifs_ses *ses,struct cifs_server_iface *iface) +static int +cifs_ses_add_channel (struct cifs_sb_info *cifs_sb,struct cifs_ses *ses, +struct cifs_server_iface *iface) {struct cifs_chan *chan;struct smb3_fs_context ctx = {NULL };
@@ -229,13 +234,8 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)/* * This will be used for encoding/decoding user/domain/pw * during sess setup auth. -* -* XXX: We use the default for simplicity but the proper way -* would be to use the one that ses used, which is not -* stored. This might break when dealing with non-ascii -* strings. */ - ctx.local_nls =load_nls_default (); + ctx.local_nls = cifs_sb->local_nls;/* Use RDMA if possible */ ctx.rdma = iface->rdma_capable;
@@ -275,7 +275,7 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)if (rc) goto out; - rc =cifs_setup_session (xid, ses, ctx.local_nls); + rc =cifs_setup_session (xid, ses, cifs_sb->local_nls);if (rc) goto out;
@@ -298,7 +298,6 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)if (rc && chan->server)cifs_put_tcp_session (chan->server,0 ); -unload_nls (ctx.local_nls);return rc; }
Signature · 1 line
2.13.6
PATCH 8/12 cifs: do not allow changing posix_paths during remount
In reply to Ronnie Sahlberg--- fs/cifs/fs_context.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/cifs/fs_context.c +4 -0
@@ -626,6 +626,10 @@ static void smb3_fs_context_free(struct fs_context *fc)static int smb3_verify_reconfigure_ctx (struct smb3_fs_context *new_ctx,struct smb3_fs_context *old_ctx) { +if (new_ctx->posix_paths != old_ctx->posix_paths) { +cifs_dbg (VFS ,"can not change posixpaths during remount\n" ); +return -EINVAL ; + }if (new_ctx->sectype != old_ctx->sectype) {cifs_dbg (VFS ,"can not change sec during remount\n" );return -EINVAL ;
Signature · 1 line
2.13.6
PATCH 12/12 cifs: fix uninitialized variable in smb3_fs_context_parse_param
In reply to Ronnie Sahlberg--- fs/cifs/fs_context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/cifs/fs_context.c +3 -1
@@ -725,8 +725,10 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,* we will need special handling of them. */ if (param->type == fs_value_is_string && param->string[0 ] ==0 ) { -if (!strcmp ("pass" , param->key) || !strcmp ("password" , param->key)) +if (!strcmp ("pass" , param->key) || !strcmp ("password" , param->key)) { skip_parsing = true; + opt = Opt_pass; + } }if (!skip_parsing) {
Signature · 1 line
2.13.6
PATCH 1/12 cifs: move cifs_cleanup_volume_info[_content] to fs_context.c
and rename it to smb3_cleanup_fs_context[_content]
--- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsproto.h | 3 --- fs/cifs/connect.c | 47 ++++------------------------------------------- fs/cifs/dfs_cache.c | 4 ++-- fs/cifs/fs_context.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 ++ 6 files changed, 51 insertions(+), 52 deletions(-)
fs/cifs/cifsfs.c +1 -1
@@ -874,7 +874,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, out:if (cifs_sb) {kfree (cifs_sb->prepath); -cifs_cleanup_volume_info (cifs_sb->ctx); +smb3_cleanup_fs_context (cifs_sb->ctx);kfree (cifs_sb); }return root;
fs/cifs/cifsproto.h +0 -3
@@ -237,7 +237,6 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,extern int cifs_setup_cifs_sb (struct smb3_fs_context *ctx,struct cifs_sb_info *cifs_sb);extern int cifs_match_super (struct super_block *,void *); -extern void cifs_cleanup_volume_info (struct smb3_fs_context *ctx);extern int cifs_mount (struct cifs_sb_info *cifs_sb,struct smb3_fs_context *ctx);extern void cifs_umount (struct cifs_sb_info *);extern void cifs_mark_open_files_invalid (struct cifs_tcon *tcon);
@@ -552,8 +551,6 @@ extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,extern int cifs_setup_volume_info (struct smb3_fs_context *ctx); -extern void -cifs_cleanup_volume_info_contents (struct smb3_fs_context *ctx);extern struct TCP_Server_Info *cifs_find_tcp_session (struct smb3_fs_context *ctx);
fs/cifs/connect.c +4 -43
77 lines not on this page · raw message
fs/cifs/dfs_cache.c +2 -2
@@ -587,7 +587,7 @@ static void __vol_release(struct vol_info *vi) {kfree (vi->fullpath);kfree (vi->mntdata); -cifs_cleanup_volume_info_contents (&vi->ctx); +smb3_cleanup_fs_context_contents (&vi->ctx);kfree (vi); }
@@ -1468,7 +1468,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi, ses =cifs_get_smb_ses (server, &ctx); out: -cifs_cleanup_volume_info_contents (&ctx); +smb3_cleanup_fs_context_contents (&ctx);kfree (mdata);kfree (rpath);
fs/cifs/fs_context.c +42 -3
66 lines not on this page · raw message
fs/cifs/fs_context.h +2 -0
@@ -254,6 +254,8 @@ extern int cifs_parse_cache_flavor(char *value,extern int cifs_parse_security_flavors (char *value,struct smb3_fs_context *ctx);extern int smb3_init_fs_context (struct fs_context *fc); +extern void smb3_cleanup_fs_context_contents (struct smb3_fs_context *ctx); +extern void smb3_cleanup_fs_context (struct smb3_fs_context *ctx);static inline struct smb3_fs_context *smb3_fc2context (const struct fs_context *fc) {
Signature · 1 line
2.13.6
PATCH 3/12 cifs: add initial reconfigure support
--- fs/cifs/fs_context.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)
fs/cifs/fs_context.c +33 -3
@@ -620,14 +620,44 @@ static void smb3_fs_context_free(struct fs_context *fc)smb3_cleanup_fs_context (ctx); } -static int smb3_reconfigure (struct fs_context *fc) +/* +* Compare the old and new proposed context during reconfigure +* and check if the changes are compatible. +*/ +static int smb3_verify_reconfigure_ctx (struct smb3_fs_context *new_ctx, +struct smb3_fs_context *old_ctx) { -// TODO: struct smb3_fs_context *ctx = smb3_fc2context(fc); +if (new_ctx->sectype != old_ctx->sectype) { +cifs_dbg (VFS ,"can not change sec during remount\n" ); +return -EINVAL ; + } -/* FIXME : add actual reconfigure */ return 0 ; } +static int smb3_reconfigure (struct fs_context *fc) +{ +struct smb3_fs_context *ctx =smb3_fc2context (fc); +struct dentry *root = fc->root; +struct cifs_sb_info *cifs_sb =CIFS_SB (root->d_sb); +int rc; + + rc =smb3_verify_reconfigure_ctx (ctx, cifs_sb->ctx); +if (rc) +return rc; + +/* +* Steal the UNC from the old and to be destroyed context. +*/ + ctx->UNC = cifs_sb->ctx->UNC; + cifs_sb->ctx->UNC =NULL ; + +smb3_cleanup_fs_context_contents (cifs_sb->ctx); + rc =smb3_fs_context_dup (cifs_sb->ctx, ctx); + +return rc; +} +static int smb3_fs_context_parse_param (struct fs_context *fc,struct fs_parameter *param) {
Signature · 1 line
2.13.6
PATCH 7/12 cifs: uncomplicate printing the iocharset parameter
In reply to Ronnie SahlbergThere is no need to load the default nls to check if the iocharset argument was specified or not since we have it in cifs_sb->ctx
--- fs/cifs/cifsfs.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
fs/cifs/cifsfs.c +2 -15
@@ -462,18 +462,6 @@ cifs_show_cache_flavor(struct seq_file *s, struct cifs_sb_info *cifs_sb)seq_puts (s,"loose" ); } -static void -cifs_show_nls (struct seq_file *s,struct nls_table *cur) -{ -struct nls_table *def; - -/* Display iocharset= option if it's not default charset */ - def =load_nls_default (); -if (def != cur) -seq_printf (s,",iocharset=%s" , cur->charset); -unload_nls (def); -} -/* * cifs_show_options() is for displaying mount options in /proc/mounts. * Not all settable options are displayed but most of the important
@@ -537,9 +525,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)seq_printf (s,",file_mode=0%ho,dir_mode=0%ho" , cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); - -cifs_show_nls (s, cifs_sb->local_nls); - +if (cifs_sb->ctx->iocharset) +seq_printf (s,",iocharset=%s" , cifs_sb->ctx->iocharset);if (tcon->seal)seq_puts (s,",seal" );else if (tcon->ses->server->ignore_signature)
Signature · 1 line
2.13.6
PATCH 4/12 cifs: we do not allow changing username/password/unc/... during remount
In reply to Ronnie Sahlberg--- fs/cifs/cifsfs.c | 2 +- fs/cifs/fs_context.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 +- 3 files changed, 52 insertions(+), 5 deletions(-)
fs/cifs/cifsfs.c +1 -1
@@ -493,7 +493,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (tcon->no_lease)seq_puts (s,",nolease" ); -if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_MULTIUSER ) +if (cifs_sb->ctx->multiuser)seq_puts (s,",multiuser" );else if (tcon->ses->user_name)seq_show_option (s,"username" , tcon->ses->user_name);
fs/cifs/fs_context.c +50 -3
70 lines not on this page · raw message
fs/cifs/fs_context.h +1 -1
@@ -149,7 +149,6 @@ struct smb3_fs_context {bool uid_specified;bool gid_specified;bool sloppy; -char *nodename;bool got_ip;bool got_version;bool got_rsize;
@@ -161,6 +160,7 @@ struct smb3_fs_context {char *password;char *domainname;char *UNC ; +char *nodename;char *iocharset;/* local code page for mapping to and from Unicode */ char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL ];/* clnt nb name */ char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL ];/* srvr nb name */
Signature · 1 line
2.13.6
PATCH 11/12 cifs: update mnt_cifs_flags during reconfigure
In reply to Ronnie Sahlberg--- fs/cifs/fs_context.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/fs_context.c +1 -0
@@ -704,6 +704,7 @@ static int smb3_reconfigure(struct fs_context *fc)smb3_cleanup_fs_context_contents (cifs_sb->ctx); rc =smb3_fs_context_dup (cifs_sb->ctx, ctx); +smb3_update_mnt_flags (cifs_sb);return rc; }
Signature · 1 line
2.13.6
PATCH 6/12 cifs: don't create a temp nls in cifs_setup_ipc
In reply to Ronnie Sahlbergjust use the one that is already available in ctx
--- fs/cifs/connect.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/cifs/connect.c +1 -6
@@ -1464,7 +1464,6 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) {int rc =0 , xid;struct cifs_tcon *tcon; -struct nls_table *nls_codepage;char unc[SERVER_NAME_LENGTH +sizeof ("//x/IPC$" )] = {0 };bool seal = false;struct TCP_Server_Info *server = ses->server;
@@ -1489,14 +1488,11 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx)scnprintf (unc,sizeof (unc),"\\\\%s\\IPC$" , server->hostname); -/* cannot fail */ - nls_codepage =load_nls_default (); - xid =get_xid (); tcon->ses = ses; tcon->ipc = true; tcon->seal = seal; - rc = server->ops->tree_connect (xid, ses, unc, tcon, nls_codepage); + rc = server->ops->tree_connect (xid, ses, unc, tcon, ctx->local_nls);free_xid (xid);if (rc) {
@@ -1509,7 +1505,6 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) ses->tcon_ipc = tcon; out: -unload_nls (nls_codepage);return rc; }
Signature · 1 line
2.13.6
PATCH 9/12 cifs: remove ctx argument from cifs_setup_cifs_sb
In reply to Ronnie Sahlberg--- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsproto.h | 3 +-- fs/cifs/connect.c | 7 ++++--- 3 files changed, 6 insertions(+), 6 deletions(-)
fs/cifs/cifsfs.c +1 -1
@@ -810,7 +810,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, goto out; } - rc =cifs_setup_cifs_sb (cifs_sb->ctx, cifs_sb); + rc =cifs_setup_cifs_sb (cifs_sb);if (rc) { root =ERR_PTR (rc); goto out;
fs/cifs/cifsproto.h +1 -2
@@ -234,8 +234,7 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,struct page *page, unsigned int page_offset, unsigned int to_read); -extern int cifs_setup_cifs_sb (struct smb3_fs_context *ctx, -struct cifs_sb_info *cifs_sb); +extern int cifs_setup_cifs_sb (struct cifs_sb_info *cifs_sb);extern int cifs_match_super (struct super_block *,void *);extern int cifs_mount (struct cifs_sb_info *cifs_sb,struct smb3_fs_context *ctx);extern void cifs_umount (struct cifs_sb_info *);
fs/cifs/connect.c +4 -3
@@ -2687,16 +2687,17 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, } } -int cifs_setup_cifs_sb (struct smb3_fs_context *ctx, -struct cifs_sb_info *cifs_sb) +int cifs_setup_cifs_sb (struct cifs_sb_info *cifs_sb) { +struct smb3_fs_context *ctx = cifs_sb->ctx; +INIT_DELAYED_WORK (&cifs_sb->prune_tlinks, cifs_prune_tlinks);spin_lock_init (&cifs_sb->tlink_tree_lock); cifs_sb->tlink_tree =RB_ROOT ;cifs_dbg (FYI ,"file mode: %04ho dir mode: %04ho\n" , - cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); + ctx->file_mode, ctx->dir_mode);/* this is needed for ASCII cp to Unicode converts */ if (ctx->iocharset ==NULL ) {
Signature · 1 line
2.13.6
PATCH 10/12 cifs: move update of flags into a separate function
In reply to Ronnie SahlbergThis funciton will set/clear flags that can be changed during mount or remount
--- fs/cifs/connect.c | 74 +----------------------- fs/cifs/fs_context.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/cifs/fs_context.h | 1 + 3 files changed, 159 insertions(+), 71 deletions(-)
fs/cifs/connect.c +3 -71
@@ -2713,61 +2713,10 @@ int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb) } ctx->local_nls = cifs_sb->local_nls; -if (ctx->nodfs) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NO_DFS ; -if (ctx->noperm) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NO_PERM ; -if (ctx->setuids) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_SET_UID ; -if (ctx->setuidfromacl) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_UID_FROM_ACL ; -if (ctx->server_ino) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_SERVER_INUM ; -if (ctx->remap) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_MAP_SFM_CHR ; -if (ctx->sfu_remap) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_MAP_SPECIAL_CHR ; -if (ctx->no_xattr) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NO_XATTR ; -if (ctx->sfu_emul) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_UNX_EMUL ; -if (ctx->nobrl) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NO_BRL ; -if (ctx->nohandlecache) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NO_HANDLE_CACHE ; -if (ctx->nostrictsync) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NOSSYNC ; -if (ctx->mand_lock) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_NOPOSIXBRL ; -if (ctx->rwpidforward) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_RWPIDFORWARD ; -if (ctx->mode_ace) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_MODE_FROM_SID ; -if (ctx->cifs_acl) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_ACL ; -if (ctx->backupuid_specified) { - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPUID ; - } -if (ctx->backupgid_specified) { - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPGID ; - } -if (ctx->override_uid) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_OVERR_UID ; -if (ctx->override_gid) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_OVERR_GID ; -if (ctx->dynperm) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_DYNPERM ; -if (ctx->fsc) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_FSCACHE ; -if (ctx->multiuser) - cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_MULTIUSER | -CIFS_MOUNT_NO_PERM ); -if (ctx->strict_io) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_STRICT_IO ; -if (ctx->direct_io) { +smb3_update_mnt_flags (cifs_sb); + +if (ctx->direct_io)cifs_dbg (FYI ,"mounting share using direct i/o\n" ); - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_DIRECT_IO ; - }if (ctx->cache_ro) {cifs_dbg (VFS ,"mounting share with read only caching. Ensure that the share will not be modified while in use.\n" ); cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_RO_CACHE ;
@@ -2776,23 +2725,6 @@ int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb) cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_RO_CACHE |CIFS_MOUNT_RW_CACHE ); } -if (ctx->mfsymlinks) { -if (ctx->sfu_emul) { -/* -* Our SFU ("Services for Unix" emulation does not allow -* creating symlinks but does allow reading existing SFU -* symlinks (it does allow both creating and reading SFU -* style mknod and FIFOs though). When "mfsymlinks" and -* "sfu" are both enabled at the same time, it allows -* reading both types of symlinks, but will only create -* them with mfsymlinks format. This allows better -* Apple compatibility (probably better for Samba too) -* while still recognizing old Windows style symlinks. -*/ -cifs_dbg (VFS ,"mount options mfsymlinks and sfu both enabled\n" ); - } - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_MF_SYMLINKS ; - }if ((ctx->cifs_acl) && (ctx->dynperm))cifs_dbg (VFS ,"mount option dynperm ignored if cifsacl mount option supported\n" );
fs/cifs/fs_context.c +155 -0
158 lines not on this page · raw message
fs/cifs/fs_context.h +1 -0
@@ -266,5 +266,6 @@ static inline struct smb3_fs_context *smb3_fc2context(const struct fs_context *f }extern int smb3_fs_context_dup (struct smb3_fs_context *new_ctx,struct smb3_fs_context *ctx); +extern void smb3_update_mnt_flags (struct cifs_sb_info *cifs_sb);#endif
Signature · 1 line
2.13.6