]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/cifs/inode.c
[CIFS] Missing line from previous patch
[linux-2.6-omap-h63xx.git] / fs / cifs / inode.c
index b8b78cbb34c97f304a1b5ac9f03b773f7d1073f5..34f0168c4041ddc156068a44c366410172815794 100644 (file)
@@ -82,12 +82,12 @@ int cifs_get_inode_info_unix(struct inode **pinode,
                /* get new inode */
                if (*pinode == NULL) {
                        *pinode = new_inode(sb);
-                       if(*pinode == NULL) 
+                       if (*pinode == NULL) 
                                return -ENOMEM;
                        /* Is an i_ino of zero legal? */
                        /* Are there sanity checks we can use to ensure that
                           the server is really filling in that field? */
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
                                (*pinode)->i_ino =
                                        (unsigned long)findData.UniqueId;
                        } /* note ino incremented to unique num in new_inode */
@@ -134,7 +134,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
                inode->i_gid = le64_to_cpu(findData.Gid);
                inode->i_nlink = le64_to_cpu(findData.Nlinks);
 
-               if(is_size_safe_to_change(cifsInfo)) {
+               if (is_size_safe_to_change(cifsInfo)) {
                /* can not safely change the file size here if the
                   client is writing to it due to potential races */
 
@@ -162,10 +162,12 @@ int cifs_get_inode_info_unix(struct inode **pinode,
                if (S_ISREG(inode->i_mode)) {
                        cFYI(1, (" File inode "));
                        inode->i_op = &cifs_file_inode_ops;
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
                                inode->i_fop = &cifs_file_direct_ops;
                        else
                                inode->i_fop = &cifs_file_ops;
+                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                               inode->i_fop->lock = NULL;
                        inode->i_data.a_ops = &cifs_addr_ops;
                } else if (S_ISDIR(inode->i_mode)) {
                        cFYI(1, (" Directory inode"));
@@ -198,23 +200,33 @@ int cifs_get_inode_info(struct inode **pinode,
        pTcon = cifs_sb->tcon;
        cFYI(1,("Getting info on %s ", search_path));
 
-       if((pfindData == NULL) && (*pinode != NULL)) {
-               if(CIFS_I(*pinode)->clientCanCacheRead) {
+       if ((pfindData == NULL) && (*pinode != NULL)) {
+               if (CIFS_I(*pinode)->clientCanCacheRead) {
                        cFYI(1,("No need to revalidate cached inode sizes"));
                        return rc;
                }
        }
 
        /* if file info not passed in then get it from server */
-       if(pfindData == NULL) {
+       if (pfindData == NULL) {
                buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
-               if(buf == NULL)
+               if (buf == NULL)
                        return -ENOMEM;
                pfindData = (FILE_ALL_INFO *)buf;
                /* could do find first instead but this returns more info */
                rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData,
-                             cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & 
+                             cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
                                CIFS_MOUNT_MAP_SPECIAL_CHR);
+               /* BB optimize code so we do not make the above call
+               when server claims no NT SMB support and the above call
+               failed at least once - set flag in tcon or mount */
+               if((rc == -EOPNOTSUPP) || (rc == -EINVAL)) {
+                       rc = SMBQueryInformation(xid, pTcon, search_path,
+                                       pfindData, cifs_sb->local_nls, 
+                                       cifs_sb->mnt_cifs_flags &
+                                         CIFS_MOUNT_MAP_SPECIAL_CHR);
+               }
+               
        }
        /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */
        if (rc) {
@@ -268,7 +280,7 @@ int cifs_get_inode_info(struct inode **pinode,
                           IndexNumber field is not guaranteed unique? */
 
 #ifdef CONFIG_CIFS_EXPERIMENTAL                
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM){
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM){
                                int rc1 = 0;
                                __u64 inode_num;
 
@@ -277,7 +289,7 @@ int cifs_get_inode_info(struct inode **pinode,
                                        cifs_sb->local_nls,
                                        cifs_sb->mnt_cifs_flags &
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
-                               if(rc1) {
+                               if (rc1) {
                                        cFYI(1,("GetSrvInodeNum rc %d", rc1));
                                        /* BB EOPNOSUPP disable SERVER_INUM? */
                                } else /* do we need cast or hash to ino? */
@@ -320,6 +332,16 @@ int cifs_get_inode_info(struct inode **pinode,
                   on dirs */
                        inode->i_mode = cifs_sb->mnt_dir_mode;
                        inode->i_mode |= S_IFDIR;
+               } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
+                          (cifsInfo->cifsAttrs & ATTR_SYSTEM) &&
+                          /* No need to le64 convert size of zero */
+                          (pfindData->EndOfFile == 0)) {
+                       inode->i_mode = cifs_sb->mnt_file_mode;
+                       inode->i_mode |= S_IFIFO;
+/* BB Finish for SFU style symlinks and devies */
+/*             } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
+                          (cifsInfo->cifsAttrs & ATTR_SYSTEM) && ) */
+
                } else {
                        inode->i_mode |= S_IFREG;
                        /* treat the dos attribute of read-only as read-only
@@ -355,10 +377,12 @@ int cifs_get_inode_info(struct inode **pinode,
                if (S_ISREG(inode->i_mode)) {
                        cFYI(1, (" File inode "));
                        inode->i_op = &cifs_file_inode_ops;
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
                                inode->i_fop = &cifs_file_direct_ops;
                        else
                                inode->i_fop = &cifs_file_ops;
+                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+                               inode->i_fop->lock = NULL;
                        inode->i_data.a_ops = &cifs_addr_ops;
                } else if (S_ISDIR(inode->i_mode)) {
                        cFYI(1, (" Directory inode "));
@@ -412,7 +436,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
        /* Unlink can be called from rename so we can not grab the sem here
           since we deadlock otherwise */
 /*     down(&direntry->d_sb->s_vfs_rename_sem);*/
-       full_path = build_path_from_dentry(direntry);
+       full_path = build_path_from_dentry(direntry, cifs_sb);
 /*     up(&direntry->d_sb->s_vfs_rename_sem);*/
        if (full_path == NULL) {
                FreeXid(xid);
@@ -422,7 +446,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
                        cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
 
        if (!rc) {
-               if(direntry->d_inode)
+               if (direntry->d_inode)
                        direntry->d_inode->i_nlink--;
        } else if (rc == -ENOENT) {
                d_drop(direntry);
@@ -441,7 +465,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
                                              cifs_sb->mnt_cifs_flags & 
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        CIFSSMBClose(xid, pTcon, netfid);
-                       if(direntry->d_inode)
+                       if (direntry->d_inode)
                                direntry->d_inode->i_nlink--;
                }
        } else if (rc == -EACCES) {
@@ -496,7 +520,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
                                            cifs_sb->mnt_cifs_flags & 
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        if (!rc) {
-                               if(direntry->d_inode)
+                               if (direntry->d_inode)
                                        direntry->d_inode->i_nlink--;
                        } else if (rc == -ETXTBSY) {
                                int oplock = FALSE;
@@ -517,14 +541,14 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
                                                cifs_sb->mnt_cifs_flags &
                                                    CIFS_MOUNT_MAP_SPECIAL_CHR);
                                        CIFSSMBClose(xid, pTcon, netfid);
-                                       if(direntry->d_inode)
+                                       if (direntry->d_inode)
                                                direntry->d_inode->i_nlink--;
                                }
                        /* BB if rc = -ETXTBUSY goto the rename logic BB */
                        }
                }
        }
-       if(direntry->d_inode) {
+       if (direntry->d_inode) {
                cifsInode = CIFS_I(direntry->d_inode);
                cifsInode->time = 0;    /* will force revalidate to get info
                                           when needed */
@@ -556,7 +580,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
        pTcon = cifs_sb->tcon;
 
        down(&inode->i_sb->s_vfs_rename_sem);
-       full_path = build_path_from_dentry(direntry);
+       full_path = build_path_from_dentry(direntry, cifs_sb);
        up(&inode->i_sb->s_vfs_rename_sem);
        if (full_path == NULL) {
                FreeXid(xid);
@@ -577,12 +601,15 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
                        rc = cifs_get_inode_info(&newinode, full_path, NULL,
                                                 inode->i_sb,xid);
 
-               direntry->d_op = &cifs_dentry_ops;
+               if (pTcon->nocase)
+                       direntry->d_op = &cifs_ci_dentry_ops;
+               else
+                       direntry->d_op = &cifs_dentry_ops;
                d_instantiate(direntry, newinode);
                if (direntry->d_inode)
                        direntry->d_inode->i_nlink = 2;
                if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
-                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
                                CIFSSMBUnixSetPerms(xid, pTcon, full_path,
                                                    mode,
                                                    (__u64)current->euid,
@@ -627,7 +654,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
        pTcon = cifs_sb->tcon;
 
        down(&inode->i_sb->s_vfs_rename_sem);
-       full_path = build_path_from_dentry(direntry);
+       full_path = build_path_from_dentry(direntry, cifs_sb);
        up(&inode->i_sb->s_vfs_rename_sem);
        if (full_path == NULL) {
                FreeXid(xid);
@@ -680,8 +707,8 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
 
        /* we already  have the rename sem so we do not need to grab it again
           here to protect the path integrity */
-       fromName = build_path_from_dentry(source_direntry);
-       toName = build_path_from_dentry(target_direntry);
+       fromName = build_path_from_dentry(source_direntry, cifs_sb_source);
+       toName = build_path_from_dentry(target_direntry, cifs_sb_target);
        if ((fromName == NULL) || (toName == NULL)) {
                rc = -ENOMEM;
                goto cifs_rename_exit;
@@ -797,7 +824,7 @@ int cifs_revalidate(struct dentry *direntry)
 
        /* can not safely grab the rename sem here if rename calls revalidate
           since that would deadlock */
-       full_path = build_path_from_dentry(direntry);
+       full_path = build_path_from_dentry(direntry, cifs_sb);
        if (full_path == NULL) {
                FreeXid(xid);
                return -ENOMEM;
@@ -946,7 +973,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
        pTcon = cifs_sb->tcon;
 
        down(&direntry->d_sb->s_vfs_rename_sem);
-       full_path = build_path_from_dentry(direntry);
+       full_path = build_path_from_dentry(direntry, cifs_sb);
        up(&direntry->d_sb->s_vfs_rename_sem);
        if (full_path == NULL) {
                FreeXid(xid);