summaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-04-25 15:46:06 +0400
committerSteve French <sfrench@us.ibm.com>2007-04-25 15:46:06 +0400
commitcbac3cba66ab51492da53e7bf4f38da872408065 (patch)
tree4f6531413c4063a879b96fb4e89805f5ac982773 /fs/cifs
parent2dd29d3133ad4c7926ea03b8431e604373c4ad65 (diff)
downloadlinux-cbac3cba66ab51492da53e7bf4f38da872408065.tar.xz
[CIFS] New CIFS POSIX mkdir performance improvement (part 2)
Fix incorrect parsing of return data Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifssmb.c11
-rw-r--r--fs/cifs/inode.c43
2 files changed, 39 insertions, 15 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index a7d3d8e5c6c5..14de58fa1437 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1008,9 +1008,12 @@ PsxCreat:
if(cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction)
*pOplock |= CIFS_CREATE_ACTION;
/* check to make sure response data is there */
- if(psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC)
- pRetData->Type = -1; /* unknown */
- else {
+ if(psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC) {
+ pRetData->Type = -1; /* unknown */
+#ifdef CONFIG_CIFS_DEBUG2
+ cFYI(1,("unknown type"));
+#endif
+ } else {
if(pSMBr->ByteCount < sizeof(OPEN_PSX_RSP)
+ sizeof(FILE_UNIX_BASIC_INFO)) {
cERROR(1,("Open response data too small"));
@@ -1018,7 +1021,7 @@ PsxCreat:
goto psx_create_err;
}
memcpy((char *) pRetData,
- (char *)&psx_rsp + sizeof(OPEN_PSX_RSP),
+ (char *)psx_rsp + sizeof(OPEN_PSX_RSP),
sizeof (FILE_UNIX_BASIC_INFO));
}
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 9b7e0dbdd826..f74f37cee119 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -796,6 +796,9 @@ static void posix_fill_in_inode(struct inode *tmp_inode,
cFYI(1,("unknown inode type %d",type));
}
+#ifdef CONFIG_CIFS_DEBUG2
+ cFYI(1,("object type: %d", type));
+#endif
tmp_inode->i_uid = le64_to_cpu(pData->Uid);
tmp_inode->i_gid = le64_to_cpu(pData->Gid);
tmp_inode->i_nlink = le64_to_cpu(pData->Nlinks);
@@ -903,6 +906,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
cFYI(1, ("posix mkdir returned 0x%x", rc));
d_drop(direntry);
} else {
+ int obj_type;
if (pInfo->Type == -1) /* no return info - go query */
goto mkdir_get_info;
/*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need to set uid/gid */
@@ -911,19 +915,36 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
direntry->d_op = &cifs_ci_dentry_ops;
else
direntry->d_op = &cifs_dentry_ops;
+
+ newinode = new_inode(inode->i_sb);
+ if (newinode == NULL)
+ goto mkdir_get_info;
+ /* 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) {
+ newinode->i_ino =
+ (unsigned long)pInfo->UniqueId;
+ } /* note ino incremented to unique num in new_inode */
+ if(inode->i_sb->s_flags & MS_NOATIME)
+ newinode->i_flags |= S_NOATIME | S_NOCMTIME;
+ newinode->i_nlink = 2;
+
+ insert_inode_hash(newinode);
d_instantiate(direntry, newinode);
- if (direntry->d_inode) {
- int obj_type;
- direntry->d_inode->i_nlink = 2;
- /* already checked in POSIXCreate whether
- frame was long enough */
- posix_fill_in_inode(direntry->d_inode,
+
+ /* we already checked in POSIXCreate whether
+ frame was long enough */
+ posix_fill_in_inode(direntry->d_inode,
pInfo, &obj_type, 1 /* NewInode */);
- /* could double check that we actually
- * created what we thought we did ie
- * a directory
- */
- }
+#ifdef CONFIG_CIFS_DEBUG2
+ cFYI(1,("instantiated dentry %p %s to inode %p",
+ direntry, direntry->d_name.name, newinode));
+
+ if(newinode->i_nlink != 2)
+ cFYI(1,("unexpected number of links %d",
+ newinode->i_nlink));
+#endif
}
kfree(pInfo);
goto mkdir_out;