Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[pandora-kernel.git] / fs / cifs / readdir.c
index 03bbcb3..b27b345 100644 (file)
@@ -82,7 +82,6 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
                        if(*ptmp_inode == NULL)
                                return rc;
                        rc = 1;
-                       d_instantiate(tmp_dentry, *ptmp_inode);
                }
        } else {
                tmp_dentry = d_alloc(file->f_dentry, qstring);
@@ -99,9 +98,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
                        tmp_dentry->d_op = &cifs_dentry_ops;
                if(*ptmp_inode == NULL)
                        return rc;
-               rc = 1;
-               d_instantiate(tmp_dentry, *ptmp_inode);
-               d_rehash(tmp_dentry);
+               rc = 2;
        }
 
        tmp_dentry->d_time = jiffies;
@@ -219,10 +216,9 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
 
        if (allocation_size < end_of_file)
                cFYI(1, ("May be sparse file, allocation less than file size"));
-       cFYI(1, ("File Size %ld and blocks %llu and blocksize %ld",
+       cFYI(1, ("File Size %ld and blocks %llu",
                (unsigned long)tmp_inode->i_size,
-               (unsigned long long)tmp_inode->i_blocks,
-               tmp_inode->i_blksize));
+               (unsigned long long)tmp_inode->i_blocks));
        if (S_ISREG(tmp_inode->i_mode)) {
                cFYI(1, ("File inode"));
                tmp_inode->i_op = &cifs_file_inode_ops;
@@ -556,7 +552,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
                FIND_FILE_STANDARD_INFO * pFindData =
                        (FIND_FILE_STANDARD_INFO *)current_entry;
                filename = &pFindData->FileName[0];
-               len = le32_to_cpu(pFindData->FileNameLength);
+               len = pFindData->FileNameLength;
        } else {
                cFYI(1,("Unknown findfirst level %d",cfile->srch_inf.info_level));
        }
@@ -870,6 +866,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
                                pfindEntry, &obj_type, rc);
        else
                fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc);
+
+       if(rc) /* new inode - needs to be tied to dentry */ {
+               d_instantiate(tmp_dentry, tmp_inode);
+               if(rc == 2)
+                       d_rehash(tmp_dentry);
+       }
        
        
        rc = filldir(direntry,qstring.name,qstring.len,file->f_pos,