]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/cifs/dir.c
Merge branch 'stable/cleanups-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / fs / cifs / dir.c
index 72d448bf96ce57d8f6ed770277da46a3e3d7ace4..d7eeb9d3ed6feae9a8c25f9e71d7822efba3e488 100644 (file)
@@ -171,7 +171,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        }
        tcon = tlink_tcon(tlink);
 
-       if (oplockEnabled)
+       if (enable_oplocks)
                oplock = REQ_OPLOCK;
 
        if (nd)
@@ -244,6 +244,9 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
                create_options |= CREATE_OPTION_READONLY;
 
+       if (backup_cred(cifs_sb))
+               create_options |= CREATE_OPEN_BACKUP_INTENT;
+
        if (tcon->ses->capabilities & CAP_NT_SMBS)
                rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
                         desiredAccess, create_options,
@@ -357,6 +360,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
 {
        int rc = -EPERM;
        int xid;
+       int create_options = CREATE_NOT_DIR | CREATE_OPTION_SPECIAL;
        struct cifs_sb_info *cifs_sb;
        struct tcon_link *tlink;
        struct cifs_tcon *pTcon;
@@ -431,9 +435,11 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
                return rc;
        }
 
-       /* FIXME: would WRITE_OWNER | WRITE_DAC be better? */
+       if (backup_cred(cifs_sb))
+               create_options |= CREATE_OPEN_BACKUP_INTENT;
+
        rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_CREATE,
-                        GENERIC_WRITE, CREATE_NOT_DIR | CREATE_OPTION_SPECIAL,
+                        GENERIC_WRITE, create_options,
                         &fileHandle, &oplock, buf, cifs_sb->local_nls,
                         cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
        if (rc)
@@ -642,8 +648,16 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
        if (direntry->d_inode) {
                if (cifs_revalidate_dentry(direntry))
                        return 0;
-               else
+               else {
+                       /*
+                        * Forcibly invalidate automounting directory inodes
+                        * (remote DFS directories) so to have them
+                        * instantiated again for automount
+                        */
+                       if (IS_AUTOMOUNT(direntry->d_inode))
+                               return 0;
                        return 1;
+               }
        }
 
        /*