]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
cifs: on multiuser mount, set ownership to current_fsuid/current_fsgid (try #5)
authorJeff Layton <jlayton@redhat.com>
Thu, 7 Oct 2010 18:46:28 +0000 (14:46 -0400)
committerSteve French <sfrench@us.ibm.com>
Fri, 8 Oct 2010 03:26:28 +0000 (03:26 +0000)
...when unix extensions aren't enabled. This makes everything on the
mount appear to be owned by the current user.

This version of the patch differs from previous versions however in that
the admin can still force the ownership of all files to appear as a
single user via the uid=/gid= options.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/inode.c

index df29a3a3d80c052e37eec550b1cbfa6e8c5e78f0..7e5b8c39a07a182185733f4abe32d7ff6c502b7e 100644 (file)
@@ -1755,11 +1755,21 @@ check_inval:
 int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
        struct kstat *stat)
 {
+       struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb);
+       struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb);
        int err = cifs_revalidate_dentry(dentry);
+
        if (!err) {
                generic_fillattr(dentry->d_inode, stat);
                stat->blksize = CIFS_MAX_MSGSIZE;
                stat->ino = CIFS_I(dentry->d_inode)->uniqueid;
+               if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) &&
+                   !tcon->unix_ext) {
+                       if (!cifs_sb->mnt_uid)
+                               stat->uid = current_fsuid();
+                       if (!cifs_sb->mnt_uid)
+                               stat->gid = current_fsgid();
+               }
        }
        return err;
 }