cifs: move update of flags into a separate function
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/21 cifs: rename dup_vol to smb3_fs_context_dup and move it into fs_context.c
--- fs/cifs/dfs_cache.c | 60 +--------------------------------------------------- fs/cifs/fs_context.c | 41 +++++++++++++++++++++++++++++++++++ fs/cifs/fs_context.h | 3 ++- 3 files changed, 44 insertions(+), 60 deletions(-)
fs/cifs/dfs_cache.c +1 -59
@@ -1141,64 +1141,6 @@ int dfs_cache_get_tgt_referral(const char *path,return rc; } -static int dup_vol (struct smb3_fs_context *ctx,struct smb3_fs_context *new) -{ -memcpy (new, ctx,sizeof (*new)); - -if (ctx->username) { - new->username =kstrndup (ctx->username,strlen (ctx->username), -GFP_KERNEL ); -if (!new->username) -return -ENOMEM ; - } -if (ctx->password) { - new->password =kstrndup (ctx->password,strlen (ctx->password), -GFP_KERNEL ); -if (!new->password) - goto err_free_username; - } -if (ctx->UNC) { -cifs_dbg (FYI ,"%s: ctx->UNC: %s\n" , __func__, ctx->UNC); - new->UNC =kstrndup (ctx->UNC,strlen (ctx->UNC),GFP_KERNEL ); -if (!new->UNC) - goto err_free_password; - } -if (ctx->domainname) { - new->domainname =kstrndup (ctx->domainname, -strlen (ctx->domainname),GFP_KERNEL ); -if (!new->domainname) - goto err_free_unc; - } -if (ctx->iocharset) { - new->iocharset =kstrndup (ctx->iocharset, -strlen (ctx->iocharset),GFP_KERNEL ); -if (!new->iocharset) - goto err_free_domainname; - } -if (ctx->prepath) { -cifs_dbg (FYI ,"%s: ctx->prepath: %s\n" , __func__, ctx->prepath); - new->prepath =kstrndup (ctx->prepath,strlen (ctx->prepath), -GFP_KERNEL ); -if (!new->prepath) - goto err_free_iocharset; - } - -return 0 ; - -err_free_iocharset: -kfree (new->iocharset); -err_free_domainname: -kfree (new->domainname); -err_free_unc: -kfree (new->UNC); -err_free_password: -kfree_sensitive (new->password); -err_free_username: -kfree (new->username); -kfree (new); -return -ENOMEM ; -} -/** * dfs_cache_add_vol - add a cifs volume during mount() that will be handled by * DFS cache refresh worker.
@@ -1229,7 +1171,7 @@ int dfs_cache_add_vol(char *mntdata, struct smb3_fs_context *ctx, const char *fu goto err_free_vi; } - rc =dup_vol (ctx, &vi->ctx); + rc =smb3_fs_context_dup (&vi->ctx, ctx);if (rc) goto err_free_fullpath;
fs/cifs/fs_context.c +41 -0
50 lines not on this page · raw message
fs/cifs/fs_context.h +2 -1
@@ -152,6 +152,7 @@ struct smb3_fs_context { bool rootfs:1; /* if it's a SMB root file system */ }; -int cifs_parse_security_flavors (char *value,struct smb3_fs_context *ctx); +extern int cifs_parse_security_flavors (char *value,struct smb3_fs_context *ctx); +extern int smb3_fs_context_dup (struct smb3_fs_context *new_ctx,struct smb3_fs_context *ctx);#endif
Signature · 1 line
2.13.6
PATCH 3/21 cifs: move the enum for cifs parameters into fs_context.h
In reply to a message not in the archive--- fs/cifs/connect.c | 57 ------------------------------ fs/cifs/fs_context.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 57 deletions(-)
fs/cifs/connect.c +0 -57
@@ -73,63 +73,6 @@ extern bool disable_legacy_dialects;/* Drop the connection to not overload the server */ #define NUM_STATUS_IO_TIMEOUT 5 -enum { -/* Mount options that take no arguments */ - Opt_user_xattr, Opt_nouser_xattr, - Opt_forceuid, Opt_noforceuid, - Opt_forcegid, Opt_noforcegid, - Opt_noblocksend, Opt_noautotune, Opt_nolease, - Opt_hard, Opt_soft, Opt_perm, Opt_noperm, Opt_nodelete, - Opt_mapposix, Opt_nomapposix, - Opt_mapchars, Opt_nomapchars, Opt_sfu, - Opt_nosfu, Opt_nodfs, Opt_posixpaths, - Opt_noposixpaths, Opt_nounix, Opt_unix, - Opt_nocase, - Opt_brl, Opt_nobrl, - Opt_handlecache, Opt_nohandlecache, - Opt_forcemandatorylock, Opt_setuidfromacl, Opt_setuids, - Opt_nosetuids, Opt_dynperm, Opt_nodynperm, - Opt_nohard, Opt_nosoft, - Opt_nointr, Opt_intr, - Opt_nostrictsync, Opt_strictsync, - Opt_serverino, Opt_noserverino, - Opt_rwpidforward, Opt_cifsacl, Opt_nocifsacl, - Opt_acl, Opt_noacl, Opt_locallease, - Opt_sign, Opt_ignore_signature, Opt_seal, Opt_noac, - Opt_fsc, Opt_mfsymlinks, - Opt_multiuser, Opt_sloppy, Opt_nosharesock, - Opt_persistent, Opt_nopersistent, - Opt_resilient, Opt_noresilient, - Opt_domainauto, Opt_rdma, Opt_modesid, Opt_rootfs, - Opt_multichannel, Opt_nomultichannel, - Opt_compress, - -/* Mount options which take numeric value */ - Opt_backupuid, Opt_backupgid, Opt_uid, - Opt_cruid, Opt_gid, Opt_file_mode, - Opt_dirmode, Opt_port, - Opt_min_enc_offload, - Opt_blocksize, Opt_rsize, Opt_wsize, Opt_actimeo, - Opt_echo_interval, Opt_max_credits, Opt_handletimeout, - Opt_snapshot, Opt_max_channels, - -/* Mount options which take string value */ - Opt_user, Opt_pass, Opt_ip, - Opt_domain, Opt_srcaddr, Opt_iocharset, - Opt_netbiosname, Opt_servern, - Opt_ver, Opt_vers, Opt_sec, Opt_cache, - -/* Mount options to be ignored */ - Opt_ignore, - -/* Options which could be blank */ - Opt_blank_pass, - Opt_blank_user, - Opt_blank_ip, - - Opt_err -}; -static const match_table_t cifs_mount_option_tokens = { { Opt_user_xattr,"user_xattr" },
fs/cifs/fs_context.h +97 -0
103 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH 4/21 cifs: move cifs_parse_devname to fs_context.c
In reply to a message not in the archive--- fs/cifs/cifsproto.h | 1 + fs/cifs/connect.c | 59 ++-------------------------------------------------- fs/cifs/fs_context.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 57 deletions(-)
fs/cifs/cifsproto.h +1 -0
@@ -89,6 +89,7 @@ extern void cifs_mid_q_entry_release(struct mid_q_entry *midEntry);extern void cifs_wake_up_task (struct mid_q_entry *mid);extern int cifs_handle_standard (struct TCP_Server_Info *server,struct mid_q_entry *mid); +extern int smb3_parse_devname (const char *devname,struct smb3_fs_context *ctx);extern bool cifs_match_ipaddr (struct sockaddr *srcaddr,struct sockaddr *rhs);extern int cifs_discard_remaining_data (struct TCP_Server_Info *server); extern int cifs_call_async(struct TCP_Server_Info *server,
fs/cifs/connect.c +2 -57
77 lines not on this page · raw message
fs/cifs/fs_context.c +56 -0
59 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH 5/21 cifs: switch to new mount api
In reply to a message not in the archive--- fs/cifs/cifs_dfs_ref.c | 4 + fs/cifs/cifsencrypt.c | 5 + fs/cifs/cifsfs.c | 54 +-- fs/cifs/cifsfs.h | 4 + fs/cifs/cifsproto.h | 5 +- fs/cifs/connect.c | 1154 +----------------------------------------------- fs/cifs/dfs_cache.c | 8 +- fs/cifs/fs_context.c | 1067 ++++++++++++++++++++++++++++++++++++++++---- fs/cifs/fs_context.h | 75 ++-- fs/cifs/sess.c | 2 +- 10 files changed, 1095 insertions(+), 1283 deletions(-)
fs/cifs/cifs_dfs_ref.c +4 -0
@@ -275,6 +275,10 @@ static struct vfsmount *cifs_dfs_do_mount(struct dentry *mntpt,convert_delimiter (devname,'/' ); +/* TODO: change to call fs_context_for_mount(), fill in context directly, call fc_mount */ + +/* See afs_mntpt_do_automount in fs/afs/mntpt.c for an example */ +/* strip first '\' from fullpath */ mountdata =cifs_compose_mount_options (cifs_sb->mountdata, fullpath +1 ,NULL ,NULL );
fs/cifs/cifsencrypt.c +5 -0
@@ -661,6 +661,11 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)unsigned char *tiblob =NULL ;/* target info blob */ __le64 rsp_timestamp; +if (nls_cp ==NULL ) { +cifs_dbg (VFS ,"setup_ntlmv2_rsp called with nls_cp==NULL\n" ); +return -EINVAL ; + } +if (ses->server->negflavor ==CIFS_NEGFLAVOR_EXTENDED ) {if (!ses->domainName) {if (ses->domainAuto) {
fs/cifs/cifsfs.c +23 -31
105 lines not on this page · raw message
fs/cifs/cifsfs.h +4 -0
@@ -152,6 +152,10 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);extern void cifs_setsize (struct inode *inode,loff_t offset);extern int cifs_truncate_page (struct address_space *mapping,loff_t from); +struct smb3_fs_context ; +extern struct dentry *cifs_smb3_do_mount (struct file_system_type *fs_type, +int flags,struct smb3_fs_context *ctx); +#ifdef CONFIG_CIFS_NFSD_EXPORT extern const struct export_operations cifs_export_ops;#endif /* CONFIG_CIFS_NFSD_EXPORT */
fs/cifs/cifsproto.h +1 -4
@@ -239,8 +239,6 @@ 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 struct smb3_fs_context *cifs_get_volume_info (char *mount_data, -const char *devname,bool is_smb3);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);
@@ -554,8 +552,7 @@ extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8, unsigned char *p24);extern int -cifs_setup_volume_info (struct smb3_fs_context *ctx,char *mount_data, -const char *devname,bool is_smb3); +cifs_setup_volume_info (struct smb3_fs_context *ctx);extern void cifs_cleanup_volume_info_contents (struct smb3_fs_context *ctx);
fs/cifs/connect.c +20 -1134
1,212 lines not on this page · raw message
fs/cifs/dfs_cache.c +4 -4
@@ -18,9 +18,9 @@#include "cifs_debug.h" #include "cifs_unicode.h" #include "smb2glob.h" +#include "fs_context.h" #include "dfs_cache.h" -#include "fs_context.h" #define CACHE_HTABLE_SIZE 32#define CACHE_MAX_ENTRIES 64
@@ -1142,14 +1142,14 @@ int dfs_cache_get_tgt_referral(const char *path, }/** -* dfs_cache_add_vol - add a cifs volume during mount() that will be handled by +* dfs_cache_add_vol - add a cifs context during mount() that will be handled by * DFS cache refresh worker. * * @mntdata: mount data. * @ctx: cifs context. * @fullpath: origin full path. * -* Return zero if volume was set up correctly, otherwise non-zero. +* Return zero if context was set up correctly, otherwise non-zero. */ int dfs_cache_add_vol (char *mntdata,struct smb3_fs_context *ctx,const char *fullpath) {
@@ -1453,7 +1453,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi, goto out; } - rc =cifs_setup_volume_info (&ctx, mdata, devname, false); + rc =cifs_setup_volume_info (&ctx);kfree (devname);if (rc) {
fs/cifs/fs_context.c +991 -76
1,130 lines not on this page · raw message
fs/cifs/fs_context.h +42 -33
135 lines not on this page · raw message
fs/cifs/sess.c +1 -1
@@ -195,7 +195,7 @@ cifs_ses_add_channel(struct cifs_ses *ses, struct cifs_server_iface *iface)* We need to setup at least the fields used for negprot and * sesssetup. * -* We only need the volume here, so we can reuse memory from +* We only need the ctx here, so we can reuse memory from * the session and server without caring about memory * management. */
Signature · 1 line
2.13.6
PATCH 6/21 cifs: remove the devname argument to cifs_compose_mount_options
In reply to a message not in the archivenone of the callers use this argument any more.
--- fs/cifs/cifs_dfs_ref.c | 11 +++-------- fs/cifs/cifsproto.h | 3 +-- fs/cifs/connect.c | 11 +++-------- fs/cifs/dfs_cache.c | 6 ++---- 4 files changed, 9 insertions(+), 22 deletions(-)
fs/cifs/cifs_dfs_ref.c +3 -8
@@ -124,7 +124,6 @@ cifs_build_devname(char *nodename, const char *prepath)* @sb_mountdata: parent/root DFS mount options (template) * @fullpath: full path in UNC format * @ref: optional server's referral -* @devname: optional pointer for saving device name * * creates mount options for submount based on template options sb_mountdata * and replacing unc,ip,prefixpath options with ones we've got form ref_unc.
@@ -134,8 +133,7 @@ cifs_build_devname(char *nodename, const char *prepath)*/ char *cifs_compose_mount_options (const char *sb_mountdata,const char *fullpath, -const struct dfs_info3_param *ref, -char **devname) +const struct dfs_info3_param *ref) {int rc;char *name;
@@ -232,10 +230,7 @@ char *cifs_compose_mount_options(const char *sb_mountdata,strcat (mountdata,"ip=" );strcat (mountdata, srvIP); -if (devname) - *devname = name; -else -kfree (name); +kfree (name);/*cifs_dbg(FYI, "%s: parent mountdata: %s\n", __func__, sb_mountdata);*/ /*cifs_dbg(FYI, "%s: submount mountdata: %s\n", __func__, mountdata );*/
@@ -281,7 +276,7 @@ static struct vfsmount *cifs_dfs_do_mount(struct dentry *mntpt,/* strip first '\' from fullpath */ mountdata =cifs_compose_mount_options (cifs_sb->mountdata, - fullpath +1 ,NULL ,NULL ); + fullpath +1 ,NULL );if (IS_ERR (mountdata)) {kfree (devname);return (struct vfsmount *)mountdata;
fs/cifs/cifsproto.h +1 -2
@@ -78,8 +78,7 @@ extern char *cifs_build_path_to_root(struct smb3_fs_context *ctx, int add_treename);extern char *build_wildcard_path_from_dentry (struct dentry *direntry);extern char *cifs_compose_mount_options (const char *sb_mountdata, -const char *fullpath,const struct dfs_info3_param *ref, -char **devname); +const char *fullpath,const struct dfs_info3_param *ref);/* extern void renew_parental_timestamps(struct dentry *direntry);*/ extern struct mid_q_entry *AllocMidQEntry (const struct smb_hdr *smb_buffer,struct TCP_Server_Info *server);
fs/cifs/connect.c +3 -8
@@ -3019,11 +3019,8 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, rc =dfs_cache_find (xid, ses, cifs_sb->local_nls,cifs_remap (cifs_sb), ref_path, &referral,NULL );if (!rc) { -char *fake_devname =NULL ; - mdata =cifs_compose_mount_options (cifs_sb->mountdata, - full_path +1 , &referral, - &fake_devname); + full_path +1 , &referral);free_dfs_info_param (&referral);if (IS_ERR (mdata)) {
@@ -3033,7 +3030,6 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,cifs_cleanup_volume_info_contents (ctx); rc =cifs_setup_volume_info (ctx); } -kfree (fake_devname);kfree (cifs_sb->mountdata); cifs_sb->mountdata = mdata; }
@@ -3085,7 +3081,7 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path, {int rc;struct dfs_info3_param ref = {0 }; -char *mdata =NULL , *fake_devname =NULL ; +char *mdata =NULL ;struct smb3_fs_context fake_ctx = {NULL };cifs_dbg (FYI ,"%s: dfs path: %s\n" , __func__, path);
@@ -3094,7 +3090,7 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path,if (rc)return rc; - mdata =cifs_compose_mount_options (cifs_sb->mountdata, full_path +1 , &ref, &fake_devname); + mdata =cifs_compose_mount_options (cifs_sb->mountdata, full_path +1 , &ref);free_dfs_info_param (&ref);if (IS_ERR (mdata)) {
@@ -3104,7 +3100,6 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path, rc =cifs_setup_volume_info (&fake_ctx); }kfree (mdata); -kfree (fake_devname);if (!rc) {/*
fs/cifs/dfs_cache.c +2 -4
@@ -1416,7 +1416,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi,int rc;struct cache_entry *ce;struct dfs_info3_param ref = {0 }; -char *mdata =NULL , *devname =NULL ; +char *mdata =NULL ;struct TCP_Server_Info *server;struct cifs_ses *ses;struct smb3_fs_context ctx = {NULL };
@@ -1443,8 +1443,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi,up_read (&htable_rw_lock); - mdata =cifs_compose_mount_options (vi->mntdata, rpath, &ref, - &devname); + mdata =cifs_compose_mount_options (vi->mntdata, rpath, &ref);free_dfs_info_param (&ref);if (IS_ERR (mdata)) {
@@ -1454,7 +1453,6 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi, } rc =cifs_setup_volume_info (&ctx); -kfree (devname);if (rc) { ses =ERR_PTR (rc);
Signature · 1 line
2.13.6
PATCH 7/21 cifs: add an smb3_fs_context to cifs_sb
In reply to a message not in the archiveand populate it during mount in cifs_smb3_do_mount()
--- fs/cifs/cifs_fs_sb.h | 1 + fs/cifs/cifsfs.c | 60 +++++++++++++++++++++++++--------------------------- fs/cifs/connect.c | 13 +++++++++--- 3 files changed, 40 insertions(+), 34 deletions(-)
fs/cifs/cifs_fs_sb.h +1 -0
@@ -61,6 +61,7 @@ struct cifs_sb_info {spinlock_t tlink_tree_lock;struct tcon_link *master_tlink;struct nls_table *local_nls; +struct smb3_fs_context *ctx;unsigned int bsize;unsigned int rsize;unsigned int wsize;
fs/cifs/cifsfs.c +29 -31
112 lines not on this page · raw message
fs/cifs/connect.c +10 -3
@@ -2786,6 +2786,9 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx,void cifs_cleanup_volume_info_contents (struct smb3_fs_context *ctx) { +if (ctx ==NULL ) +return ; +/* * Make sure this stays in sync with smb3_fs_context_dup() */
@@ -2805,6 +2808,9 @@ cifs_cleanup_volume_info_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
@@ -3725,9 +3731,10 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,static void delayed_free (struct rcu_head *p) { - struct cifs_sb_info *sbi = container_of(p, struct cifs_sb_info, rcu); -unload_nls (sbi->local_nls); -kfree (sbi); + struct cifs_sb_info *cifs_sb = container_of(p, struct cifs_sb_info, rcu); +unload_nls (cifs_sb->local_nls); +cifs_cleanup_volume_info (cifs_sb->ctx); +kfree (cifs_sb); }void
Signature · 1 line
2.13.6
PATCH 8/21 cifs: get rid of cifs_sb->mountdata
In reply to a message not in the archiveas we now have a full smb3_fs_context as part of the cifs superblock we no longer need a local copy of the mount options and can just reference the copy in the smb3_fs_context.
--- fs/cifs/cifs_dfs_ref.c | 3 ++- fs/cifs/cifs_fs_sb.h | 1 - fs/cifs/cifsfs.c | 7 ------- fs/cifs/connect.c | 19 ++++++++++--------- 4 files changed, 12 insertions(+), 18 deletions(-)
fs/cifs/cifs_dfs_ref.c +2 -1
@@ -23,6 +23,7 @@#include "cifs_debug.h" #include "cifs_unicode.h" #include "dfs_cache.h" +#include "fs_context.h" static LIST_HEAD (cifs_dfs_automount_list);
@@ -275,7 +276,7 @@ static struct vfsmount *cifs_dfs_do_mount(struct dentry *mntpt,/* See afs_mntpt_do_automount in fs/afs/mntpt.c for an example */ /* strip first '\' from fullpath */ - mountdata =cifs_compose_mount_options (cifs_sb->mountdata, + mountdata =cifs_compose_mount_options (cifs_sb->ctx->mount_options, fullpath +1 ,NULL );if (IS_ERR (mountdata)) {kfree (devname);
fs/cifs/cifs_fs_sb.h +0 -1
@@ -74,7 +74,6 @@ struct cifs_sb_info {umode_t mnt_file_mode;umode_t mnt_dir_mode;unsigned int mnt_cifs_flags; -char *mountdata;/* options received at mount time or via DFS refs */ struct delayed_work prune_tlinks;struct rcu_head rcu;
fs/cifs/cifsfs.c +0 -7
@@ -812,12 +812,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, goto out; } - cifs_sb->mountdata =kstrndup (cifs_sb->ctx->mount_options,PAGE_SIZE ,GFP_KERNEL ); -if (cifs_sb->mountdata ==NULL ) { - root =ERR_PTR (-ENOMEM ); - goto out; - } - rc =cifs_setup_cifs_sb (cifs_sb->ctx, cifs_sb);if (rc) { root =ERR_PTR (rc);
@@ -872,7 +866,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, out:if (cifs_sb) {kfree (cifs_sb->prepath); -kfree (cifs_sb->mountdata);cifs_cleanup_volume_info (cifs_sb->ctx);kfree (cifs_sb); }
fs/cifs/connect.c +10 -9
@@ -2999,7 +2999,7 @@ build_unc_path_to_root(const struct smb3_fs_context *ctx,* expand_dfs_referral - Perform a dfs referral query and update the cifs_sb * * -* If a referral is found, cifs_sb->mountdata will be (re-)allocated +* If a referral is found, cifs_sb->ctx->mount_options will be (re-)allocated * to a string containing updated options for the submount. Otherwise it * will be left untouched. *
@@ -3025,7 +3025,7 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, rc =dfs_cache_find (xid, ses, cifs_sb->local_nls,cifs_remap (cifs_sb), ref_path, &referral,NULL );if (!rc) { - mdata =cifs_compose_mount_options (cifs_sb->mountdata, + mdata =cifs_compose_mount_options (cifs_sb->ctx->mount_options, full_path +1 , &referral);free_dfs_info_param (&referral);
@@ -3036,8 +3036,8 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,cifs_cleanup_volume_info_contents (ctx); rc =cifs_setup_volume_info (ctx); } -kfree (cifs_sb->mountdata); - cifs_sb->mountdata = mdata; +kfree (cifs_sb->ctx->mount_options); + cifs_sb->ctx->mount_options = mdata; }kfree (full_path);return rc;
@@ -3096,7 +3096,8 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path,if (rc)return rc; - mdata =cifs_compose_mount_options (cifs_sb->mountdata, full_path +1 , &ref); + mdata =cifs_compose_mount_options (cifs_sb->ctx->mount_options, + full_path +1 , &ref);free_dfs_info_param (&ref);if (IS_ERR (mdata)) {
@@ -3424,7 +3425,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) goto error; }/* Save mount options */ - mntdata =kstrndup (cifs_sb->mountdata,strlen (cifs_sb->mountdata),GFP_KERNEL ); + mntdata =kstrndup (cifs_sb->ctx->mount_options, +strlen (cifs_sb->ctx->mount_options),GFP_KERNEL );if (!mntdata) { rc = -ENOMEM ; goto error;
@@ -3448,12 +3450,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)break ; }/* Chase referral */ - oldmnt = cifs_sb->mountdata; + oldmnt = cifs_sb->ctx->mount_options; rc =expand_dfs_referral (xid, root_ses, ctx, cifs_sb, ref_path +1 );if (rc)break ;/* Connect to new DFS target only if we were redirected */ -if (oldmnt != cifs_sb->mountdata) { +if (oldmnt != cifs_sb->ctx->mount_options) {mount_put_conns (cifs_sb, xid, server, ses, tcon); rc =mount_get_conns (ctx, cifs_sb, &xid, &server, &ses, &tcon); }
@@ -3759,7 +3761,6 @@ cifs_umount(struct cifs_sb_info *cifs_sb) }spin_unlock (&cifs_sb->tlink_tree_lock); -kfree (cifs_sb->mountdata);kfree (cifs_sb->prepath);#ifdef CONFIG_CIFS_DFS_UPCALL dfs_cache_del_vol (cifs_sb->origin_fullpath);
Signature · 1 line
2.13.6
PATCH 9/21 cifs: remove [gu]id/backup[gu]id/file_mode/dir_mode from cifs_sb
In reply to a message not in the archiveWe can already access these from cifs_sb->ctx so we no longer need a local copy in cifs_sb.
--- fs/cifs/cifs_fs_sb.h | 6 ------ fs/cifs/cifsacl.c | 7 ++++--- fs/cifs/cifsfs.c | 12 ++++++------ fs/cifs/connect.c | 15 +++++---------- fs/cifs/file.c | 5 +++-- fs/cifs/inode.c | 29 +++++++++++++++-------------- fs/cifs/misc.c | 5 +++-- fs/cifs/readdir.c | 9 +++++---- 8 files changed, 41 insertions(+), 47 deletions(-)
fs/cifs/cifs_fs_sb.h +0 -6
@@ -67,12 +67,6 @@ struct cifs_sb_info {unsigned int wsize;unsigned long actimeo;/* attribute cache timeout (jiffies) */ atomic_t active; -kuid_t mnt_uid; -kgid_t mnt_gid; -kuid_t mnt_backupuid; -kgid_t mnt_backupgid; -umode_t mnt_file_mode; -umode_t mnt_dir_mode;unsigned int mnt_cifs_flags;struct delayed_work prune_tlinks;struct rcu_head rcu;
fs/cifs/cifsacl.c +4 -3
@@ -32,6 +32,7 @@#include "cifsacl.h" #include "cifsproto.h" #include "cifs_debug.h" +#include "fs_context.h" /* security id for everyone/world system group */ static const struct cifs_sid sid_everyone = {
@@ -346,8 +347,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,struct key *sidkey;char *sidstr;const struct cred *saved_cred; -kuid_t fuid = cifs_sb->mnt_uid; -kgid_t fgid = cifs_sb->mnt_gid; +kuid_t fuid = cifs_sb->ctx->linux_uid; +kgid_t fgid = cifs_sb->ctx->linux_gid;/* * If we have too many subauthorities, then something is really wrong.
@@ -448,7 +449,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,/* * Note that we return 0 here unconditionally. If the mapping -* fails then we just fall back to using the mnt_uid/mnt_gid. +* fails then we just fall back to using the ctx->linux_uid/linux_gid. */ got_valid_id: rc =0 ;
fs/cifs/cifsfs.c +6 -6
@@ -515,14 +515,14 @@ cifs_show_options(struct seq_file *s, struct dentry *root) }seq_printf (s,",uid=%u" , -from_kuid_munged (&init_user_ns, cifs_sb->mnt_uid)); +from_kuid_munged (&init_user_ns, cifs_sb->ctx->linux_uid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_UID )seq_puts (s,",forceuid" );else seq_puts (s,",noforceuid" );seq_printf (s,",gid=%u" , -from_kgid_munged (&init_user_ns, cifs_sb->mnt_gid)); +from_kgid_munged (&init_user_ns, cifs_sb->ctx->linux_gid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_GID )seq_puts (s,",forcegid" );else
@@ -532,8 +532,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (!tcon->unix_ext)seq_printf (s,",file_mode=0%ho,dir_mode=0%ho" , - cifs_sb->mnt_file_mode, - cifs_sb->mnt_dir_mode); + cifs_sb->ctx->file_mode, + cifs_sb->ctx->dir_mode);cifs_show_nls (s, cifs_sb->local_nls);
@@ -606,11 +606,11 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPUID )seq_printf (s,",backupuid=%u" ,from_kuid_munged (&init_user_ns, - cifs_sb->mnt_backupuid)); + cifs_sb->ctx->backupuid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPGID )seq_printf (s,",backupgid=%u" ,from_kgid_munged (&init_user_ns, - cifs_sb->mnt_backupgid)); + cifs_sb->ctx->backupgid));seq_printf (s,",rsize=%u" , cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize);
fs/cifs/connect.c +5 -10
@@ -2225,11 +2225,12 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)if (new->rsize && new->rsize < old->rsize)return 0 ; -if (!uid_eq (old->mnt_uid, new->mnt_uid) || !gid_eq (old->mnt_gid, new->mnt_gid)) +if (!uid_eq (old->ctx->linux_uid, new->ctx->linux_uid) || + !gid_eq (old->ctx->linux_gid, new->ctx->linux_gid))return 0 ; -if (old->mnt_file_mode != new->mnt_file_mode || - old->mnt_dir_mode != new->mnt_dir_mode) +if (old->ctx->file_mode != new->ctx->file_mode || + old->ctx->dir_mode != new->ctx->dir_mode)return 0 ;if (strcmp (old->local_nls->charset, new->local_nls->charset))
@@ -2678,12 +2679,8 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, cifs_sb->rsize = ctx->rsize; cifs_sb->wsize = ctx->wsize; - cifs_sb->mnt_uid = ctx->linux_uid; - cifs_sb->mnt_gid = ctx->linux_gid; - cifs_sb->mnt_file_mode = ctx->file_mode; - cifs_sb->mnt_dir_mode = ctx->dir_mode;cifs_dbg (FYI ,"file mode: %04ho dir mode: %04ho\n" , - cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); + cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); cifs_sb->actimeo = ctx->actimeo; cifs_sb->local_nls = ctx->local_nls;
@@ -2722,11 +2719,9 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_ACL ;if (ctx->backupuid_specified) { cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPUID ; - cifs_sb->mnt_backupuid = ctx->backupuid; }if (ctx->backupgid_specified) { cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPGID ; - cifs_sb->mnt_backupgid = ctx->backupgid; }if (ctx->override_uid) cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_OVERR_UID ;
fs/cifs/file.c +3 -2
@@ -44,6 +44,7 @@#include "cifs_fs_sb.h" #include "fscache.h" #include "smbdirect.h" +#include "fs_context.h" static inline int cifs_convert_flags (unsigned int flags) {
@@ -566,7 +567,7 @@ int cifs_open(struct inode *inode, struct file *file) le64_to_cpu(tcon->fsUnixInfo.Capability))) {/* can not refresh inode info since size could be stale */ rc =cifs_posix_open (full_path, &inode, inode->i_sb, - cifs_sb->mnt_file_mode/* ignored */ , + cifs_sb->ctx->file_mode/* ignored */ , file->f_flags, &oplock, &fid.netfid, xid);if (rc ==0 ) {cifs_dbg (FYI ,"posix open succeeded\n" );
@@ -735,7 +736,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ~(O_CREAT |O_EXCL |O_TRUNC ); rc =cifs_posix_open (full_path,NULL , inode->i_sb, - cifs_sb->mnt_file_mode/* ignored */ , + cifs_sb->ctx->file_mode/* ignored */ , oflags, &oplock, &cfile->fid.netfid, xid);if (rc ==0 ) {cifs_dbg (FYI ,"posix reopen succeeded\n" );
fs/cifs/inode.c +15 -14
@@ -37,6 +37,7 @@#include "cifs_fs_sb.h" #include "cifs_unicode.h" #include "fscache.h" +#include "fs_context.h" static void cifs_set_ops (struct inode *inode)
@@ -294,7 +295,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,break ; } - fattr->cf_uid = cifs_sb->mnt_uid; + fattr->cf_uid = cifs_sb->ctx->linux_uid;if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_UID )) {u64 id =le64_to_cpu (info->Uid);if (id < ((uid_t)-1 )) {
@@ -304,7 +305,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info, } } - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_GID )) {u64 id =le64_to_cpu (info->Gid);if (id < ((gid_t)-1 )) {
@@ -333,8 +334,8 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)memset (fattr,0 ,sizeof (*fattr)); fattr->cf_mode =S_IFDIR |S_IXUGO |S_IRWXU ; - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;ktime_get_coarse_real_ts64 (&fattr->cf_mtime); fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime; fattr->cf_nlink =2 ;
@@ -644,8 +645,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo * }/* else if reparse point ... TODO: add support for FIFO and blk dev; special file types */ - fattr->cf_uid = cifs_sb->mnt_uid;/* TODO: map uid and gid from SID */ - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid;/* TODO: map uid and gid from SID */ + fattr->cf_gid = cifs_sb->ctx->linux_gid;cifs_dbg (FYI ,"POSIX query info: mode 0x%x uniqueid 0x%llx nlink %d\n" , fattr->cf_mode, fattr->cf_uniqueid, fattr->cf_nlink);
@@ -689,7 +690,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_mode =S_IFLNK ; fattr->cf_dtype =DT_LNK ; }else if (fattr->cf_cifsattrs &ATTR_DIRECTORY ) { - fattr->cf_mode =S_IFDIR | cifs_sb->mnt_dir_mode; + fattr->cf_mode =S_IFDIR | cifs_sb->ctx->dir_mode; fattr->cf_dtype =DT_DIR ;/* * Server can return wrong NumberOfLinks value for directories
@@ -698,7 +699,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,if (!tcon->unix_ext) fattr->cf_flags |=CIFS_FATTR_UNKNOWN_NLINK ; }else { - fattr->cf_mode =S_IFREG | cifs_sb->mnt_file_mode; + fattr->cf_mode =S_IFREG | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_REG ;/* clear write bits if ATTR_READONLY is set */
@@ -717,8 +718,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, } } - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid; } static int
@@ -1358,8 +1359,8 @@ struct inode *cifs_root_iget(struct super_block *sb)set_nlink (inode,2 ); inode->i_op = &cifs_ipc_inode_ops; inode->i_fop = &simple_dir_operations; - inode->i_uid = cifs_sb->mnt_uid; - inode->i_gid = cifs_sb->mnt_gid; + inode->i_uid = cifs_sb->ctx->linux_uid; + inode->i_gid = cifs_sb->ctx->linux_gid;spin_unlock (&inode->i_lock); }else if (rc) {iget_failed (inode);
@@ -2834,10 +2835,10 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) attrs->ia_mode &= ~(S_IALLUGO );if (S_ISDIR (inode->i_mode)) attrs->ia_mode |= - cifs_sb->mnt_dir_mode; + cifs_sb->ctx->dir_mode;else attrs->ia_mode |= - cifs_sb->mnt_file_mode; + cifs_sb->ctx->file_mode; } }else if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_DYNPERM )) {/* ignore mode change - ATTR_READONLY hasn't changed */
fs/cifs/misc.c +3 -2
@@ -35,6 +35,7 @@#ifdef CONFIG_CIFS_DFS_UPCALL #include "dns_resolve.h" #endif +#include "fs_context.h" extern mempool_t *cifs_sm_req_poolp;extern mempool_t *cifs_req_poolp;
@@ -632,11 +633,11 @@ bool backup_cred(struct cifs_sb_info *cifs_sb) {if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPUID ) { -if (uid_eq (cifs_sb->mnt_backupuid,current_fsuid ())) +if (uid_eq (cifs_sb->ctx->backupuid,current_fsuid ()))return true; }if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPGID ) { -if (in_group_p (cifs_sb->mnt_backupgid)) +if (in_group_p (cifs_sb->ctx->backupgid))return true; }
fs/cifs/readdir.c +5 -4
@@ -33,6 +33,7 @@#include "cifs_fs_sb.h" #include "cifsfs.h" #include "smb2proto.h" +#include "fs_context.h" /* * To be safe - for UCS to UTF-8 with strings loaded with the rare long
@@ -165,14 +166,14 @@ static bool reparse_file_needs_reval(const struct cifs_fattr *fattr)static void cifs_fill_common_info (struct cifs_fattr *fattr,struct cifs_sb_info *cifs_sb) { - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;if (fattr->cf_cifsattrs &ATTR_DIRECTORY ) { - fattr->cf_mode =S_IFDIR | cifs_sb->mnt_dir_mode; + fattr->cf_mode =S_IFDIR | cifs_sb->ctx->dir_mode; fattr->cf_dtype =DT_DIR ; }else { - fattr->cf_mode =S_IFREG | cifs_sb->mnt_file_mode; + fattr->cf_mode =S_IFREG | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_REG ; }
Signature · 1 line
2.13.6
Re: [PATCH 09/21] cifs: remove [gu]id/backup[gu]id/file_mode/dir_mode from cifs_sb
rebased patch on current for-next and tentatively merged into for-next
Quoted 352 lines · Ronnie Sahlberg
We can already access these from
cifs_sb->ctxso we no longer need a local copy incifs_sb.Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/cifs_fs_sb.h | 6 ------ fs/cifs/cifsacl.c | 7 ++++--- fs/cifs/cifsfs.c | 12 ++++++------ fs/cifs/connect.c | 15 +++++---------- fs/cifs/file.c | 5 +++-- fs/cifs/inode.c | 29 +++++++++++++++-------------- fs/cifs/misc.c | 5 +++-- fs/cifs/readdir.c | 9 +++++---- 8 files changed, 41 insertions(+), 47 deletions(-)fs/cifs/cifs_fs_sb.h +0
-6@@ -67,12 +67,6 @@ struct cifs_sb_info {unsigned int wsize;unsigned long actimeo;/* attribute cache timeout (jiffies) */ atomic_t active; -kuid_t mnt_uid; -kgid_t mnt_gid; -kuid_t mnt_backupuid; -kgid_t mnt_backupgid; -umode_t mnt_file_mode; -umode_t mnt_dir_mode;unsigned int mnt_cifs_flags;struct delayed_work prune_tlinks;struct rcu_head rcu;fs/cifs/cifsacl.c +4
-3@@ -32,6 +32,7 @@#include "cifsacl.h" #include "cifsproto.h" #include "cifs_debug.h" +#include "fs_context.h" /* security id for everyone/world system group */ static const struct cifs_sid sid_everyone = {@@ -346,8 +347,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,struct key *sidkey;char *sidstr;const struct cred *saved_cred; -kuid_t fuid = cifs_sb->mnt_uid; -kgid_t fgid = cifs_sb->mnt_gid; +kuid_t fuid = cifs_sb->ctx->linux_uid; +kgid_t fgid = cifs_sb->ctx->linux_gid;/* * If we have too many subauthorities, then something is really wrong. @@ -448,7 +449,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,/* * Note that we return 0 here unconditionally. If the mapping -* fails then we just fall back to using the mnt_uid/mnt_gid. +* fails then we just fall back to using the ctx->linux_uid/linux_gid. */ got_valid_id: rc =0 ;fs/cifs/cifsfs.c +6
-6@@ -515,14 +515,14 @@ cifs_show_options(struct seq_file *s, struct dentry *root) }seq_printf (s,",uid=%u" , -from_kuid_munged (&init_user_ns, cifs_sb->mnt_uid)); +from_kuid_munged (&init_user_ns, cifs_sb->ctx->linux_uid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_UID )seq_puts (s,",forceuid" );else seq_puts (s,",noforceuid" );seq_printf (s,",gid=%u" , -from_kgid_munged (&init_user_ns, cifs_sb->mnt_gid)); +from_kgid_munged (&init_user_ns, cifs_sb->ctx->linux_gid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_GID )seq_puts (s,",forcegid" );else @@ -532,8 +532,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (!tcon->unix_ext)seq_printf (s,",file_mode=0%ho,dir_mode=0%ho" , - cifs_sb->mnt_file_mode, - cifs_sb->mnt_dir_mode); + cifs_sb->ctx->file_mode, + cifs_sb->ctx->dir_mode);cifs_show_nls (s, cifs_sb->local_nls);@@ -606,11 +606,11 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPUID )seq_printf (s,",backupuid=%u" ,from_kuid_munged (&init_user_ns, - cifs_sb->mnt_backupuid)); + cifs_sb->ctx->backupuid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPGID )seq_printf (s,",backupgid=%u" ,from_kgid_munged (&init_user_ns, - cifs_sb->mnt_backupgid)); + cifs_sb->ctx->backupgid));seq_printf (s,",rsize=%u" , cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize);fs/cifs/connect.c +5
-10@@ -2225,11 +2225,12 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)if (new->rsize && new->rsize < old->rsize)return 0 ; -if (!uid_eq (old->mnt_uid, new->mnt_uid) || !gid_eq (old->mnt_gid, new->mnt_gid)) +if (!uid_eq (old->ctx->linux_uid, new->ctx->linux_uid) || + !gid_eq (old->ctx->linux_gid, new->ctx->linux_gid))return 0 ; -if (old->mnt_file_mode != new->mnt_file_mode || - old->mnt_dir_mode != new->mnt_dir_mode) +if (old->ctx->file_mode != new->ctx->file_mode || + old->ctx->dir_mode != new->ctx->dir_mode)return 0 ;if (strcmp (old->local_nls->charset, new->local_nls->charset))@@ -2678,12 +2679,8 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, cifs_sb->rsize = ctx->rsize; cifs_sb->wsize = ctx->wsize; - cifs_sb->mnt_uid = ctx->linux_uid; - cifs_sb->mnt_gid = ctx->linux_gid; - cifs_sb->mnt_file_mode = ctx->file_mode; - cifs_sb->mnt_dir_mode = ctx->dir_mode;cifs_dbg (FYI ,"file mode: %04ho dir mode: %04ho\n" , - cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); + cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); cifs_sb->actimeo = ctx->actimeo; cifs_sb->local_nls = ctx->local_nls;@@ -2722,11 +2719,9 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_ACL ;if (ctx->backupuid_specified) { cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPUID ; - cifs_sb->mnt_backupuid = ctx->backupuid; }if (ctx->backupgid_specified) { cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPGID ; - cifs_sb->mnt_backupgid = ctx->backupgid; }if (ctx->override_uid) cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_OVERR_UID ;fs/cifs/file.c +3
-2@@ -44,6 +44,7 @@#include "cifs_fs_sb.h" #include "fscache.h" #include "smbdirect.h" +#include "fs_context.h" static inline int cifs_convert_flags (unsigned int flags) {@@ -566,7 +567,7 @@ int cifs_open(struct inode *inode, struct file *file) le64_to_cpu(tcon->fsUnixInfo.Capability))) {/* can not refresh inode info since size could be stale */ rc =cifs_posix_open (full_path, &inode, inode->i_sb, - cifs_sb->mnt_file_mode/* ignored */ , + cifs_sb->ctx->file_mode/* ignored */ , file->f_flags, &oplock, &fid.netfid, xid);if (rc ==0 ) {cifs_dbg (FYI ,"posix open succeeded\n" );@@ -735,7 +736,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ~(O_CREAT |O_EXCL |O_TRUNC ); rc =cifs_posix_open (full_path,NULL , inode->i_sb, - cifs_sb->mnt_file_mode/* ignored */ , + cifs_sb->ctx->file_mode/* ignored */ , oflags, &oplock, &cfile->fid.netfid, xid);if (rc ==0 ) {cifs_dbg (FYI ,"posix reopen succeeded\n" );fs/cifs/inode.c +15
-14@@ -37,6 +37,7 @@#include "cifs_fs_sb.h" #include "cifs_unicode.h" #include "fscache.h" +#include "fs_context.h" static void cifs_set_ops (struct inode *inode)@@ -294,7 +295,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,break ; } - fattr->cf_uid = cifs_sb->mnt_uid; + fattr->cf_uid = cifs_sb->ctx->linux_uid;if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_UID )) {u64 id =le64_to_cpu (info->Uid);if (id < ((uid_t)-1 )) {@@ -304,7 +305,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info, } } - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_GID )) {u64 id =le64_to_cpu (info->Gid);if (id < ((gid_t)-1 )) {@@ -333,8 +334,8 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)memset (fattr,0 ,sizeof (*fattr)); fattr->cf_mode =S_IFDIR |S_IXUGO |S_IRWXU ; - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;ktime_get_coarse_real_ts64 (&fattr->cf_mtime); fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime; fattr->cf_nlink =2 ;@@ -644,8 +645,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo * }/* else if reparse point ... TODO: add support for FIFO and blk dev; special file types */ - fattr->cf_uid = cifs_sb->mnt_uid;/* TODO: map uid and gid from SID */ - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid;/* TODO: map uid and gid from SID */ + fattr->cf_gid = cifs_sb->ctx->linux_gid;cifs_dbg (FYI ,"POSIX query info: mode 0x%x uniqueid 0x%llx nlink %d\n" , fattr->cf_mode, fattr->cf_uniqueid, fattr->cf_nlink);@@ -689,7 +690,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_mode =S_IFLNK ; fattr->cf_dtype =DT_LNK ; }else if (fattr->cf_cifsattrs &ATTR_DIRECTORY ) { - fattr->cf_mode =S_IFDIR | cifs_sb->mnt_dir_mode; + fattr->cf_mode =S_IFDIR | cifs_sb->ctx->dir_mode; fattr->cf_dtype =DT_DIR ;/* * Server can return wrong NumberOfLinks value for directories @@ -698,7 +699,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,if (!tcon->unix_ext) fattr->cf_flags |=CIFS_FATTR_UNKNOWN_NLINK ; }else { - fattr->cf_mode =S_IFREG | cifs_sb->mnt_file_mode; + fattr->cf_mode =S_IFREG | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_REG ;/* clear write bits if ATTR_READONLY is set */ @@ -717,8 +718,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, } } - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid; } static int@@ -1358,8 +1359,8 @@ struct inode *cifs_root_iget(struct super_block *sb)set_nlink (inode,2 ); inode->i_op = &cifs_ipc_inode_ops; inode->i_fop = &simple_dir_operations; - inode->i_uid = cifs_sb->mnt_uid; - inode->i_gid = cifs_sb->mnt_gid; + inode->i_uid = cifs_sb->ctx->linux_uid; + inode->i_gid = cifs_sb->ctx->linux_gid;spin_unlock (&inode->i_lock); }else if (rc) {iget_failed (inode);@@ -2834,10 +2835,10 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) attrs->ia_mode &= ~(S_IALLUGO );if (S_ISDIR (inode->i_mode)) attrs->ia_mode |= - cifs_sb->mnt_dir_mode; + cifs_sb->ctx->dir_mode;else attrs->ia_mode |= - cifs_sb->mnt_file_mode; + cifs_sb->ctx->file_mode; } }else if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_DYNPERM )) {/* ignore mode change - ATTR_READONLY hasn't changed */ fs/cifs/misc.c +3
-2@@ -35,6 +35,7 @@#ifdef CONFIG_CIFS_DFS_UPCALL #include "dns_resolve.h" #endif +#include "fs_context.h" extern mempool_t *cifs_sm_req_poolp;extern mempool_t *cifs_req_poolp;@@ -632,11 +633,11 @@ bool backup_cred(struct cifs_sb_info *cifs_sb) {if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPUID ) { -if (uid_eq (cifs_sb->mnt_backupuid,current_fsuid ())) +if (uid_eq (cifs_sb->ctx->backupuid,current_fsuid ()))return true; }if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPGID ) { -if (in_group_p (cifs_sb->mnt_backupgid)) +if (in_group_p (cifs_sb->ctx->backupgid))return true; }fs/cifs/readdir.c +5
-5@@ -33,6 +33,7 @@#include "cifs_fs_sb.h" #include "cifsfs.h" #include "smb2proto.h" +#include "fs_context.h" /* * To be safe - for UCS to UTF-8 with strings loaded with the rare long @@ -165,14 +166,14 @@ static bool reparse_file_needs_reval(const struct cifs_fattr *fattr)static void cifs_fill_common_info (struct cifs_fattr *fattr,struct cifs_sb_info *cifs_sb) { - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;if (fattr->cf_cifsattrs &ATTR_DIRECTORY ) { - fattr->cf_mode =S_IFDIR | cifs_sb->mnt_dir_mode; + fattr->cf_mode =S_IFDIR | cifs_sb->ctx->dir_mode; fattr->cf_dtype =DT_DIR ; }else { - fattr->cf_mode =S_IFREG | cifs_sb->mnt_file_mode; + fattr->cf_mode =S_IFREG | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_REG ; } --2.13.6
Signature · 3 lines
Thanks, Steve
From 4afde6c74023ba38d18c9982421306e7f2d4921a Mon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <[email protected]>
Date: Sat, 12 Dec 2020 13:40:50 -0600
Subject: [PATCH] cifs: remove [gu]id/backup[gu]id/file_mode/dir_mode from
cifs_sb
We can already access these from cifs_sb->ctx so we no longer need a local copy in cifs_sb.
--- fs/cifs/cifs_fs_sb.h | 6 ------ fs/cifs/cifsacl.c | 7 ++++--- fs/cifs/cifsfs.c | 12 ++++++------ fs/cifs/connect.c | 15 +++++---------- fs/cifs/file.c | 5 +++-- fs/cifs/inode.c | 39 ++++++++++++++++++++------------------- fs/cifs/misc.c | 5 +++-- fs/cifs/readdir.c | 19 ++++++++++--------- 8 files changed, 51 insertions(+), 57 deletions(-)
fs/cifs/cifs_fs_sb.h +0 -6
@@ -67,12 +67,6 @@ struct cifs_sb_info {unsigned int wsize;unsigned long actimeo;/* attribute cache timeout (jiffies) */ atomic_t active; -kuid_t mnt_uid; -kgid_t mnt_gid; -kuid_t mnt_backupuid; -kgid_t mnt_backupgid; -umode_t mnt_file_mode; -umode_t mnt_dir_mode;unsigned int mnt_cifs_flags;struct delayed_work prune_tlinks;struct rcu_head rcu;
fs/cifs/cifsacl.c +4 -3
@@ -32,6 +32,7 @@#include "cifsacl.h" #include "cifsproto.h" #include "cifs_debug.h" +#include "fs_context.h" /* security id for everyone/world system group */ static const struct cifs_sid sid_everyone = {
@@ -346,8 +347,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,struct key *sidkey;char *sidstr;const struct cred *saved_cred; -kuid_t fuid = cifs_sb->mnt_uid; -kgid_t fgid = cifs_sb->mnt_gid; +kuid_t fuid = cifs_sb->ctx->linux_uid; +kgid_t fgid = cifs_sb->ctx->linux_gid;/* * If we have too many subauthorities, then something is really wrong.
@@ -448,7 +449,7 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,/* * Note that we return 0 here unconditionally. If the mapping -* fails then we just fall back to using the mnt_uid/mnt_gid. +* fails then we just fall back to using the ctx->linux_uid/linux_gid. */ got_valid_id: rc =0 ;
fs/cifs/cifsfs.c +6 -6
@@ -518,14 +518,14 @@ cifs_show_options(struct seq_file *s, struct dentry *root) }seq_printf (s,",uid=%u" , -from_kuid_munged (&init_user_ns, cifs_sb->mnt_uid)); +from_kuid_munged (&init_user_ns, cifs_sb->ctx->linux_uid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_UID )seq_puts (s,",forceuid" );else seq_puts (s,",noforceuid" );seq_printf (s,",gid=%u" , -from_kgid_munged (&init_user_ns, cifs_sb->mnt_gid)); +from_kgid_munged (&init_user_ns, cifs_sb->ctx->linux_gid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_GID )seq_puts (s,",forcegid" );else
@@ -535,8 +535,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (!tcon->unix_ext)seq_printf (s,",file_mode=0%ho,dir_mode=0%ho" , - cifs_sb->mnt_file_mode, - cifs_sb->mnt_dir_mode); + cifs_sb->ctx->file_mode, + cifs_sb->ctx->dir_mode);cifs_show_nls (s, cifs_sb->local_nls);
@@ -609,11 +609,11 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPUID )seq_printf (s,",backupuid=%u" ,from_kuid_munged (&init_user_ns, - cifs_sb->mnt_backupuid)); + cifs_sb->ctx->backupuid));if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPGID )seq_printf (s,",backupgid=%u" ,from_kgid_munged (&init_user_ns, - cifs_sb->mnt_backupgid)); + cifs_sb->ctx->backupgid));seq_printf (s,",rsize=%u" , cifs_sb->rsize);seq_printf (s,",wsize=%u" , cifs_sb->wsize);
fs/cifs/connect.c +5 -10
@@ -2240,11 +2240,12 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)if (new->rsize && new->rsize < old->rsize)return 0 ; -if (!uid_eq (old->mnt_uid, new->mnt_uid) || !gid_eq (old->mnt_gid, new->mnt_gid)) +if (!uid_eq (old->ctx->linux_uid, new->ctx->linux_uid) || + !gid_eq (old->ctx->linux_gid, new->ctx->linux_gid))return 0 ; -if (old->mnt_file_mode != new->mnt_file_mode || - old->mnt_dir_mode != new->mnt_dir_mode) +if (old->ctx->file_mode != new->ctx->file_mode || + old->ctx->dir_mode != new->ctx->dir_mode)return 0 ;if (strcmp (old->local_nls->charset, new->local_nls->charset))
@@ -2707,12 +2708,8 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, cifs_sb->rsize = ctx->rsize; cifs_sb->wsize = ctx->wsize; - cifs_sb->mnt_uid = ctx->linux_uid; - cifs_sb->mnt_gid = ctx->linux_gid; - cifs_sb->mnt_file_mode = ctx->file_mode; - cifs_sb->mnt_dir_mode = ctx->dir_mode;cifs_dbg (FYI ,"file mode: %04ho dir mode: %04ho\n" , - cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); + cifs_sb->ctx->file_mode, cifs_sb->ctx->dir_mode); cifs_sb->actimeo = ctx->actimeo; cifs_sb->local_nls = ctx->local_nls;
@@ -2751,11 +2748,9 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_ACL ;if (ctx->backupuid_specified) { cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPUID ; - cifs_sb->mnt_backupuid = ctx->backupuid; }if (ctx->backupgid_specified) { cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_CIFS_BACKUPGID ; - cifs_sb->mnt_backupgid = ctx->backupgid; }if (ctx->override_uid) cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_OVERR_UID ;
fs/cifs/file.c +3 -2
@@ -44,6 +44,7 @@#include "cifs_fs_sb.h" #include "fscache.h" #include "smbdirect.h" +#include "fs_context.h" static inline int cifs_convert_flags (unsigned int flags) {
@@ -571,7 +572,7 @@ int cifs_open(struct inode *inode, struct file *file) le64_to_cpu(tcon->fsUnixInfo.Capability))) {/* can not refresh inode info since size could be stale */ rc =cifs_posix_open (full_path, &inode, inode->i_sb, - cifs_sb->mnt_file_mode/* ignored */ , + cifs_sb->ctx->file_mode/* ignored */ , file->f_flags, &oplock, &fid.netfid, xid);if (rc ==0 ) {cifs_dbg (FYI ,"posix open succeeded\n" );
@@ -740,7 +741,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ~(O_CREAT |O_EXCL |O_TRUNC ); rc =cifs_posix_open (full_path,NULL , inode->i_sb, - cifs_sb->mnt_file_mode/* ignored */ , + cifs_sb->ctx->file_mode/* ignored */ , oflags, &oplock, &cfile->fid.netfid, xid);if (rc ==0 ) {cifs_dbg (FYI ,"posix reopen succeeded\n" );
fs/cifs/inode.c +20 -19
@@ -37,6 +37,7 @@#include "cifs_fs_sb.h" #include "cifs_unicode.h" #include "fscache.h" +#include "fs_context.h" static void cifs_set_ops (struct inode *inode)
@@ -294,7 +295,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,break ; } - fattr->cf_uid = cifs_sb->mnt_uid; + fattr->cf_uid = cifs_sb->ctx->linux_uid;if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_UID )) {u64 id =le64_to_cpu (info->Uid);if (id < ((uid_t)-1 )) {
@@ -304,7 +305,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info, } } - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_OVERR_GID )) {u64 id =le64_to_cpu (info->Gid);if (id < ((gid_t)-1 )) {
@@ -333,8 +334,8 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)memset (fattr,0 ,sizeof (*fattr)); fattr->cf_mode =S_IFDIR |S_IXUGO |S_IRWXU ; - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;ktime_get_coarse_real_ts64 (&fattr->cf_mtime); fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime; fattr->cf_nlink =2 ;
@@ -644,8 +645,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo * }/* else if reparse point ... TODO: add support for FIFO and blk dev; special file types */ - fattr->cf_uid = cifs_sb->mnt_uid;/* TODO: map uid and gid from SID */ - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid;/* TODO: map uid and gid from SID */ + fattr->cf_gid = cifs_sb->ctx->linux_gid;cifs_dbg (FYI ,"POSIX query info: mode 0x%x uniqueid 0x%llx nlink %d\n" , fattr->cf_mode, fattr->cf_uniqueid, fattr->cf_nlink);
@@ -685,25 +686,25 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_nlink =le32_to_cpu (info->NumberOfLinks);if (reparse_tag ==IO_REPARSE_TAG_LX_SYMLINK ) { - fattr->cf_mode |=S_IFLNK | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFLNK | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_LNK ; }else if (reparse_tag ==IO_REPARSE_TAG_LX_FIFO ) { - fattr->cf_mode |=S_IFIFO | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFIFO | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_FIFO ; }else if (reparse_tag ==IO_REPARSE_TAG_AF_UNIX ) { - fattr->cf_mode |=S_IFSOCK | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFSOCK | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_SOCK ; }else if (reparse_tag ==IO_REPARSE_TAG_LX_CHR ) { - fattr->cf_mode |=S_IFCHR | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFCHR | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_CHR ; }else if (reparse_tag ==IO_REPARSE_TAG_LX_BLK ) { - fattr->cf_mode |=S_IFBLK | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFBLK | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_BLK ; }else if (symlink) {/* TODO add more reparse tag checks */ fattr->cf_mode =S_IFLNK ; fattr->cf_dtype =DT_LNK ; }else if (fattr->cf_cifsattrs &ATTR_DIRECTORY ) { - fattr->cf_mode =S_IFDIR | cifs_sb->mnt_dir_mode; + fattr->cf_mode =S_IFDIR | cifs_sb->ctx->dir_mode; fattr->cf_dtype =DT_DIR ;/* * Server can return wrong NumberOfLinks value for directories
@@ -712,7 +713,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,if (!tcon->unix_ext) fattr->cf_flags |=CIFS_FATTR_UNKNOWN_NLINK ; }else { - fattr->cf_mode =S_IFREG | cifs_sb->mnt_file_mode; + fattr->cf_mode =S_IFREG | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_REG ;/* clear write bits if ATTR_READONLY is set */
@@ -731,8 +732,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, } } - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid; } static int
@@ -1391,8 +1392,8 @@ struct inode *cifs_root_iget(struct super_block *sb)set_nlink (inode,2 ); inode->i_op = &cifs_ipc_inode_ops; inode->i_fop = &simple_dir_operations; - inode->i_uid = cifs_sb->mnt_uid; - inode->i_gid = cifs_sb->mnt_gid; + inode->i_uid = cifs_sb->ctx->linux_uid; + inode->i_gid = cifs_sb->ctx->linux_gid;spin_unlock (&inode->i_lock); }else if (rc) {iget_failed (inode);
@@ -2877,10 +2878,10 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) attrs->ia_mode &= ~(S_IALLUGO );if (S_ISDIR (inode->i_mode)) attrs->ia_mode |= - cifs_sb->mnt_dir_mode; + cifs_sb->ctx->dir_mode;else attrs->ia_mode |= - cifs_sb->mnt_file_mode; + cifs_sb->ctx->file_mode; } }else if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_DYNPERM )) {/* ignore mode change - ATTR_READONLY hasn't changed */
fs/cifs/misc.c +3 -2
@@ -35,6 +35,7 @@#ifdef CONFIG_CIFS_DFS_UPCALL #include "dns_resolve.h" #endif +#include "fs_context.h" extern mempool_t *cifs_sm_req_poolp;extern mempool_t *cifs_req_poolp;
@@ -632,11 +633,11 @@ bool backup_cred(struct cifs_sb_info *cifs_sb) {if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPUID ) { -if (uid_eq (cifs_sb->mnt_backupuid,current_fsuid ())) +if (uid_eq (cifs_sb->ctx->backupuid,current_fsuid ()))return true; }if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_CIFS_BACKUPGID ) { -if (in_group_p (cifs_sb->mnt_backupgid)) +if (in_group_p (cifs_sb->ctx->backupgid))return true; }
fs/cifs/readdir.c +10 -9
@@ -33,6 +33,7 @@#include "cifs_fs_sb.h" #include "cifsfs.h" #include "smb2proto.h" +#include "fs_context.h" /* * To be safe - for UCS to UTF-8 with strings loaded with the rare long
@@ -165,8 +166,8 @@ static bool reparse_file_needs_reval(const struct cifs_fattr *fattr)static void cifs_fill_common_info (struct cifs_fattr *fattr,struct cifs_sb_info *cifs_sb) { - fattr->cf_uid = cifs_sb->mnt_uid; - fattr->cf_gid = cifs_sb->mnt_gid; + fattr->cf_uid = cifs_sb->ctx->linux_uid; + fattr->cf_gid = cifs_sb->ctx->linux_gid;/* * The IO_REPARSE_TAG_LX_ tags originally were used by WSL but they
@@ -177,25 +178,25 @@ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb)* reasonably map some of them to directories vs. files vs. symlinks */ if (fattr->cf_cifsattrs &ATTR_DIRECTORY ) { - fattr->cf_mode =S_IFDIR | cifs_sb->mnt_dir_mode; + fattr->cf_mode =S_IFDIR | cifs_sb->ctx->dir_mode; fattr->cf_dtype =DT_DIR ; }else if (fattr->cf_cifstag ==IO_REPARSE_TAG_LX_SYMLINK ) { - fattr->cf_mode |=S_IFLNK | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFLNK | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_LNK ; }else if (fattr->cf_cifstag ==IO_REPARSE_TAG_LX_FIFO ) { - fattr->cf_mode |=S_IFIFO | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFIFO | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_FIFO ; }else if (fattr->cf_cifstag ==IO_REPARSE_TAG_AF_UNIX ) { - fattr->cf_mode |=S_IFSOCK | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFSOCK | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_SOCK ; }else if (fattr->cf_cifstag ==IO_REPARSE_TAG_LX_CHR ) { - fattr->cf_mode |=S_IFCHR | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFCHR | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_CHR ; }else if (fattr->cf_cifstag ==IO_REPARSE_TAG_LX_BLK ) { - fattr->cf_mode |=S_IFBLK | cifs_sb->mnt_file_mode; + fattr->cf_mode |=S_IFBLK | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_BLK ; }else {/* TODO: should we mark some other reparse points (like DFSR) as directories? */ - fattr->cf_mode =S_IFREG | cifs_sb->mnt_file_mode; + fattr->cf_mode =S_IFREG | cifs_sb->ctx->file_mode; fattr->cf_dtype =DT_REG ; }
Signature · 1 line
2.27.0
PATCH 10/21 cifs: remove actimeo from cifs_sb
In reply to a message not in the archive--- fs/cifs/cifs_fs_sb.h | 1 - fs/cifs/cifsfs.c | 2 +- fs/cifs/connect.c | 3 +-- fs/cifs/inode.c | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-)
fs/cifs/cifs_fs_sb.h +0 -1
@@ -65,7 +65,6 @@ struct cifs_sb_info {unsigned int bsize;unsigned int rsize;unsigned int wsize; -unsigned long actimeo;/* attribute cache timeout (jiffies) */ atomic_t active;unsigned int mnt_cifs_flags;struct delayed_work prune_tlinks;
fs/cifs/cifsfs.c +1 -1
@@ -629,7 +629,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (tcon->handle_timeout)seq_printf (s,",handletimeout=%u" , tcon->handle_timeout);/* convert actimeo and display it in seconds */ -seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ ); +seq_printf (s,",actimeo=%lu" , cifs_sb->ctx->actimeo /HZ );if (tcon->ses->chan_max >1 ) seq_printf(s, ",multichannel,max_channels=%zu",
fs/cifs/connect.c +1 -2
@@ -2236,7 +2236,7 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)if (strcmp (old->local_nls->charset, new->local_nls->charset))return 0 ; -if (old->actimeo != new->actimeo) +if (old->ctx->actimeo != new->ctx->actimeo)return 0 ;return 1 ;
@@ -2682,7 +2682,6 @@ 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->actimeo = ctx->actimeo; cifs_sb->local_nls = ctx->local_nls;if (ctx->nodfs)
fs/cifs/inode.c +2 -2
@@ -2165,11 +2165,11 @@ cifs_inode_needs_reval(struct inode *inode)if (!lookupCacheEnabled)return true; -if (!cifs_sb->actimeo) +if (!cifs_sb->ctx->actimeo)return true;if (!time_in_range (jiffies, cifs_i->time, - cifs_i->time + cifs_sb->actimeo)) + cifs_i->time + cifs_sb->ctx->actimeo))return true;/* hardlinked files w/ noserverino get "special" treatment */
Signature · 1 line
2.13.6
Re: [PATCH 10/21] cifs: remove actimeo from cifs_sb
tentatively merged into cifs-2.6.gif for-next
Quoted 76 lines · Ronnie Sahlberg
Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/cifs_fs_sb.h | 1 - fs/cifs/cifsfs.c | 2 +- fs/cifs/connect.c | 3 +-- fs/cifs/inode.c | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-)fs/cifs/cifs_fs_sb.h +0
-1@@ -65,7 +65,6 @@ struct cifs_sb_info {unsigned int bsize;unsigned int rsize;unsigned int wsize; -unsigned long actimeo;/* attribute cache timeout (jiffies) */ atomic_t active;unsigned int mnt_cifs_flags;struct delayed_work prune_tlinks;fs/cifs/cifsfs.c +1
-1@@ -629,7 +629,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root)if (tcon->handle_timeout)seq_printf (s,",handletimeout=%u" , tcon->handle_timeout);/* convert actimeo and display it in seconds */ -seq_printf (s,",actimeo=%lu" , cifs_sb->actimeo /HZ ); +seq_printf (s,",actimeo=%lu" , cifs_sb->ctx->actimeo /HZ );if (tcon->ses->chan_max >1 ) seq_printf(s, ",multichannel,max_channels=%zu",fs/cifs/connect.c +1
-2@@ -2236,7 +2236,7 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)if (strcmp (old->local_nls->charset, new->local_nls->charset))return 0 ; -if (old->actimeo != new->actimeo) +if (old->ctx->actimeo != new->ctx->actimeo)return 0 ;return 1 ;@@ -2682,7 +2682,6 @@ 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->actimeo = ctx->actimeo; cifs_sb->local_nls = ctx->local_nls;if (ctx->nodfs)fs/cifs/inode.c +2
-3@@ -2165,11 +2165,11 @@ cifs_inode_needs_reval(struct inode *inode)if (!lookupCacheEnabled)return true; -if (!cifs_sb->actimeo) +if (!cifs_sb->ctx->actimeo)return true;if (!time_in_range (jiffies, cifs_i->time, - cifs_i->time + cifs_sb->actimeo)) + cifs_i->time + cifs_sb->ctx->actimeo))return true;/* hardlinked files w/ noserverino get "special" treatment */ --2.13.6
Signature · 3 lines
Thanks, Steve
PATCH 11/21 cifs: move cifs_cleanup_volume_info[_content] to fs_context.c
In reply to a message not in the archiveand 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
@@ -866,7 +866,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
@@ -252,6 +252,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 12/21 cifs: move [brw]size from cifs_sb to cifs_sb->ctx
In reply to a message not in the archive--- 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
@@ -215,7 +215,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 */
@@ -612,9 +612,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
@@ -2219,10 +2219,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) ||
@@ -2671,14 +2671,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);
@@ -2882,8 +2874,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
@@ -2331,7 +2331,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 ();
@@ -2364,7 +2364,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;
@@ -2906,7 +2906,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 ;
@@ -3637,7 +3637,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 ;
@@ -4023,7 +4023,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 ;
@@ -4408,7 +4408,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
@@ -781,12 +781,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
@@ -151,6 +151,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
@@ -2374,7 +2374,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
@@ -3802,7 +3802,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 13/21 cifs: add initial reconfigure support
In reply to a message not in the archive--- fs/cifs/fs_context.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)
fs/cifs/fs_context.c +33 -3
@@ -618,14 +618,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 14/21 cifs: we do not allow changing username/password/unc/... during remount
In reply to a message not in the archive--- fs/cifs/cifsfs.c | 2 +- fs/cifs/fs_context.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 +- 3 files changed, 54 insertions(+), 5 deletions(-)
fs/cifs/cifsfs.c +1 -1
@@ -490,7 +490,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 +52 -3
72 lines not on this page · raw message
fs/cifs/fs_context.h +1 -1
@@ -148,7 +148,6 @@ struct smb3_fs_context {bool uid_specified;bool gid_specified;bool sloppy; -char *nodename;bool got_ip;bool got_version;bool got_rsize;
@@ -160,6 +159,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
Re: [PATCH 14/21] cifs: we do not allow changing username/password/unc/... during remount
Minor nits pointed out by checkpatch:
0015-cifs-we-do-not-allow-changing-username-password-unc-.patch
---------------------------------------------------------------
WARNING: Missing commit description - Add an appropriate one
WARNING: kfree(NULL) is safe and this check is probably not required #76: FILE: fs/cifs/fs_context.c:673:
+ if (ctx->field) { \
+ kfree(ctx->field);
Quoted 122 lines · Ronnie Sahlberg
Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/cifsfs.c | 2 +- fs/cifs/fs_context.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 +- 3 files changed, 54 insertions(+), 5 deletions(-)fs/cifs/cifsfs.c +1
-1@@ -490,7 +490,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 +52
-3@@ -629,10 +629,53 @@ static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx,cifs_dbg (VFS ,"can not change sec during remount\n" );return -EINVAL ; } +if (new_ctx->multiuser != old_ctx->multiuser) { +cifs_dbg (VFS ,"can not change multiuser during remount\n" ); +return -EINVAL ; + } +if (new_ctx->UNC && + (!old_ctx->UNC ||strcmp (new_ctx->UNC, old_ctx->UNC))) { +cifs_dbg (VFS ,"can not change UNC during remount\n" ); +return -EINVAL ; + } +if (new_ctx->username && + (!old_ctx->username ||strcmp (new_ctx->username, old_ctx->username))) { +cifs_dbg (VFS ,"can not change username during remount\n" ); +return -EINVAL ; + } +if (new_ctx->password && + (!old_ctx->password ||strcmp (new_ctx->password, old_ctx->password))) { +cifs_dbg (VFS ,"can not change password during remount\n" ); +return -EINVAL ; + } +if (new_ctx->domainname && + (!old_ctx->domainname ||strcmp (new_ctx->domainname, old_ctx->domainname))) { +cifs_dbg (VFS ,"can not change domainname during remount\n" ); +return -EINVAL ; + } +if (new_ctx->nodename && + (!old_ctx->nodename ||strcmp (new_ctx->nodename, old_ctx->nodename))) { +cifs_dbg (VFS ,"can not change nodename during remount\n" ); +return -EINVAL ; + } +if (new_ctx->iocharset && + (!old_ctx->iocharset ||strcmp (new_ctx->iocharset, old_ctx->iocharset))) { +cifs_dbg (VFS ,"can not change iocharset during remount\n" ); +return -EINVAL ; + }return 0 ; } +#define STEAL_STRING (cifs_sb, ctx, field) \ +do { \ + if (ctx->field) { \ + kfree(ctx->field); \ + ctx->field = cifs_sb->ctx->field; \ + cifs_sb->ctx->field = NULL; \ + } \ +} while (0) +static int smb3_reconfigure (struct fs_context *fc) {struct smb3_fs_context *ctx =smb3_fc2context (fc);@@ -645,10 +688,16 @@ static int smb3_reconfigure(struct fs_context *fc)return rc;/* -* Steal the UNC from the old and to be destroyed context. +* We can not change UNC/username/password/domainname/nodename/iocharset +* during reconnect so ignore what we have in the new context and +* just use what we already have in cifs_sb->ctx. */ - ctx->UNC = cifs_sb->ctx->UNC; - cifs_sb->ctx->UNC =NULL ; +STEAL_STRING (cifs_sb, ctx,UNC ); +STEAL_STRING (cifs_sb, ctx, username); +STEAL_STRING (cifs_sb, ctx, password); +STEAL_STRING (cifs_sb, ctx, domainname); +STEAL_STRING (cifs_sb, ctx, nodename); +STEAL_STRING (cifs_sb, ctx, iocharset);smb3_cleanup_fs_context_contents (cifs_sb->ctx); rc =smb3_fs_context_dup (cifs_sb->ctx, ctx);fs/cifs/fs_context.h +1
-2@@ -148,7 +148,6 @@ struct smb3_fs_context {bool uid_specified;bool gid_specified;bool sloppy; -char *nodename;bool got_ip;bool got_version;bool got_rsize;@@ -160,6 +159,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 */ --2.13.6
Signature · 3 lines
Thanks, Steve
Re: [PATCH 14/21] cifs: we do not allow changing username/password/unc/... during remount
пн, 7 дек. 2020 г. в 21:07, Steve French <[email protected]>:
Quoted 80 lines
Minor nits pointed out by checkpatch:
0015-cifs-we-do-not-allow-changing-username-password-unc-.patch
---------------------------------------------------------------
WARNING: Missing commit description - Add an appropriate oneWARNING: kfree(NULL) is safe and this check is probably not required #76: FILE:
fs/cifs/fs_context.c:673:
+ if (ctx->field) { \
+kfree(ctx->field);Quoted 67 lines · Ronnie Sahlberg
Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/cifsfs.c | 2 +- fs/cifs/fs_context.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 +- 3 files changed, 54 insertions(+), 5 deletions(-)fs/cifs/cifsfs.c +1
-1@@ -490,7 +490,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 +34
-0@@ -629,10 +629,53 @@ static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx,cifs_dbg (VFS ,"can not change sec during remount\n" );return -EINVAL ; } +if (new_ctx->multiuser != old_ctx->multiuser) { +cifs_dbg (VFS ,"can not change multiuser during remount\n" ); +return -EINVAL ; + } +if (new_ctx->UNC && + (!old_ctx->UNC ||strcmp (new_ctx->UNC, old_ctx->UNC))) { +cifs_dbg (VFS ,"can not change UNC during remount\n" ); +return -EINVAL ; + } +if (new_ctx->username && + (!old_ctx->username ||strcmp (new_ctx->username, old_ctx->username))) { +cifs_dbg (VFS ,"can not change username during remount\n" ); +return -EINVAL ; + } +if (new_ctx->password && + (!old_ctx->password ||strcmp (new_ctx->password, old_ctx->password))) { +cifs_dbg (VFS ,"can not change password during remount\n" ); +return -EINVAL ; + } +if (new_ctx->domainname && + (!old_ctx->domainname ||strcmp (new_ctx->domainname, old_ctx->domainname))) { +cifs_dbg (VFS ,"can not change domainname during remount\n" ); +return -EINVAL ; + } +if (new_ctx->nodename && + (!old_ctx->nodename ||strcmp (new_ctx->nodename, old_ctx->nodename))) { +cifs_dbg (VFS ,"can not change nodename during remount\n" ); +return -EINVAL ; + } +if (new_ctx->iocharset && + (!old_ctx->iocharset ||strcmp (new_ctx->iocharset, old_ctx->iocharset))) { +cifs_dbg (VFS ,"can not change iocharset during remount\n" ); +return -EINVAL ; + }return 0 ; }
Quoted 8 lines
fs/cifs/fs_context.c static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx, · line 677
Quoted 8 lines
fs/cifs/fs_context.c +8
-0+#define STEAL_STRING (cifs_sb, ctx, field) \ +do { \ + if (ctx->field) { \ + kfree(ctx->field); \ + ctx->field = cifs_sb->ctx->field; \ + cifs_sb->ctx->field = NULL; \ + } \ +} while (0)
If ctx->field is NULL we won't assign new value from cifs_sb->ctx->field and the procedure will become no-op. Is this an intent?
--
Best regards,
Pavel Shilovsky
ronnie sahlberg
reviewerRe: [PATCH 14/21] cifs: we do not allow changing username/password/unc/... during remount
Quoted 82 lines · Pavel Shilovsky
пн, 7 дек. 2020 г. в 21:07, Steve French <[email protected]>:
Quoted 80 lines
Minor nits pointed out by checkpatch:
0015-cifs-we-do-not-allow-changing-username-password-unc-.patch
---------------------------------------------------------------
WARNING: Missing commit description - Add an appropriate oneWARNING: kfree(NULL) is safe and this check is probably not required #76: FILE:
fs/cifs/fs_context.c:673:
+ if (ctx->field) { \
+kfree(ctx->field);Quoted 67 lines · Ronnie Sahlberg
Signed-off-by Ronnie Sahlberg <[email protected]>--- fs/cifs/cifsfs.c | 2 +- fs/cifs/fs_context.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--- fs/cifs/fs_context.h | 2 +- 3 files changed, 54 insertions(+), 5 deletions(-)fs/cifs/cifsfs.c +1
-1@@ -490,7 +490,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 +34
-0@@ -629,10 +629,53 @@ static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx,cifs_dbg (VFS ,"can not change sec during remount\n" );return -EINVAL ; } +if (new_ctx->multiuser != old_ctx->multiuser) { +cifs_dbg (VFS ,"can not change multiuser during remount\n" ); +return -EINVAL ; + } +if (new_ctx->UNC && + (!old_ctx->UNC ||strcmp (new_ctx->UNC, old_ctx->UNC))) { +cifs_dbg (VFS ,"can not change UNC during remount\n" ); +return -EINVAL ; + } +if (new_ctx->username && + (!old_ctx->username ||strcmp (new_ctx->username, old_ctx->username))) { +cifs_dbg (VFS ,"can not change username during remount\n" ); +return -EINVAL ; + } +if (new_ctx->password && + (!old_ctx->password ||strcmp (new_ctx->password, old_ctx->password))) { +cifs_dbg (VFS ,"can not change password during remount\n" ); +return -EINVAL ; + } +if (new_ctx->domainname && + (!old_ctx->domainname ||strcmp (new_ctx->domainname, old_ctx->domainname))) { +cifs_dbg (VFS ,"can not change domainname during remount\n" ); +return -EINVAL ; + } +if (new_ctx->nodename && + (!old_ctx->nodename ||strcmp (new_ctx->nodename, old_ctx->nodename))) { +cifs_dbg (VFS ,"can not change nodename during remount\n" ); +return -EINVAL ; + } +if (new_ctx->iocharset && + (!old_ctx->iocharset ||strcmp (new_ctx->iocharset, old_ctx->iocharset))) { +cifs_dbg (VFS ,"can not change iocharset during remount\n" ); +return -EINVAL ; + }return 0 ; }
Quoted 12 lines
Quoted 8 lines
fs/cifs/fs_context.c static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx, · line 677
Quoted 8 lines
fs/cifs/fs_context.c +8
-0+#define STEAL_STRING (cifs_sb, ctx, field) \ +do { \ + if (ctx->field) { \ + kfree(ctx->field); \ + ctx->field = cifs_sb->ctx->field; \ + cifs_sb->ctx->field = NULL; \ + } \ +} while (0)If
ctx->fieldis NULL we won't assign new value fromcifs_sb->ctx->fieldand the procedure will become no-op. Is this an intent?
No, that is a bug. I will fix that.
Thanks.
Quoted 4 lines
--
Best regards,
Pavel Shilovsky
PATCH 15/21 cifs: simplify handling of cifs_sb/ctx->local_nls
In reply to a message not in the archiveOnly 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
@@ -2674,7 +2674,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 ;
@@ -3145,19 +3157,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; }
@@ -3478,7 +3477,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
@@ -302,7 +302,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 ;
@@ -1339,9 +1338,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
@@ -236,7 +236,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 16/21 cifs: don't create a temp nls in cifs_setup_ipc
In reply to a message not in the archivejust 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
@@ -1493,7 +1493,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;
@@ -1518,14 +1517,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) {
@@ -1538,7 +1534,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 17/21 cifs: uncomplicate printing the iocharset parameter
In reply to a message not in the archiveThere 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
@@ -459,18 +459,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
@@ -534,9 +522,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 18/21 cifs: do not allow changing posix_paths during remount
In reply to a message not in the archive--- fs/cifs/fs_context.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/cifs/fs_context.c +4 -0
@@ -624,6 +624,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 19/21 cifs: remove ctx argument from cifs_setup_cifs_sb
In reply to a message not in the archive--- 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
@@ -802,7 +802,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
@@ -2658,16 +2658,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 20/21 cifs: move update of flags into a separate function
In reply to a message not in the archiveThis 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
@@ -2684,61 +2684,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 ;
@@ -2747,23 +2696,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
@@ -265,5 +265,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
PATCH 21/21 cifs: update mnt_cifs_flags during reconfigure
In reply to a message not in the archive--- 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