Commit 8401e936 authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Steve French

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.
Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent ee0dce49
...@@ -67,12 +67,6 @@ struct cifs_sb_info { ...@@ -67,12 +67,6 @@ struct cifs_sb_info {
unsigned int wsize; unsigned int wsize;
unsigned long actimeo; /* attribute cache timeout (jiffies) */ unsigned long actimeo; /* attribute cache timeout (jiffies) */
atomic_t active; 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; unsigned int mnt_cifs_flags;
struct delayed_work prune_tlinks; struct delayed_work prune_tlinks;
struct rcu_head rcu; struct rcu_head rcu;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "cifsacl.h" #include "cifsacl.h"
#include "cifsproto.h" #include "cifsproto.h"
#include "cifs_debug.h" #include "cifs_debug.h"
#include "fs_context.h"
/* security id for everyone/world system group */ /* security id for everyone/world system group */
static const struct cifs_sid sid_everyone = { static const struct cifs_sid sid_everyone = {
...@@ -346,8 +347,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid, ...@@ -346,8 +347,8 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
struct key *sidkey; struct key *sidkey;
char *sidstr; char *sidstr;
const struct cred *saved_cred; const struct cred *saved_cred;
kuid_t fuid = cifs_sb->mnt_uid; kuid_t fuid = cifs_sb->ctx->linux_uid;
kgid_t fgid = cifs_sb->mnt_gid; kgid_t fgid = cifs_sb->ctx->linux_gid;
/* /*
* If we have too many subauthorities, then something is really wrong. * 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, ...@@ -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 * 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: got_valid_id:
rc = 0; rc = 0;
......
...@@ -518,14 +518,14 @@ cifs_show_options(struct seq_file *s, struct dentry *root) ...@@ -518,14 +518,14 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
} }
seq_printf(s, ",uid=%u", 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) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)
seq_puts(s, ",forceuid"); seq_puts(s, ",forceuid");
else else
seq_puts(s, ",noforceuid"); seq_puts(s, ",noforceuid");
seq_printf(s, ",gid=%u", 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) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)
seq_puts(s, ",forcegid"); seq_puts(s, ",forcegid");
else else
...@@ -535,8 +535,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) ...@@ -535,8 +535,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
if (!tcon->unix_ext) if (!tcon->unix_ext)
seq_printf(s, ",file_mode=0%ho,dir_mode=0%ho", seq_printf(s, ",file_mode=0%ho,dir_mode=0%ho",
cifs_sb->mnt_file_mode, cifs_sb->ctx->file_mode,
cifs_sb->mnt_dir_mode); cifs_sb->ctx->dir_mode);
cifs_show_nls(s, cifs_sb->local_nls); cifs_show_nls(s, cifs_sb->local_nls);
...@@ -609,11 +609,11 @@ cifs_show_options(struct seq_file *s, struct dentry *root) ...@@ -609,11 +609,11 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID)
seq_printf(s, ",backupuid=%u", seq_printf(s, ",backupuid=%u",
from_kuid_munged(&init_user_ns, from_kuid_munged(&init_user_ns,
cifs_sb->mnt_backupuid)); cifs_sb->ctx->backupuid));
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID)
seq_printf(s, ",backupgid=%u", seq_printf(s, ",backupgid=%u",
from_kgid_munged(&init_user_ns, 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, ",rsize=%u", cifs_sb->rsize);
seq_printf(s, ",wsize=%u", cifs_sb->wsize); seq_printf(s, ",wsize=%u", cifs_sb->wsize);
......
...@@ -2240,11 +2240,12 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) ...@@ -2240,11 +2240,12 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data)
if (new->rsize && new->rsize < old->rsize) if (new->rsize && new->rsize < old->rsize)
return 0; 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; return 0;
if (old->mnt_file_mode != new->mnt_file_mode || if (old->ctx->file_mode != new->ctx->file_mode ||
old->mnt_dir_mode != new->mnt_dir_mode) old->ctx->dir_mode != new->ctx->dir_mode)
return 0; return 0;
if (strcmp(old->local_nls->charset, new->local_nls->charset)) if (strcmp(old->local_nls->charset, new->local_nls->charset))
...@@ -2707,12 +2708,8 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, ...@@ -2707,12 +2708,8 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx,
cifs_sb->rsize = ctx->rsize; cifs_sb->rsize = ctx->rsize;
cifs_sb->wsize = ctx->wsize; 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_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->actimeo = ctx->actimeo;
cifs_sb->local_nls = ctx->local_nls; cifs_sb->local_nls = ctx->local_nls;
...@@ -2751,11 +2748,9 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx, ...@@ -2751,11 +2748,9 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx,
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL;
if (ctx->backupuid_specified) { if (ctx->backupuid_specified) {
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPUID; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPUID;
cifs_sb->mnt_backupuid = ctx->backupuid;
} }
if (ctx->backupgid_specified) { if (ctx->backupgid_specified) {
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPGID; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPGID;
cifs_sb->mnt_backupgid = ctx->backupgid;
} }
if (ctx->override_uid) if (ctx->override_uid)
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID;
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "cifs_fs_sb.h" #include "cifs_fs_sb.h"
#include "fscache.h" #include "fscache.h"
#include "smbdirect.h" #include "smbdirect.h"
#include "fs_context.h"
static inline int cifs_convert_flags(unsigned int flags) static inline int cifs_convert_flags(unsigned int flags)
{ {
...@@ -571,7 +572,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -571,7 +572,7 @@ int cifs_open(struct inode *inode, struct file *file)
le64_to_cpu(tcon->fsUnixInfo.Capability))) { le64_to_cpu(tcon->fsUnixInfo.Capability))) {
/* can not refresh inode info since size could be stale */ /* can not refresh inode info since size could be stale */
rc = cifs_posix_open(full_path, &inode, inode->i_sb, 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); file->f_flags, &oplock, &fid.netfid, xid);
if (rc == 0) { if (rc == 0) {
cifs_dbg(FYI, "posix open succeeded\n"); cifs_dbg(FYI, "posix open succeeded\n");
...@@ -740,7 +741,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) ...@@ -740,7 +741,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
~(O_CREAT | O_EXCL | O_TRUNC); ~(O_CREAT | O_EXCL | O_TRUNC);
rc = cifs_posix_open(full_path, NULL, inode->i_sb, 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); oflags, &oplock, &cfile->fid.netfid, xid);
if (rc == 0) { if (rc == 0) {
cifs_dbg(FYI, "posix reopen succeeded\n"); cifs_dbg(FYI, "posix reopen succeeded\n");
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "cifs_fs_sb.h" #include "cifs_fs_sb.h"
#include "cifs_unicode.h" #include "cifs_unicode.h"
#include "fscache.h" #include "fscache.h"
#include "fs_context.h"
static void cifs_set_ops(struct inode *inode) 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, ...@@ -294,7 +295,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info,
break; 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)) { if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID)) {
u64 id = le64_to_cpu(info->Uid); u64 id = le64_to_cpu(info->Uid);
if (id < ((uid_t)-1)) { if (id < ((uid_t)-1)) {
...@@ -304,7 +305,7 @@ cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info, ...@@ -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)) { if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID)) {
u64 id = le64_to_cpu(info->Gid); u64 id = le64_to_cpu(info->Gid);
if (id < ((gid_t)-1)) { if (id < ((gid_t)-1)) {
...@@ -333,8 +334,8 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb) ...@@ -333,8 +334,8 @@ cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb)
memset(fattr, 0, sizeof(*fattr)); memset(fattr, 0, sizeof(*fattr));
fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU; fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU;
fattr->cf_uid = cifs_sb->mnt_uid; fattr->cf_uid = cifs_sb->ctx->linux_uid;
fattr->cf_gid = cifs_sb->mnt_gid; fattr->cf_gid = cifs_sb->ctx->linux_gid;
ktime_get_coarse_real_ts64(&fattr->cf_mtime); ktime_get_coarse_real_ts64(&fattr->cf_mtime);
fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime; fattr->cf_atime = fattr->cf_ctime = fattr->cf_mtime;
fattr->cf_nlink = 2; fattr->cf_nlink = 2;
...@@ -644,8 +645,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo * ...@@ -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 */ /* 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_uid = cifs_sb->ctx->linux_uid; /* TODO: map uid and gid from SID */
fattr->cf_gid = cifs_sb->mnt_gid; fattr->cf_gid = cifs_sb->ctx->linux_gid;
cifs_dbg(FYI, "POSIX query info: mode 0x%x uniqueid 0x%llx nlink %d\n", cifs_dbg(FYI, "POSIX query info: mode 0x%x uniqueid 0x%llx nlink %d\n",
fattr->cf_mode, fattr->cf_uniqueid, fattr->cf_nlink); 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, ...@@ -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); fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
if (reparse_tag == IO_REPARSE_TAG_LX_SYMLINK) { 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; fattr->cf_dtype = DT_LNK;
} else if (reparse_tag == IO_REPARSE_TAG_LX_FIFO) { } 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; fattr->cf_dtype = DT_FIFO;
} else if (reparse_tag == IO_REPARSE_TAG_AF_UNIX) { } 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; fattr->cf_dtype = DT_SOCK;
} else if (reparse_tag == IO_REPARSE_TAG_LX_CHR) { } 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; fattr->cf_dtype = DT_CHR;
} else if (reparse_tag == IO_REPARSE_TAG_LX_BLK) { } 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; fattr->cf_dtype = DT_BLK;
} else if (symlink) { /* TODO add more reparse tag checks */ } else if (symlink) { /* TODO add more reparse tag checks */
fattr->cf_mode = S_IFLNK; fattr->cf_mode = S_IFLNK;
fattr->cf_dtype = DT_LNK; fattr->cf_dtype = DT_LNK;
} else if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { } 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; fattr->cf_dtype = DT_DIR;
/* /*
* Server can return wrong NumberOfLinks value for directories * 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, ...@@ -712,7 +713,7 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
if (!tcon->unix_ext) if (!tcon->unix_ext)
fattr->cf_flags |= CIFS_FATTR_UNKNOWN_NLINK; fattr->cf_flags |= CIFS_FATTR_UNKNOWN_NLINK;
} else { } 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; fattr->cf_dtype = DT_REG;
/* clear write bits if ATTR_READONLY is set */ /* 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, ...@@ -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_uid = cifs_sb->ctx->linux_uid;
fattr->cf_gid = cifs_sb->mnt_gid; fattr->cf_gid = cifs_sb->ctx->linux_gid;
} }
static int static int
...@@ -1391,8 +1392,8 @@ struct inode *cifs_root_iget(struct super_block *sb) ...@@ -1391,8 +1392,8 @@ struct inode *cifs_root_iget(struct super_block *sb)
set_nlink(inode, 2); set_nlink(inode, 2);
inode->i_op = &cifs_ipc_inode_ops; inode->i_op = &cifs_ipc_inode_ops;
inode->i_fop = &simple_dir_operations; inode->i_fop = &simple_dir_operations;
inode->i_uid = cifs_sb->mnt_uid; inode->i_uid = cifs_sb->ctx->linux_uid;
inode->i_gid = cifs_sb->mnt_gid; inode->i_gid = cifs_sb->ctx->linux_gid;
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
} else if (rc) { } else if (rc) {
iget_failed(inode); iget_failed(inode);
...@@ -2877,10 +2878,10 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) ...@@ -2877,10 +2878,10 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
attrs->ia_mode &= ~(S_IALLUGO); attrs->ia_mode &= ~(S_IALLUGO);
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
attrs->ia_mode |= attrs->ia_mode |=
cifs_sb->mnt_dir_mode; cifs_sb->ctx->dir_mode;
else else
attrs->ia_mode |= attrs->ia_mode |=
cifs_sb->mnt_file_mode; cifs_sb->ctx->file_mode;
} }
} else if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) { } else if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) {
/* ignore mode change - ATTR_READONLY hasn't changed */ /* ignore mode change - ATTR_READONLY hasn't changed */
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
#include "dns_resolve.h" #include "dns_resolve.h"
#endif #endif
#include "fs_context.h"
extern mempool_t *cifs_sm_req_poolp; extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp; extern mempool_t *cifs_req_poolp;
...@@ -632,11 +633,11 @@ bool ...@@ -632,11 +633,11 @@ bool
backup_cred(struct cifs_sb_info *cifs_sb) backup_cred(struct cifs_sb_info *cifs_sb)
{ {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) { 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; return true;
} }
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) { 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; return true;
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "cifs_fs_sb.h" #include "cifs_fs_sb.h"
#include "cifsfs.h" #include "cifsfs.h"
#include "smb2proto.h" #include "smb2proto.h"
#include "fs_context.h"
/* /*
* To be safe - for UCS to UTF-8 with strings loaded with the rare long * 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) ...@@ -165,8 +166,8 @@ static bool reparse_file_needs_reval(const struct cifs_fattr *fattr)
static void static void
cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb) cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb)
{ {
fattr->cf_uid = cifs_sb->mnt_uid; fattr->cf_uid = cifs_sb->ctx->linux_uid;
fattr->cf_gid = cifs_sb->mnt_gid; fattr->cf_gid = cifs_sb->ctx->linux_gid;
/* /*
* The IO_REPARSE_TAG_LX_ tags originally were used by WSL but they * 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) ...@@ -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 * reasonably map some of them to directories vs. files vs. symlinks
*/ */
if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { 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; fattr->cf_dtype = DT_DIR;
} else if (fattr->cf_cifstag == IO_REPARSE_TAG_LX_SYMLINK) { } 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; fattr->cf_dtype = DT_LNK;
} else if (fattr->cf_cifstag == IO_REPARSE_TAG_LX_FIFO) { } 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; fattr->cf_dtype = DT_FIFO;
} else if (fattr->cf_cifstag == IO_REPARSE_TAG_AF_UNIX) { } 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; fattr->cf_dtype = DT_SOCK;
} else if (fattr->cf_cifstag == IO_REPARSE_TAG_LX_CHR) { } 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; fattr->cf_dtype = DT_CHR;
} else if (fattr->cf_cifstag == IO_REPARSE_TAG_LX_BLK) { } 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; fattr->cf_dtype = DT_BLK;
} else { /* TODO: should we mark some other reparse points (like DFSR) as directories? */ } 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; fattr->cf_dtype = DT_REG;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment