aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-04-25 07:46:06 -0400
committerSteve French <sfrench@us.ibm.com>2007-04-25 07:46:06 -0400
commitcbac3cba66ab51492da53e7bf4f38da872408065 (patch)
tree4f6531413c4063a879b96fb4e89805f5ac982773 /fs/cifs
parent2dd29d3133ad4c7926ea03b8431e604373c4ad65 (diff)
[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:
1008 if(cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction) 1008 if(cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction)
1009 *pOplock |= CIFS_CREATE_ACTION; 1009 *pOplock |= CIFS_CREATE_ACTION;
1010 /* check to make sure response data is there */ 1010 /* check to make sure response data is there */
1011 if(psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC) 1011 if(psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC) {
1012 pRetData->Type = -1; /* unknown */ 1012 pRetData->Type = -1; /* unknown */
1013 else { 1013#ifdef CONFIG_CIFS_DEBUG2
1014 cFYI(1,("unknown type"));
1015#endif
1016 } else {
1014 if(pSMBr->ByteCount < sizeof(OPEN_PSX_RSP) 1017 if(pSMBr->ByteCount < sizeof(OPEN_PSX_RSP)
1015 + sizeof(FILE_UNIX_BASIC_INFO)) { 1018 + sizeof(FILE_UNIX_BASIC_INFO)) {
1016 cERROR(1,("Open response data too small")); 1019 cERROR(1,("Open response data too small"));
@@ -1018,7 +1021,7 @@ PsxCreat:
1018 goto psx_create_err; 1021 goto psx_create_err;
1019 } 1022 }
1020 memcpy((char *) pRetData, 1023 memcpy((char *) pRetData,
1021 (char *)&psx_rsp + sizeof(OPEN_PSX_RSP), 1024 (char *)psx_rsp + sizeof(OPEN_PSX_RSP),
1022 sizeof (FILE_UNIX_BASIC_INFO)); 1025 sizeof (FILE_UNIX_BASIC_INFO));
1023 } 1026 }
1024 1027
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,
796 cFYI(1,("unknown inode type %d",type)); 796 cFYI(1,("unknown inode type %d",type));
797 } 797 }
798 798
799#ifdef CONFIG_CIFS_DEBUG2
800 cFYI(1,("object type: %d", type));
801#endif
799 tmp_inode->i_uid = le64_to_cpu(pData->Uid); 802 tmp_inode->i_uid = le64_to_cpu(pData->Uid);
800 tmp_inode->i_gid = le64_to_cpu(pData->Gid); 803 tmp_inode->i_gid = le64_to_cpu(pData->Gid);
801 tmp_inode->i_nlink = le64_to_cpu(pData->Nlinks); 804 tmp_inode->i_nlink = le64_to_cpu(pData->Nlinks);
@@ -903,6 +906,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
903 cFYI(1, ("posix mkdir returned 0x%x", rc)); 906 cFYI(1, ("posix mkdir returned 0x%x", rc));
904 d_drop(direntry); 907 d_drop(direntry);
905 } else { 908 } else {
909 int obj_type;
906 if (pInfo->Type == -1) /* no return info - go query */ 910 if (pInfo->Type == -1) /* no return info - go query */
907 goto mkdir_get_info; 911 goto mkdir_get_info;
908/*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need to set uid/gid */ 912/*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)
911 direntry->d_op = &cifs_ci_dentry_ops; 915 direntry->d_op = &cifs_ci_dentry_ops;
912 else 916 else
913 direntry->d_op = &cifs_dentry_ops; 917 direntry->d_op = &cifs_dentry_ops;
918
919 newinode = new_inode(inode->i_sb);
920 if (newinode == NULL)
921 goto mkdir_get_info;
922 /* Is an i_ino of zero legal? */
923 /* Are there sanity checks we can use to ensure that
924 the server is really filling in that field? */
925 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
926 newinode->i_ino =
927 (unsigned long)pInfo->UniqueId;
928 } /* note ino incremented to unique num in new_inode */
929 if(inode->i_sb->s_flags & MS_NOATIME)
930 newinode->i_flags |= S_NOATIME | S_NOCMTIME;
931 newinode->i_nlink = 2;
932
933 insert_inode_hash(newinode);
914 d_instantiate(direntry, newinode); 934 d_instantiate(direntry, newinode);
915 if (direntry->d_inode) { 935
916 int obj_type; 936 /* we already checked in POSIXCreate whether
917 direntry->d_inode->i_nlink = 2; 937 frame was long enough */
918 /* already checked in POSIXCreate whether 938 posix_fill_in_inode(direntry->d_inode,
919 frame was long enough */
920 posix_fill_in_inode(direntry->d_inode,
921 pInfo, &obj_type, 1 /* NewInode */); 939 pInfo, &obj_type, 1 /* NewInode */);
922 /* could double check that we actually 940#ifdef CONFIG_CIFS_DEBUG2
923 * created what we thought we did ie 941 cFYI(1,("instantiated dentry %p %s to inode %p",
924 * a directory 942 direntry, direntry->d_name.name, newinode));
925 */ 943
926 } 944 if(newinode->i_nlink != 2)
945 cFYI(1,("unexpected number of links %d",
946 newinode->i_nlink));
947#endif
927 } 948 }
928 kfree(pInfo); 949 kfree(pInfo);
929 goto mkdir_out; 950 goto mkdir_out;