summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-10-12 11:32:42 -0400
committerSteve French <sfrench@us.ibm.com>2010-10-12 15:43:53 +0000
commit1c456013e96f10915578dc61095d19b4906f64ac (patch)
tree3343310e8c431227bdc5ff343585913ed2bfde0b
parent9daa42e22030f0c5c357a5e1f8af658411beda6b (diff)
cifs: on multiuser mount, set ownership to current_fsuid/current_fsgid (try #7)
commit 3aa1c8c2900065a51268430ab48a1b42fdfe5b45 made cifs_getattr set the ownership of files to current_fsuid/current_fsgid when multiuser mounts were in use and when mnt_uid/mnt_gid were non-zero. It should have instead based that decision on the CIFS_MOUNT_OVERR_UID/GID flags. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/inode.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index f629159be4e..94979309698 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1755,7 +1755,7 @@ check_inval:
}
int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
- struct kstat *stat)
+ struct kstat *stat)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb);
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb);
@@ -1765,11 +1765,17 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
generic_fillattr(dentry->d_inode, stat);
stat->blksize = CIFS_MAX_MSGSIZE;
stat->ino = CIFS_I(dentry->d_inode)->uniqueid;
+
+ /*
+ * If on a multiuser mount without unix extensions, and the
+ * admin hasn't overridden them, set the ownership to the
+ * fsuid/fsgid of the current process.
+ */
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) &&
!tcon->unix_ext) {
- if (!cifs_sb->mnt_uid)
+ if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID))
stat->uid = current_fsuid();
- if (!cifs_sb->mnt_uid)
+ if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID))
stat->gid = current_fsgid();
}
}