- Update to 2.6.25-rc3.
[linux-flexiantxendom0-3.2.10.git] / fs / cifs / inode.c
index e915eb1..b1a4a65 100644 (file)
@@ -54,9 +54,9 @@ int cifs_get_inode_info_unix(struct inode **pinode,
                                            MAX_TREE_SIZE + 1) +
                                    strnlen(search_path, MAX_PATHCONF) + 1,
                                    GFP_KERNEL);
-                       if (tmp_path == NULL) {
+                       if (tmp_path == NULL)
                                return -ENOMEM;
-                       }
+
                        /* have to skip first of the double backslash of
                           UNC name */
                        strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE);
@@ -511,7 +511,8 @@ int cifs_get_inode_info(struct inode **pinode,
                }
 
                spin_lock(&inode->i_lock);
-               if (is_size_safe_to_change(cifsInfo, le64_to_cpu(pfindData->EndOfFile))) {
+               if (is_size_safe_to_change(cifsInfo,
+                                          le64_to_cpu(pfindData->EndOfFile))) {
                        /* can not safely shrink the file size here if the
                           client is writing to it due to potential races */
                        i_size_write(inode, le64_to_cpu(pfindData->EndOfFile));
@@ -585,10 +586,18 @@ static const struct inode_operations cifs_ipc_inode_ops = {
 };
 
 /* gets root inode */
-void cifs_read_inode(struct inode *inode)
+struct inode *cifs_iget(struct super_block *sb, unsigned long ino)
 {
-       int xid, rc;
+       int xid;
        struct cifs_sb_info *cifs_sb;
+       struct inode *inode;
+       long rc;
+
+       inode = iget_locked(sb, ino);
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
+       if (!(inode->i_state & I_NEW))
+               return inode;
 
        cifs_sb = CIFS_SB(inode->i_sb);
        xid = GetXid();
@@ -605,10 +614,18 @@ void cifs_read_inode(struct inode *inode)
                inode->i_fop = &simple_dir_operations;
                inode->i_uid = cifs_sb->mnt_uid;
                inode->i_gid = cifs_sb->mnt_gid;
+               _FreeXid(xid);
+               iget_failed(inode);
+               return ERR_PTR(rc);
        }
 
-       /* can not call macro FreeXid here since in a void func */
+       unlock_new_inode(inode);
+
+       /* can not call macro FreeXid here since in a void func
+        * TODO: This is no longer true
+        */
        _FreeXid(xid);
+       return inode;
 }
 
 int cifs_unlink(struct inode *inode, struct dentry *direntry)
@@ -931,7 +948,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
                (CIFS_UNIX_POSIX_PATH_OPS_CAP &
                        le64_to_cpu(pTcon->fsUnixInfo.Capability))) {
                u32 oplock = 0;
-               FILE_UNIX_BASIC_INFO * pInfo =
+               FILE_UNIX_BASIC_INFO *pInfo =
                        kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL);
                if (pInfo == NULL) {
                        rc = -ENOMEM;
@@ -1385,7 +1402,7 @@ static int cifs_truncate_page(struct address_space *mapping, loff_t from)
        if (!page)
                return -ENOMEM;
 
-       zero_user_page(page, offset, PAGE_CACHE_SIZE - offset, KM_USER0);
+       zero_user_segment(page, offset, PAGE_CACHE_SIZE);
        unlock_page(page);
        page_cache_release(page);
        return rc;
@@ -1607,7 +1624,14 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
        else if (attrs->ia_valid & ATTR_MODE) {
                rc = 0;
-               if ((mode & S_IWUGO) == 0) /* not writeable */ {
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
+                       rc = mode_to_acl(direntry->d_inode, full_path, mode);
+               else if ((mode & S_IWUGO) == 0) {
+#else
+               if ((mode & S_IWUGO) == 0) {
+#endif
+                       /* not writeable */
                        if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
                                set_dosattr = TRUE;
                                time_buf.Attributes =
@@ -1626,10 +1650,10 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
                        if (time_buf.Attributes == 0)
                                time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL);
                }
-               /* BB to be implemented -
-                  via Windows security descriptors or streams */
-               /* CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, uid, gid,
-                                     cifs_sb->local_nls); */
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
+                       mode_to_acl(direntry->d_inode, full_path, mode);
+#endif
        }
 
        if (attrs->ia_valid & ATTR_ATIME) {