]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
CIFS: reset mode when client notices that ATTR_READONLY is no longer set
authorAlan Tyson <atyson@hp.com>
Wed, 28 Mar 2007 21:40:35 +0000 (17:40 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Apr 2007 10:43:17 +0000 (03:43 -0700)
[CIFS] reset mode when client notices that ATTR_READONLY is no longer set

[<cebbert@redhat.com>: removed changelog part of patch]

Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Alan Tyso <atyson@hp.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/inode.c
fs/cifs/readdir.c

index 79bed901f709f84337bee99ef28e85b8b1db1f96..a894e6d8472f8eba43496f5a72cdb9f29b3aac55 100644 (file)
@@ -488,6 +488,12 @@ int cifs_get_inode_info(struct inode **pinode,
                           mode e.g. 555 */
                        if (cifsInfo->cifsAttrs & ATTR_READONLY)
                                inode->i_mode &= ~(S_IWUGO);
+                       else if ((inode->i_mode & S_IWUGO) == 0)
+                               /* the ATTR_READONLY flag may have been */
+                               /* changed on server -- set any w bits  */
+                               /* allowed by mnt_file_mode             */
+                               inode->i_mode |= (S_IWUGO &
+                                                 cifs_sb->mnt_file_mode);
                /* BB add code here -
                   validate if device or weird share or device type? */
                }
index 99dfb5337e3169d8e38cf062a509326694b24a0d..d1d79fe3c86feb287d353da64814a799813ea1d2 100644 (file)
@@ -215,6 +215,10 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
                tmp_inode->i_mode |= S_IFREG;
                if (attr & ATTR_READONLY)
                        tmp_inode->i_mode &= ~(S_IWUGO);
+               else if ((tmp_inode->i_mode & S_IWUGO) == 0)
+                       /* the ATTR_READONLY flag may have been changed on   */
+                       /* server -- set any w bits allowed by mnt_file_mode */
+                       tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode);
        } /* could add code here - to validate if device or weird share type? */
 
        /* can not fill in nlink here as in qpathinfo version and Unx search */