cifs: ensure we revalidate the inode after readdir if cifsacl is enabled
authorJeff Layton <jlayton@redhat.com>
Sun, 25 Nov 2012 13:00:40 +0000 (08:00 -0500)
committerSteve French <smfrench@gmail.com>
Wed, 5 Dec 2012 19:27:30 +0000 (13:27 -0600)
Otherwise, "ls -l" will simply show the ownership of the files as
the default mnt_uid/gid. This may make "ls -l" performance on large
directories super-suck in some cases, but that's the cost of cifsacl.

One possibility to make it suck less would be to somehow proactively
dispatch the ACL requests asynchronously from readdir codepath, but
that's non-trivial to implement.

Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/readdir.c

index 1c576e8713669534be76853aa6c45e97482def96..64920920d908fb4929c83c391cc73045f7fe7249 100644 (file)
@@ -137,6 +137,16 @@ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb)
        if (fattr->cf_cifsattrs & ATTR_READONLY)
                fattr->cf_mode &= ~S_IWUGO;
 
+       /*
+        * We of course don't get ACL info in FIND_FIRST/NEXT results, so
+        * mark it for revalidation so that "ls -l" will look right. It might
+        * be super-slow, but if we don't do this then the ownership of files
+        * may look wrong since the inodes may not have timed out by the time
+        * "ls" does a stat() call on them.
+        */
+       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
+               fattr->cf_flags |= CIFS_FATTR_NEED_REVAL;
+
        if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL &&
            fattr->cf_cifsattrs & ATTR_SYSTEM) {
                if (fattr->cf_eof == 0)  {