aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2009-04-01 01:22:00 -0400
committerSteve French <sfrench@us.ibm.com>2009-04-16 21:26:48 -0400
commit85a6dac54a7e28112488b02523202985edc7e639 (patch)
tree141a35196516dc428fe2891b7c7da02d0133ecad /fs
parent74496d365ad171d11f21da4a8be71c945f6ec825 (diff)
[CIFS] Endian convert UniqueId when reporting inode numbers from server files
Jeff made a good point that we should endian convert the UniqueId when we use it to set i_ino Even though this value is opaque to the client, when comparing the inode numbers of the same server file from two different clients (one big endian, one little endian) or when we compare a big endian client's view of i_ino with what the server thinks - we should get the same value Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/CHANGES3
-rw-r--r--fs/cifs/cifspdu.h8
-rw-r--r--fs/cifs/cifssmb.c2
-rw-r--r--fs/cifs/dir.c6
-rw-r--r--fs/cifs/inode.c8
-rw-r--r--fs/cifs/readdir.c4
6 files changed, 18 insertions, 13 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 65984006192c..9d1fb6ec8a5a 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -15,7 +15,8 @@ Posix file open support added (turned off after one attempt if server
15fails to support it properly, as with Samba server versions prior to 3.3.2) 15fails to support it properly, as with Samba server versions prior to 3.3.2)
16Fix "redzone overwritten" bug in cifs_put_tcon (CIFSTcon may allocate too 16Fix "redzone overwritten" bug in cifs_put_tcon (CIFSTcon may allocate too
17little memory for the "nativeFileSystem" field returned by the server 17little memory for the "nativeFileSystem" field returned by the server
18during mount). 18during mount). Endian convert inode numbers if necessary (makes it easier
19to compare inode numbers on network files from big endian systems).
19 20
20Version 1.56 21Version 1.56
21------------ 22------------
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index b370489c8da5..a785f69dbc9f 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -2163,7 +2163,7 @@ typedef struct {
2163 __le32 Type; 2163 __le32 Type;
2164 __le64 DevMajor; 2164 __le64 DevMajor;
2165 __le64 DevMinor; 2165 __le64 DevMinor;
2166 __u64 UniqueId; 2166 __le64 UniqueId;
2167 __le64 Permissions; 2167 __le64 Permissions;
2168 __le64 Nlinks; 2168 __le64 Nlinks;
2169} __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */ 2169} __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */
@@ -2308,7 +2308,7 @@ struct unlink_psx_rq { /* level 0x20a SetPathInfo */
2308} __attribute__((packed)); 2308} __attribute__((packed));
2309 2309
2310struct file_internal_info { 2310struct file_internal_info {
2311 __u64 UniqueId; /* inode number */ 2311 __le64 UniqueId; /* inode number */
2312} __attribute__((packed)); /* level 0x3ee */ 2312} __attribute__((packed)); /* level 0x3ee */
2313 2313
2314struct file_mode_info { 2314struct file_mode_info {
@@ -2338,7 +2338,7 @@ typedef struct {
2338 __le32 Type; 2338 __le32 Type;
2339 __le64 DevMajor; 2339 __le64 DevMajor;
2340 __le64 DevMinor; 2340 __le64 DevMinor;
2341 __u64 UniqueId; 2341 __le64 UniqueId;
2342 __le64 Permissions; 2342 __le64 Permissions;
2343 __le64 Nlinks; 2343 __le64 Nlinks;
2344 char FileName[1]; 2344 char FileName[1];
@@ -2386,7 +2386,7 @@ typedef struct {
2386 __le32 FileNameLength; 2386 __le32 FileNameLength;
2387 __le32 EaSize; /* EA size */ 2387 __le32 EaSize; /* EA size */
2388 __le32 Reserved; 2388 __le32 Reserved;
2389 __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/ 2389 __le64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
2390 char FileName[1]; 2390 char FileName[1];
2391} __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */ 2391} __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */
2392 2392
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index bc09c998631f..3f36b1ea03c9 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3918,7 +3918,7 @@ GetInodeNumberRetry:
3918 } 3918 }
3919 pfinfo = (struct file_internal_info *) 3919 pfinfo = (struct file_internal_info *)
3920 (data_offset + (char *) &pSMBr->hdr.Protocol); 3920 (data_offset + (char *) &pSMBr->hdr.Protocol);
3921 *inode_number = pfinfo->UniqueId; 3921 *inode_number = le64_to_cpu(pfinfo->UniqueId);
3922 } 3922 }
3923 } 3923 }
3924GetInodeNumOut: 3924GetInodeNumOut:
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 54dce78fbb73..e457e1434349 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -187,8 +187,10 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
187 if (!pinode) 187 if (!pinode)
188 goto posix_open_ret; /* caller does not need info */ 188 goto posix_open_ret; /* caller does not need info */
189 189
190 if (*pinode == NULL) 190 if (*pinode == NULL) {
191 *pinode = cifs_new_inode(sb, &presp_data->UniqueId); 191 __u64 unique_id = le64_to_cpu(presp_data->UniqueId);
192 *pinode = cifs_new_inode(sb, &unique_id);
193 }
192 /* else an inode was passed in. Update its info, don't create one */ 194 /* else an inode was passed in. Update its info, don't create one */
193 195
194 /* We do not need to close the file if new_inode fails since 196 /* We do not need to close the file if new_inode fails since
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 89063f1eb55b..fceebee39f27 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -276,7 +276,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
276 276
277 /* get new inode */ 277 /* get new inode */
278 if (*pinode == NULL) { 278 if (*pinode == NULL) {
279 *pinode = cifs_new_inode(sb, &find_data.UniqueId); 279 __u64 unique_id = le64_to_cpu(find_data.UniqueId);
280 *pinode = cifs_new_inode(sb, &unique_id);
280 if (*pinode == NULL) { 281 if (*pinode == NULL) {
281 rc = -ENOMEM; 282 rc = -ENOMEM;
282 goto cgiiu_exit; 283 goto cgiiu_exit;
@@ -1138,6 +1139,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1138 cFYI(1, ("posix mkdir returned 0x%x", rc)); 1139 cFYI(1, ("posix mkdir returned 0x%x", rc));
1139 d_drop(direntry); 1140 d_drop(direntry);
1140 } else { 1141 } else {
1142 __u64 unique_id;
1141 if (pInfo->Type == cpu_to_le32(-1)) { 1143 if (pInfo->Type == cpu_to_le32(-1)) {
1142 /* no return info, go query for it */ 1144 /* no return info, go query for it */
1143 kfree(pInfo); 1145 kfree(pInfo);
@@ -1151,8 +1153,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
1151 else 1153 else
1152 direntry->d_op = &cifs_dentry_ops; 1154 direntry->d_op = &cifs_dentry_ops;
1153 1155
1154 newinode = cifs_new_inode(inode->i_sb, 1156 unique_id = le64_to_cpu(pInfo->UniqueId);
1155 &pInfo->UniqueId); 1157 newinode = cifs_new_inode(inode->i_sb, &unique_id);
1156 if (newinode == NULL) { 1158 if (newinode == NULL) {
1157 kfree(pInfo); 1159 kfree(pInfo);
1158 goto mkdir_get_info; 1160 goto mkdir_get_info;
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index c2c01ff4c32c..c3c3e6286af5 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -840,7 +840,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
840 len = strnlen(filename, PATH_MAX); 840 len = strnlen(filename, PATH_MAX);
841 } 841 }
842 842
843 *pinum = pFindData->UniqueId; 843 *pinum = le64_to_cpu(pFindData->UniqueId);
844 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { 844 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
845 FILE_DIRECTORY_INFO *pFindData = 845 FILE_DIRECTORY_INFO *pFindData =
846 (FILE_DIRECTORY_INFO *)current_entry; 846 (FILE_DIRECTORY_INFO *)current_entry;
@@ -856,7 +856,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
856 (SEARCH_ID_FULL_DIR_INFO *)current_entry; 856 (SEARCH_ID_FULL_DIR_INFO *)current_entry;
857 filename = &pFindData->FileName[0]; 857 filename = &pFindData->FileName[0];
858 len = le32_to_cpu(pFindData->FileNameLength); 858 len = le32_to_cpu(pFindData->FileNameLength);
859 *pinum = pFindData->UniqueId; 859 *pinum = le64_to_cpu(pFindData->UniqueId);
860 } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { 860 } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
861 FILE_BOTH_DIRECTORY_INFO *pFindData = 861 FILE_BOTH_DIRECTORY_INFO *pFindData =
862 (FILE_BOTH_DIRECTORY_INFO *)current_entry; 862 (FILE_BOTH_DIRECTORY_INFO *)current_entry;