diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/CHANGES | 4 | ||||
-rw-r--r-- | fs/cifs/README | 2 | ||||
-rw-r--r-- | fs/cifs/cifs_debug.c | 17 | ||||
-rw-r--r-- | fs/cifs/cifs_debug.h | 9 | ||||
-rw-r--r-- | fs/cifs/cifs_dfs_ref.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifs_spnego.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifs_unicode.c | 4 | ||||
-rw-r--r-- | fs/cifs/cifs_unicode.h | 9 | ||||
-rw-r--r-- | fs/cifs/cifsacl.c | 57 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 15 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 22 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 218 | ||||
-rw-r--r-- | fs/cifs/connect.c | 50 | ||||
-rw-r--r-- | fs/cifs/dir.c | 20 | ||||
-rw-r--r-- | fs/cifs/dns_resolve.h | 2 | ||||
-rw-r--r-- | fs/cifs/fcntl.c | 6 | ||||
-rw-r--r-- | fs/cifs/file.c | 33 | ||||
-rw-r--r-- | fs/cifs/inode.c | 399 | ||||
-rw-r--r-- | fs/cifs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/cifs/md4.c | 4 | ||||
-rw-r--r-- | fs/cifs/md5.c | 9 | ||||
-rw-r--r-- | fs/cifs/misc.c | 14 | ||||
-rw-r--r-- | fs/cifs/netmisc.c | 23 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 54 | ||||
-rw-r--r-- | fs/cifs/sess.c | 4 | ||||
-rw-r--r-- | fs/cifs/smbdes.c | 22 | ||||
-rw-r--r-- | fs/cifs/transport.c | 11 | ||||
-rw-r--r-- | fs/cifs/xattr.c | 9 |
29 files changed, 410 insertions, 615 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index edd248367b36..dbd91461853c 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -6,7 +6,9 @@ and sync so that events like out of disk space get reported properly on | |||
6 | cached files. Fix setxattr failure to certain Samba versions. Fix mount | 6 | cached files. Fix setxattr failure to certain Samba versions. Fix mount |
7 | of second share to disconnected server session (autoreconnect on this). | 7 | of second share to disconnected server session (autoreconnect on this). |
8 | Add ability to modify cifs acls for handling chmod (when mounted with | 8 | Add ability to modify cifs acls for handling chmod (when mounted with |
9 | cifsacl flag). | 9 | cifsacl flag). Fix prefixpath path separator so we can handle mounts |
10 | with prefixpaths longer than one directory (one path component) when | ||
11 | mounted to Windows servers. | ||
10 | 12 | ||
11 | Version 1.51 | 13 | Version 1.51 |
12 | ------------ | 14 | ------------ |
diff --git a/fs/cifs/README b/fs/cifs/README index c623e2f9c5db..50306229b0f9 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -461,7 +461,7 @@ A partial list of the supported mount options follows: | |||
461 | cifsacl Report mode bits (e.g. on stat) based on the Windows ACL for | 461 | cifsacl Report mode bits (e.g. on stat) based on the Windows ACL for |
462 | the file. (EXPERIMENTAL) | 462 | the file. (EXPERIMENTAL) |
463 | servern Specify the server 's netbios name (RFC1001 name) to use | 463 | servern Specify the server 's netbios name (RFC1001 name) to use |
464 | when attempting to setup a session to the server. This is | 464 | when attempting to setup a session to the server. |
465 | This is needed for mounting to some older servers (such | 465 | This is needed for mounting to some older servers (such |
466 | as OS/2 or Windows 98 and Windows ME) since they do not | 466 | as OS/2 or Windows 98 and Windows ME) since they do not |
467 | support a default server name. A server name can be up | 467 | support a default server name. A server name can be up |
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 73c4c419663c..0228ed06069e 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -98,8 +98,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server) | |||
98 | if (mid_entry->resp_buf) { | 98 | if (mid_entry->resp_buf) { |
99 | cifs_dump_detail(mid_entry->resp_buf); | 99 | cifs_dump_detail(mid_entry->resp_buf); |
100 | cifs_dump_mem("existing buf: ", | 100 | cifs_dump_mem("existing buf: ", |
101 | mid_entry->resp_buf, | 101 | mid_entry->resp_buf, 62); |
102 | 62 /* fixme */); | ||
103 | } | 102 | } |
104 | } | 103 | } |
105 | } | 104 | } |
@@ -439,7 +438,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset, | |||
439 | 438 | ||
440 | return length; | 439 | return length; |
441 | } | 440 | } |
442 | #endif | 441 | #endif /* STATS */ |
443 | 442 | ||
444 | static struct proc_dir_entry *proc_fs_cifs; | 443 | static struct proc_dir_entry *proc_fs_cifs; |
445 | read_proc_t cifs_txanchor_read; | 444 | read_proc_t cifs_txanchor_read; |
@@ -482,7 +481,7 @@ cifs_proc_init(void) | |||
482 | cifs_stats_read, NULL); | 481 | cifs_stats_read, NULL); |
483 | if (pde) | 482 | if (pde) |
484 | pde->write_proc = cifs_stats_write; | 483 | pde->write_proc = cifs_stats_write; |
485 | #endif | 484 | #endif /* STATS */ |
486 | pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, | 485 | pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, |
487 | cifsFYI_read, NULL); | 486 | cifsFYI_read, NULL); |
488 | if (pde) | 487 | if (pde) |
@@ -918,4 +917,12 @@ security_flags_write(struct file *file, const char __user *buffer, | |||
918 | /* BB should we turn on MAY flags for other MUST options? */ | 917 | /* BB should we turn on MAY flags for other MUST options? */ |
919 | return count; | 918 | return count; |
920 | } | 919 | } |
921 | #endif | 920 | #else |
921 | inline void cifs_proc_init(void) | ||
922 | { | ||
923 | } | ||
924 | |||
925 | inline void cifs_proc_clean(void) | ||
926 | { | ||
927 | } | ||
928 | #endif /* PROC_FS */ | ||
diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h index c26cd0d2c6d5..5eb3b83bbfa7 100644 --- a/fs/cifs/cifs_debug.h +++ b/fs/cifs/cifs_debug.h | |||
@@ -25,8 +25,11 @@ | |||
25 | 25 | ||
26 | void cifs_dump_mem(char *label, void *data, int length); | 26 | void cifs_dump_mem(char *label, void *data, int length); |
27 | #ifdef CONFIG_CIFS_DEBUG2 | 27 | #ifdef CONFIG_CIFS_DEBUG2 |
28 | #define DBG2 2 | ||
28 | void cifs_dump_detail(struct smb_hdr *); | 29 | void cifs_dump_detail(struct smb_hdr *); |
29 | void cifs_dump_mids(struct TCP_Server_Info *); | 30 | void cifs_dump_mids(struct TCP_Server_Info *); |
31 | #else | ||
32 | #define DBG2 0 | ||
30 | #endif | 33 | #endif |
31 | extern int traceSMB; /* flag which enables the function below */ | 34 | extern int traceSMB; /* flag which enables the function below */ |
32 | void dump_smb(struct smb_hdr *, int); | 35 | void dump_smb(struct smb_hdr *, int); |
@@ -64,10 +67,10 @@ extern int cifsERROR; | |||
64 | * --------- | 67 | * --------- |
65 | */ | 68 | */ |
66 | #else /* _CIFS_DEBUG */ | 69 | #else /* _CIFS_DEBUG */ |
67 | #define cERROR(button,prspec) | 70 | #define cERROR(button, prspec) |
68 | #define cEVENT(format,arg...) | 71 | #define cEVENT(format, arg...) |
69 | #define cFYI(button, prspec) | 72 | #define cFYI(button, prspec) |
70 | #define cifserror(format,arg...) | 73 | #define cifserror(format, arg...) |
71 | #endif /* _CIFS_DEBUG */ | 74 | #endif /* _CIFS_DEBUG */ |
72 | 75 | ||
73 | #endif /* _H_CIFS_DEBUG */ | 76 | #endif /* _H_CIFS_DEBUG */ |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index 6ad447529961..7f8838253410 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -286,7 +286,7 @@ static void dump_referral(const struct dfs_info3_param *ref) | |||
286 | cFYI(1, ("DFS: node path: %s", ref->node_name)); | 286 | cFYI(1, ("DFS: node path: %s", ref->node_name)); |
287 | cFYI(1, ("DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type)); | 287 | cFYI(1, ("DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type)); |
288 | cFYI(1, ("DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag, | 288 | cFYI(1, ("DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag, |
289 | ref->PathConsumed)); | 289 | ref->path_consumed)); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index d543accc10dd..6653e29637a7 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c | |||
@@ -125,7 +125,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) | |||
125 | #ifdef CONFIG_CIFS_DEBUG2 | 125 | #ifdef CONFIG_CIFS_DEBUG2 |
126 | if (cifsFYI && !IS_ERR(spnego_key)) { | 126 | if (cifsFYI && !IS_ERR(spnego_key)) { |
127 | struct cifs_spnego_msg *msg = spnego_key->payload.data; | 127 | struct cifs_spnego_msg *msg = spnego_key->payload.data; |
128 | cifs_dump_mem("SPNEGO reply blob:", msg->data, min(1024, | 128 | cifs_dump_mem("SPNEGO reply blob:", msg->data, min(1024U, |
129 | msg->secblob_len + msg->sesskey_len)); | 129 | msg->secblob_len + msg->sesskey_len)); |
130 | } | 130 | } |
131 | #endif /* CONFIG_CIFS_DEBUG2 */ | 131 | #endif /* CONFIG_CIFS_DEBUG2 */ |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index b5903b89250d..7d75272a6b3f 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
@@ -32,7 +32,7 @@ | |||
32 | * | 32 | * |
33 | */ | 33 | */ |
34 | int | 34 | int |
35 | cifs_strfromUCS_le(char *to, const __le16 * from, | 35 | cifs_strfromUCS_le(char *to, const __le16 *from, |
36 | int len, const struct nls_table *codepage) | 36 | int len, const struct nls_table *codepage) |
37 | { | 37 | { |
38 | int i; | 38 | int i; |
@@ -61,7 +61,7 @@ cifs_strfromUCS_le(char *to, const __le16 * from, | |||
61 | * | 61 | * |
62 | */ | 62 | */ |
63 | int | 63 | int |
64 | cifs_strtoUCS(__le16 * to, const char *from, int len, | 64 | cifs_strtoUCS(__le16 *to, const char *from, int len, |
65 | const struct nls_table *codepage) | 65 | const struct nls_table *codepage) |
66 | { | 66 | { |
67 | int charlen; | 67 | int charlen; |
diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h index 614c11fcdcb6..14eb9a2395d3 100644 --- a/fs/cifs/cifs_unicode.h +++ b/fs/cifs/cifs_unicode.h | |||
@@ -254,7 +254,8 @@ UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2) | |||
254 | const wchar_t *anchor2 = ucs2; | 254 | const wchar_t *anchor2 = ucs2; |
255 | 255 | ||
256 | while (*ucs1) { | 256 | while (*ucs1) { |
257 | if (*ucs1 == *ucs2) { /* Partial match found */ | 257 | if (*ucs1 == *ucs2) { |
258 | /* Partial match found */ | ||
258 | ucs1++; | 259 | ucs1++; |
259 | ucs2++; | 260 | ucs2++; |
260 | } else { | 261 | } else { |
@@ -279,7 +280,8 @@ UniToupper(register wchar_t uc) | |||
279 | { | 280 | { |
280 | register const struct UniCaseRange *rp; | 281 | register const struct UniCaseRange *rp; |
281 | 282 | ||
282 | if (uc < sizeof (CifsUniUpperTable)) { /* Latin characters */ | 283 | if (uc < sizeof(CifsUniUpperTable)) { |
284 | /* Latin characters */ | ||
283 | return uc + CifsUniUpperTable[uc]; /* Use base tables */ | 285 | return uc + CifsUniUpperTable[uc]; /* Use base tables */ |
284 | } else { | 286 | } else { |
285 | rp = CifsUniUpperRange; /* Use range tables */ | 287 | rp = CifsUniUpperRange; /* Use range tables */ |
@@ -320,7 +322,8 @@ UniTolower(wchar_t uc) | |||
320 | { | 322 | { |
321 | register struct UniCaseRange *rp; | 323 | register struct UniCaseRange *rp; |
322 | 324 | ||
323 | if (uc < sizeof (UniLowerTable)) { /* Latin characters */ | 325 | if (uc < sizeof(UniLowerTable)) { |
326 | /* Latin characters */ | ||
324 | return uc + UniLowerTable[uc]; /* Use base tables */ | 327 | return uc + UniLowerTable[uc]; /* Use base tables */ |
325 | } else { | 328 | } else { |
326 | rp = UniLowerRange; /* Use range tables */ | 329 | rp = UniLowerRange; /* Use range tables */ |
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index a7035bd18e4e..f93932c21772 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -46,8 +46,7 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = { | |||
46 | static const struct cifs_sid sid_everyone = { | 46 | static const struct cifs_sid sid_everyone = { |
47 | 1, 1, {0, 0, 0, 0, 0, 1}, {0} }; | 47 | 1, 1, {0, 0, 0, 0, 0, 1}, {0} }; |
48 | /* group users */ | 48 | /* group users */ |
49 | static const struct cifs_sid sid_user = | 49 | static const struct cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; |
50 | {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; | ||
51 | 50 | ||
52 | 51 | ||
53 | int match_sid(struct cifs_sid *ctsid) | 52 | int match_sid(struct cifs_sid *ctsid) |
@@ -195,9 +194,9 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, | |||
195 | /* For deny ACEs we change the mask so that subsequent allow access | 194 | /* For deny ACEs we change the mask so that subsequent allow access |
196 | control entries do not turn on the bits we are denying */ | 195 | control entries do not turn on the bits we are denying */ |
197 | if (type == ACCESS_DENIED) { | 196 | if (type == ACCESS_DENIED) { |
198 | if (flags & GENERIC_ALL) { | 197 | if (flags & GENERIC_ALL) |
199 | *pbits_to_set &= ~S_IRWXUGO; | 198 | *pbits_to_set &= ~S_IRWXUGO; |
200 | } | 199 | |
201 | if ((flags & GENERIC_WRITE) || | 200 | if ((flags & GENERIC_WRITE) || |
202 | ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) | 201 | ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) |
203 | *pbits_to_set &= ~S_IWUGO; | 202 | *pbits_to_set &= ~S_IWUGO; |
@@ -216,9 +215,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, | |||
216 | 215 | ||
217 | if (flags & GENERIC_ALL) { | 216 | if (flags & GENERIC_ALL) { |
218 | *pmode |= (S_IRWXUGO & (*pbits_to_set)); | 217 | *pmode |= (S_IRWXUGO & (*pbits_to_set)); |
219 | #ifdef CONFIG_CIFS_DEBUG2 | 218 | cFYI(DBG2, ("all perms")); |
220 | cFYI(1, ("all perms")); | ||
221 | #endif | ||
222 | return; | 219 | return; |
223 | } | 220 | } |
224 | if ((flags & GENERIC_WRITE) || | 221 | if ((flags & GENERIC_WRITE) || |
@@ -231,9 +228,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, | |||
231 | ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) | 228 | ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) |
232 | *pmode |= (S_IXUGO & (*pbits_to_set)); | 229 | *pmode |= (S_IXUGO & (*pbits_to_set)); |
233 | 230 | ||
234 | #ifdef CONFIG_CIFS_DEBUG2 | 231 | cFYI(DBG2, ("access flags 0x%x mode now 0x%x", flags, *pmode)); |
235 | cFYI(1, ("access flags 0x%x mode now 0x%x", flags, *pmode)); | ||
236 | #endif | ||
237 | return; | 232 | return; |
238 | } | 233 | } |
239 | 234 | ||
@@ -262,9 +257,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use, | |||
262 | if (mode & S_IXUGO) | 257 | if (mode & S_IXUGO) |
263 | *pace_flags |= SET_FILE_EXEC_RIGHTS; | 258 | *pace_flags |= SET_FILE_EXEC_RIGHTS; |
264 | 259 | ||
265 | #ifdef CONFIG_CIFS_DEBUG2 | 260 | cFYI(DBG2, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags)); |
266 | cFYI(1, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags)); | ||
267 | #endif | ||
268 | return; | 261 | return; |
269 | } | 262 | } |
270 | 263 | ||
@@ -358,11 +351,9 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
358 | return; | 351 | return; |
359 | } | 352 | } |
360 | 353 | ||
361 | #ifdef CONFIG_CIFS_DEBUG2 | 354 | cFYI(DBG2, ("DACL revision %d size %d num aces %d", |
362 | cFYI(1, ("DACL revision %d size %d num aces %d", | ||
363 | le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), | 355 | le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), |
364 | le32_to_cpu(pdacl->num_aces))); | 356 | le32_to_cpu(pdacl->num_aces))); |
365 | #endif | ||
366 | 357 | ||
367 | /* reset rwx permissions for user/group/other. | 358 | /* reset rwx permissions for user/group/other. |
368 | Also, if num_aces is 0 i.e. DACL has no ACEs, | 359 | Also, if num_aces is 0 i.e. DACL has no ACEs, |
@@ -381,10 +372,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
381 | ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), | 372 | ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), |
382 | GFP_KERNEL); | 373 | GFP_KERNEL); |
383 | 374 | ||
384 | /* cifscred->cecount = pdacl->num_aces; | ||
385 | cifscred->aces = kmalloc(num_aces * | ||
386 | sizeof(struct cifs_ace *), GFP_KERNEL);*/ | ||
387 | |||
388 | for (i = 0; i < num_aces; ++i) { | 375 | for (i = 0; i < num_aces; ++i) { |
389 | ppace[i] = (struct cifs_ace *) (acl_base + acl_size); | 376 | ppace[i] = (struct cifs_ace *) (acl_base + acl_size); |
390 | #ifdef CONFIG_CIFS_DEBUG2 | 377 | #ifdef CONFIG_CIFS_DEBUG2 |
@@ -437,7 +424,7 @@ static int set_chmod_dacl(struct cifs_acl *pndacl, struct cifs_sid *pownersid, | |||
437 | &sid_everyone, nmode, S_IRWXO); | 424 | &sid_everyone, nmode, S_IRWXO); |
438 | 425 | ||
439 | pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl)); | 426 | pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl)); |
440 | pndacl->num_aces = 3; | 427 | pndacl->num_aces = cpu_to_le32(3); |
441 | 428 | ||
442 | return (0); | 429 | return (0); |
443 | } | 430 | } |
@@ -495,13 +482,11 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, | |||
495 | le32_to_cpu(pntsd->gsidoffset)); | 482 | le32_to_cpu(pntsd->gsidoffset)); |
496 | dacloffset = le32_to_cpu(pntsd->dacloffset); | 483 | dacloffset = le32_to_cpu(pntsd->dacloffset); |
497 | dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset); | 484 | dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset); |
498 | #ifdef CONFIG_CIFS_DEBUG2 | 485 | cFYI(DBG2, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " |
499 | cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x " | ||
500 | "sacloffset 0x%x dacloffset 0x%x", | 486 | "sacloffset 0x%x dacloffset 0x%x", |
501 | pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), | 487 | pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), |
502 | le32_to_cpu(pntsd->gsidoffset), | 488 | le32_to_cpu(pntsd->gsidoffset), |
503 | le32_to_cpu(pntsd->sacloffset), dacloffset)); | 489 | le32_to_cpu(pntsd->sacloffset), dacloffset)); |
504 | #endif | ||
505 | /* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */ | 490 | /* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */ |
506 | rc = parse_sid(owner_sid_ptr, end_of_acl); | 491 | rc = parse_sid(owner_sid_ptr, end_of_acl); |
507 | if (rc) | 492 | if (rc) |
@@ -636,9 +621,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
636 | struct super_block *sb; | 621 | struct super_block *sb; |
637 | struct cifs_sb_info *cifs_sb; | 622 | struct cifs_sb_info *cifs_sb; |
638 | 623 | ||
639 | #ifdef CONFIG_CIFS_DEBUG2 | 624 | cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode)); |
640 | cFYI(1, ("set ACL for %s from mode 0x%x", path, inode->i_mode)); | ||
641 | #endif | ||
642 | 625 | ||
643 | if (!inode) | 626 | if (!inode) |
644 | return (rc); | 627 | return (rc); |
@@ -669,9 +652,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
669 | } | 652 | } |
670 | 653 | ||
671 | rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); | 654 | rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); |
672 | #ifdef CONFIG_CIFS_DEBUG2 | 655 | cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); |
673 | cFYI(1, ("SetCIFSACL rc = %d", rc)); | ||
674 | #endif | ||
675 | if (unlock_file == TRUE) | 656 | if (unlock_file == TRUE) |
676 | atomic_dec(&open_file->wrtPending); | 657 | atomic_dec(&open_file->wrtPending); |
677 | else | 658 | else |
@@ -689,9 +670,7 @@ void acl_to_uid_mode(struct inode *inode, const char *path) | |||
689 | u32 acllen = 0; | 670 | u32 acllen = 0; |
690 | int rc = 0; | 671 | int rc = 0; |
691 | 672 | ||
692 | #ifdef CONFIG_CIFS_DEBUG2 | 673 | cFYI(DBG2, ("converting ACL to mode for %s", path)); |
693 | cFYI(1, ("converting ACL to mode for %s", path)); | ||
694 | #endif | ||
695 | pntsd = get_cifs_acl(&acllen, inode, path); | 674 | pntsd = get_cifs_acl(&acllen, inode, path); |
696 | 675 | ||
697 | /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ | 676 | /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ |
@@ -712,9 +691,7 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode) | |||
712 | struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */ | 691 | struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */ |
713 | struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ | 692 | struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ |
714 | 693 | ||
715 | #ifdef CONFIG_CIFS_DEBUG2 | 694 | cFYI(DBG2, ("set ACL from mode for %s", path)); |
716 | cFYI(1, ("set ACL from mode for %s", path)); | ||
717 | #endif | ||
718 | 695 | ||
719 | /* Get the security descriptor */ | 696 | /* Get the security descriptor */ |
720 | pntsd = get_cifs_acl(&acllen, inode, path); | 697 | pntsd = get_cifs_acl(&acllen, inode, path); |
@@ -736,16 +713,12 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode) | |||
736 | 713 | ||
737 | rc = build_sec_desc(pntsd, pnntsd, acllen, inode, nmode); | 714 | rc = build_sec_desc(pntsd, pnntsd, acllen, inode, nmode); |
738 | 715 | ||
739 | #ifdef CONFIG_CIFS_DEBUG2 | 716 | cFYI(DBG2, ("build_sec_desc rc: %d", rc)); |
740 | cFYI(1, ("build_sec_desc rc: %d", rc)); | ||
741 | #endif | ||
742 | 717 | ||
743 | if (!rc) { | 718 | if (!rc) { |
744 | /* Set the security descriptor */ | 719 | /* Set the security descriptor */ |
745 | rc = set_cifs_acl(pnntsd, acllen, inode, path); | 720 | rc = set_cifs_acl(pnntsd, acllen, inode, path); |
746 | #ifdef CONFIG_CIFS_DEBUG2 | 721 | cFYI(DBG2, ("set_cifs_acl rc: %d", rc)); |
747 | cFYI(1, ("set_cifs_acl rc: %d", rc)); | ||
748 | #endif | ||
749 | } | 722 | } |
750 | 723 | ||
751 | kfree(pnntsd); | 724 | kfree(pnntsd); |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index fcc434227691..a04b17e5a9d0 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -204,9 +204,8 @@ cifs_put_super(struct super_block *sb) | |||
204 | return; | 204 | return; |
205 | } | 205 | } |
206 | rc = cifs_umount(sb, cifs_sb); | 206 | rc = cifs_umount(sb, cifs_sb); |
207 | if (rc) { | 207 | if (rc) |
208 | cERROR(1, ("cifs_umount failed with return code %d", rc)); | 208 | cERROR(1, ("cifs_umount failed with return code %d", rc)); |
209 | } | ||
210 | #ifdef CONFIG_CIFS_DFS_UPCALL | 209 | #ifdef CONFIG_CIFS_DFS_UPCALL |
211 | if (cifs_sb->mountdata) { | 210 | if (cifs_sb->mountdata) { |
212 | kfree(cifs_sb->mountdata); | 211 | kfree(cifs_sb->mountdata); |
@@ -461,7 +460,7 @@ int cifs_xstate_get(struct super_block *sb, struct fs_quota_stat *qstats) | |||
461 | 460 | ||
462 | static struct quotactl_ops cifs_quotactl_ops = { | 461 | static struct quotactl_ops cifs_quotactl_ops = { |
463 | .set_xquota = cifs_xquota_set, | 462 | .set_xquota = cifs_xquota_set, |
464 | .get_xquota = cifs_xquota_set, | 463 | .get_xquota = cifs_xquota_get, |
465 | .set_xstate = cifs_xstate_set, | 464 | .set_xstate = cifs_xstate_set, |
466 | .get_xstate = cifs_xstate_get, | 465 | .get_xstate = cifs_xstate_get, |
467 | }; | 466 | }; |
@@ -472,9 +471,7 @@ static void cifs_umount_begin(struct vfsmount *vfsmnt, int flags) | |||
472 | struct cifs_sb_info *cifs_sb; | 471 | struct cifs_sb_info *cifs_sb; |
473 | struct cifsTconInfo *tcon; | 472 | struct cifsTconInfo *tcon; |
474 | 473 | ||
475 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
476 | dfs_shrink_umount_helper(vfsmnt); | 474 | dfs_shrink_umount_helper(vfsmnt); |
477 | #endif /* CONFIG CIFS_DFS_UPCALL */ | ||
478 | 475 | ||
479 | if (!(flags & MNT_FORCE)) | 476 | if (!(flags & MNT_FORCE)) |
480 | return; | 477 | return; |
@@ -992,9 +989,7 @@ static int __init | |||
992 | init_cifs(void) | 989 | init_cifs(void) |
993 | { | 990 | { |
994 | int rc = 0; | 991 | int rc = 0; |
995 | #ifdef CONFIG_PROC_FS | ||
996 | cifs_proc_init(); | 992 | cifs_proc_init(); |
997 | #endif | ||
998 | /* INIT_LIST_HEAD(&GlobalServerList);*/ /* BB not implemented yet */ | 993 | /* INIT_LIST_HEAD(&GlobalServerList);*/ /* BB not implemented yet */ |
999 | INIT_LIST_HEAD(&GlobalSMBSessionList); | 994 | INIT_LIST_HEAD(&GlobalSMBSessionList); |
1000 | INIT_LIST_HEAD(&GlobalTreeConnectionList); | 995 | INIT_LIST_HEAD(&GlobalTreeConnectionList); |
@@ -1095,19 +1090,15 @@ init_cifs(void) | |||
1095 | out_destroy_inodecache: | 1090 | out_destroy_inodecache: |
1096 | cifs_destroy_inodecache(); | 1091 | cifs_destroy_inodecache(); |
1097 | out_clean_proc: | 1092 | out_clean_proc: |
1098 | #ifdef CONFIG_PROC_FS | ||
1099 | cifs_proc_clean(); | 1093 | cifs_proc_clean(); |
1100 | #endif | ||
1101 | return rc; | 1094 | return rc; |
1102 | } | 1095 | } |
1103 | 1096 | ||
1104 | static void __exit | 1097 | static void __exit |
1105 | exit_cifs(void) | 1098 | exit_cifs(void) |
1106 | { | 1099 | { |
1107 | cFYI(0, ("exit_cifs")); | 1100 | cFYI(DBG2, ("exit_cifs")); |
1108 | #ifdef CONFIG_PROC_FS | ||
1109 | cifs_proc_clean(); | 1101 | cifs_proc_clean(); |
1110 | #endif | ||
1111 | #ifdef CONFIG_CIFS_DFS_UPCALL | 1102 | #ifdef CONFIG_CIFS_DFS_UPCALL |
1112 | unregister_key_type(&key_type_dns_resolver); | 1103 | unregister_key_type(&key_type_dns_resolver); |
1113 | #endif | 1104 | #endif |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 5d32d8ddc82e..69a2e1942542 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -454,7 +454,7 @@ struct dir_notify_req { | |||
454 | 454 | ||
455 | struct dfs_info3_param { | 455 | struct dfs_info3_param { |
456 | int flags; /* DFSREF_REFERRAL_SERVER, DFSREF_STORAGE_SERVER*/ | 456 | int flags; /* DFSREF_REFERRAL_SERVER, DFSREF_STORAGE_SERVER*/ |
457 | int PathConsumed; | 457 | int path_consumed; |
458 | int server_type; | 458 | int server_type; |
459 | int ref_flag; | 459 | int ref_flag; |
460 | char *path_name; | 460 | char *path_name; |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 2f09f565a3d9..0af63e6b426b 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -53,11 +53,11 @@ extern int SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, | |||
53 | extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, | 53 | extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, |
54 | struct kvec *, int /* nvec to send */, | 54 | struct kvec *, int /* nvec to send */, |
55 | int * /* type of buf returned */ , const int flags); | 55 | int * /* type of buf returned */ , const int flags); |
56 | extern int SendReceiveBlockingLock(const unsigned int /* xid */ , | 56 | extern int SendReceiveBlockingLock(const unsigned int xid, |
57 | struct cifsTconInfo *, | 57 | struct cifsTconInfo *ptcon, |
58 | struct smb_hdr * /* input */ , | 58 | struct smb_hdr *in_buf , |
59 | struct smb_hdr * /* out */ , | 59 | struct smb_hdr *out_buf, |
60 | int * /* bytes returned */); | 60 | int *bytes_returned); |
61 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); | 61 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); |
62 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); | 62 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); |
63 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); | 63 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); |
@@ -84,7 +84,7 @@ extern __u16 GetNextMid(struct TCP_Server_Info *server); | |||
84 | extern struct oplock_q_entry *AllocOplockQEntry(struct inode *, u16, | 84 | extern struct oplock_q_entry *AllocOplockQEntry(struct inode *, u16, |
85 | struct cifsTconInfo *); | 85 | struct cifsTconInfo *); |
86 | extern void DeleteOplockQEntry(struct oplock_q_entry *); | 86 | extern void DeleteOplockQEntry(struct oplock_q_entry *); |
87 | extern struct timespec cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ ); | 87 | extern struct timespec cifs_NTtimeToUnix(u64 utc_nanoseconds_since_1601); |
88 | extern u64 cifs_UnixTimeToNT(struct timespec); | 88 | extern u64 cifs_UnixTimeToNT(struct timespec); |
89 | extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); | 89 | extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); |
90 | extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); | 90 | extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); |
@@ -104,7 +104,11 @@ extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, | |||
104 | extern int cifs_umount(struct super_block *, struct cifs_sb_info *); | 104 | extern int cifs_umount(struct super_block *, struct cifs_sb_info *); |
105 | #ifdef CONFIG_CIFS_DFS_UPCALL | 105 | #ifdef CONFIG_CIFS_DFS_UPCALL |
106 | extern void dfs_shrink_umount_helper(struct vfsmount *vfsmnt); | 106 | extern void dfs_shrink_umount_helper(struct vfsmount *vfsmnt); |
107 | #endif | 107 | #else |
108 | static inline void dfs_shrink_umount_helper(struct vfsmount *vfsmnt) | ||
109 | { | ||
110 | } | ||
111 | #endif /* DFS_UPCALL */ | ||
108 | void cifs_proc_init(void); | 112 | void cifs_proc_init(void); |
109 | void cifs_proc_clean(void); | 113 | void cifs_proc_clean(void); |
110 | 114 | ||
@@ -175,11 +179,11 @@ extern int CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon, | |||
175 | struct kstatfs *FSData); | 179 | struct kstatfs *FSData); |
176 | 180 | ||
177 | extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, | 181 | extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, |
178 | const char *fileName, const FILE_BASIC_INFO * data, | 182 | const char *fileName, const FILE_BASIC_INFO *data, |
179 | const struct nls_table *nls_codepage, | 183 | const struct nls_table *nls_codepage, |
180 | int remap_special_chars); | 184 | int remap_special_chars); |
181 | extern int CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, | 185 | extern int CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, |
182 | const FILE_BASIC_INFO * data, __u16 fid); | 186 | const FILE_BASIC_INFO *data, __u16 fid); |
183 | #if 0 | 187 | #if 0 |
184 | extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon, | 188 | extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon, |
185 | char *fileName, __u16 dos_attributes, | 189 | char *fileName, __u16 dos_attributes, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 9409524e4bf8..30bbe448e260 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifssmb.c | 2 | * fs/cifs/cifssmb.c |
3 | * | 3 | * |
4 | * Copyright (C) International Business Machines Corp., 2002,2007 | 4 | * Copyright (C) International Business Machines Corp., 2002,2008 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * Contains the routines for constructing the SMB PDUs themselves | 7 | * Contains the routines for constructing the SMB PDUs themselves |
@@ -102,10 +102,12 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon) | |||
102 | to this tcon */ | 102 | to this tcon */ |
103 | } | 103 | } |
104 | 104 | ||
105 | /* If the return code is zero, this function must fill in request_buf pointer */ | 105 | /* Allocate and return pointer to an SMB request buffer, and set basic |
106 | SMB information in the SMB header. If the return code is zero, this | ||
107 | function must have filled in request_buf pointer */ | ||
106 | static int | 108 | static int |
107 | small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | 109 | small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, |
108 | void **request_buf /* returned */) | 110 | void **request_buf) |
109 | { | 111 | { |
110 | int rc = 0; | 112 | int rc = 0; |
111 | 113 | ||
@@ -363,7 +365,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
363 | *response_buf = *request_buf; | 365 | *response_buf = *request_buf; |
364 | 366 | ||
365 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, | 367 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, |
366 | wct /*wct */ ); | 368 | wct); |
367 | 369 | ||
368 | if (tcon != NULL) | 370 | if (tcon != NULL) |
369 | cifs_stats_inc(&tcon->num_smbs_sent); | 371 | cifs_stats_inc(&tcon->num_smbs_sent); |
@@ -523,7 +525,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
523 | if (remain >= (MIN_TZ_ADJ / 2)) | 525 | if (remain >= (MIN_TZ_ADJ / 2)) |
524 | result += MIN_TZ_ADJ; | 526 | result += MIN_TZ_ADJ; |
525 | if (val < 0) | 527 | if (val < 0) |
526 | result = - result; | 528 | result = -result; |
527 | server->timeAdj = result; | 529 | server->timeAdj = result; |
528 | } else { | 530 | } else { |
529 | server->timeAdj = (int)tmp; | 531 | server->timeAdj = (int)tmp; |
@@ -600,7 +602,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
600 | server->maxBuf = min(le32_to_cpu(pSMBr->MaxBufferSize), | 602 | server->maxBuf = min(le32_to_cpu(pSMBr->MaxBufferSize), |
601 | (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); | 603 | (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); |
602 | server->maxRw = le32_to_cpu(pSMBr->MaxRawSize); | 604 | server->maxRw = le32_to_cpu(pSMBr->MaxRawSize); |
603 | cFYI(0, ("Max buf = %d", ses->server->maxBuf)); | 605 | cFYI(DBG2, ("Max buf = %d", ses->server->maxBuf)); |
604 | GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey); | 606 | GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey); |
605 | server->capabilities = le32_to_cpu(pSMBr->Capabilities); | 607 | server->capabilities = le32_to_cpu(pSMBr->Capabilities); |
606 | server->timeAdj = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone); | 608 | server->timeAdj = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone); |
@@ -868,9 +870,8 @@ PsxDelete: | |||
868 | pSMB->ByteCount = cpu_to_le16(byte_count); | 870 | pSMB->ByteCount = cpu_to_le16(byte_count); |
869 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 871 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
870 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 872 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
871 | if (rc) { | 873 | if (rc) |
872 | cFYI(1, ("Posix delete returned %d", rc)); | 874 | cFYI(1, ("Posix delete returned %d", rc)); |
873 | } | ||
874 | cifs_buf_release(pSMB); | 875 | cifs_buf_release(pSMB); |
875 | 876 | ||
876 | cifs_stats_inc(&tcon->num_deletes); | 877 | cifs_stats_inc(&tcon->num_deletes); |
@@ -916,9 +917,8 @@ DelFileRetry: | |||
916 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 917 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
917 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 918 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
918 | cifs_stats_inc(&tcon->num_deletes); | 919 | cifs_stats_inc(&tcon->num_deletes); |
919 | if (rc) { | 920 | if (rc) |
920 | cFYI(1, ("Error in RMFile = %d", rc)); | 921 | cFYI(1, ("Error in RMFile = %d", rc)); |
921 | } | ||
922 | 922 | ||
923 | cifs_buf_release(pSMB); | 923 | cifs_buf_release(pSMB); |
924 | if (rc == -EAGAIN) | 924 | if (rc == -EAGAIN) |
@@ -961,9 +961,8 @@ RmDirRetry: | |||
961 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 961 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
962 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 962 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
963 | cifs_stats_inc(&tcon->num_rmdirs); | 963 | cifs_stats_inc(&tcon->num_rmdirs); |
964 | if (rc) { | 964 | if (rc) |
965 | cFYI(1, ("Error in RMDir = %d", rc)); | 965 | cFYI(1, ("Error in RMDir = %d", rc)); |
966 | } | ||
967 | 966 | ||
968 | cifs_buf_release(pSMB); | 967 | cifs_buf_release(pSMB); |
969 | if (rc == -EAGAIN) | 968 | if (rc == -EAGAIN) |
@@ -1005,9 +1004,8 @@ MkDirRetry: | |||
1005 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1004 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1006 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1005 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1007 | cifs_stats_inc(&tcon->num_mkdirs); | 1006 | cifs_stats_inc(&tcon->num_mkdirs); |
1008 | if (rc) { | 1007 | if (rc) |
1009 | cFYI(1, ("Error in Mkdir = %d", rc)); | 1008 | cFYI(1, ("Error in Mkdir = %d", rc)); |
1010 | } | ||
1011 | 1009 | ||
1012 | cifs_buf_release(pSMB); | 1010 | cifs_buf_release(pSMB); |
1013 | if (rc == -EAGAIN) | 1011 | if (rc == -EAGAIN) |
@@ -1017,7 +1015,7 @@ MkDirRetry: | |||
1017 | 1015 | ||
1018 | int | 1016 | int |
1019 | CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, | 1017 | CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, |
1020 | __u64 mode, __u16 * netfid, FILE_UNIX_BASIC_INFO *pRetData, | 1018 | __u64 mode, __u16 *netfid, FILE_UNIX_BASIC_INFO *pRetData, |
1021 | __u32 *pOplock, const char *name, | 1019 | __u32 *pOplock, const char *name, |
1022 | const struct nls_table *nls_codepage, int remap) | 1020 | const struct nls_table *nls_codepage, int remap) |
1023 | { | 1021 | { |
@@ -1027,8 +1025,8 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, | |||
1027 | int rc = 0; | 1025 | int rc = 0; |
1028 | int bytes_returned = 0; | 1026 | int bytes_returned = 0; |
1029 | __u16 params, param_offset, offset, byte_count, count; | 1027 | __u16 params, param_offset, offset, byte_count, count; |
1030 | OPEN_PSX_REQ * pdata; | 1028 | OPEN_PSX_REQ *pdata; |
1031 | OPEN_PSX_RSP * psx_rsp; | 1029 | OPEN_PSX_RSP *psx_rsp; |
1032 | 1030 | ||
1033 | cFYI(1, ("In POSIX Create")); | 1031 | cFYI(1, ("In POSIX Create")); |
1034 | PsxCreat: | 1032 | PsxCreat: |
@@ -1110,9 +1108,7 @@ PsxCreat: | |||
1110 | /* check to make sure response data is there */ | 1108 | /* check to make sure response data is there */ |
1111 | if (psx_rsp->ReturnedLevel != cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC)) { | 1109 | if (psx_rsp->ReturnedLevel != cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC)) { |
1112 | pRetData->Type = cpu_to_le32(-1); /* unknown */ | 1110 | pRetData->Type = cpu_to_le32(-1); /* unknown */ |
1113 | #ifdef CONFIG_CIFS_DEBUG2 | 1111 | cFYI(DBG2, ("unknown type")); |
1114 | cFYI(1, ("unknown type")); | ||
1115 | #endif | ||
1116 | } else { | 1112 | } else { |
1117 | if (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP) | 1113 | if (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP) |
1118 | + sizeof(FILE_UNIX_BASIC_INFO)) { | 1114 | + sizeof(FILE_UNIX_BASIC_INFO)) { |
@@ -1169,8 +1165,8 @@ static __u16 convert_disposition(int disposition) | |||
1169 | int | 1165 | int |
1170 | SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, | 1166 | SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, |
1171 | const char *fileName, const int openDisposition, | 1167 | const char *fileName, const int openDisposition, |
1172 | const int access_flags, const int create_options, __u16 * netfid, | 1168 | const int access_flags, const int create_options, __u16 *netfid, |
1173 | int *pOplock, FILE_ALL_INFO * pfile_info, | 1169 | int *pOplock, FILE_ALL_INFO *pfile_info, |
1174 | const struct nls_table *nls_codepage, int remap) | 1170 | const struct nls_table *nls_codepage, int remap) |
1175 | { | 1171 | { |
1176 | int rc = -EACCES; | 1172 | int rc = -EACCES; |
@@ -1221,8 +1217,8 @@ OldOpenRetry: | |||
1221 | 1217 | ||
1222 | if (create_options & CREATE_OPTION_SPECIAL) | 1218 | if (create_options & CREATE_OPTION_SPECIAL) |
1223 | pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM); | 1219 | pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM); |
1224 | else | 1220 | else /* BB FIXME BB */ |
1225 | pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); /* BB FIXME */ | 1221 | pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); |
1226 | 1222 | ||
1227 | /* if ((omode & S_IWUGO) == 0) | 1223 | /* if ((omode & S_IWUGO) == 0) |
1228 | pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ | 1224 | pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ |
@@ -1284,8 +1280,8 @@ OldOpenRetry: | |||
1284 | int | 1280 | int |
1285 | CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, | 1281 | CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, |
1286 | const char *fileName, const int openDisposition, | 1282 | const char *fileName, const int openDisposition, |
1287 | const int access_flags, const int create_options, __u16 * netfid, | 1283 | const int access_flags, const int create_options, __u16 *netfid, |
1288 | int *pOplock, FILE_ALL_INFO * pfile_info, | 1284 | int *pOplock, FILE_ALL_INFO *pfile_info, |
1289 | const struct nls_table *nls_codepage, int remap) | 1285 | const struct nls_table *nls_codepage, int remap) |
1290 | { | 1286 | { |
1291 | int rc = -EACCES; | 1287 | int rc = -EACCES; |
@@ -1556,9 +1552,9 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, | |||
1556 | } /* else setting file size with write of zero bytes */ | 1552 | } /* else setting file size with write of zero bytes */ |
1557 | if (wct == 14) | 1553 | if (wct == 14) |
1558 | byte_count = bytes_sent + 1; /* pad */ | 1554 | byte_count = bytes_sent + 1; /* pad */ |
1559 | else /* wct == 12 */ { | 1555 | else /* wct == 12 */ |
1560 | byte_count = bytes_sent + 5; /* bigger pad, smaller smb hdr */ | 1556 | byte_count = bytes_sent + 5; /* bigger pad, smaller smb hdr */ |
1561 | } | 1557 | |
1562 | pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF); | 1558 | pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF); |
1563 | pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16); | 1559 | pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16); |
1564 | pSMB->hdr.smb_buf_length += byte_count; | 1560 | pSMB->hdr.smb_buf_length += byte_count; |
@@ -1663,7 +1659,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | |||
1663 | rc = -EIO; | 1659 | rc = -EIO; |
1664 | *nbytes = 0; | 1660 | *nbytes = 0; |
1665 | } else { | 1661 | } else { |
1666 | WRITE_RSP * pSMBr = (WRITE_RSP *)iov[0].iov_base; | 1662 | WRITE_RSP *pSMBr = (WRITE_RSP *)iov[0].iov_base; |
1667 | *nbytes = le16_to_cpu(pSMBr->CountHigh); | 1663 | *nbytes = le16_to_cpu(pSMBr->CountHigh); |
1668 | *nbytes = (*nbytes) << 16; | 1664 | *nbytes = (*nbytes) << 16; |
1669 | *nbytes += le16_to_cpu(pSMBr->Count); | 1665 | *nbytes += le16_to_cpu(pSMBr->Count); |
@@ -1744,9 +1740,8 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1744 | /* SMB buffer freed by function above */ | 1740 | /* SMB buffer freed by function above */ |
1745 | } | 1741 | } |
1746 | cifs_stats_inc(&tcon->num_locks); | 1742 | cifs_stats_inc(&tcon->num_locks); |
1747 | if (rc) { | 1743 | if (rc) |
1748 | cFYI(1, ("Send error in Lock = %d", rc)); | 1744 | cFYI(1, ("Send error in Lock = %d", rc)); |
1749 | } | ||
1750 | 1745 | ||
1751 | /* Note: On -EAGAIN error only caller can retry on handle based calls | 1746 | /* Note: On -EAGAIN error only caller can retry on handle based calls |
1752 | since file handle passed in no longer valid */ | 1747 | since file handle passed in no longer valid */ |
@@ -1791,7 +1786,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1791 | 1786 | ||
1792 | count = sizeof(struct cifs_posix_lock); | 1787 | count = sizeof(struct cifs_posix_lock); |
1793 | pSMB->MaxParameterCount = cpu_to_le16(2); | 1788 | pSMB->MaxParameterCount = cpu_to_le16(2); |
1794 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ | 1789 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */ |
1795 | pSMB->SetupCount = 1; | 1790 | pSMB->SetupCount = 1; |
1796 | pSMB->Reserved3 = 0; | 1791 | pSMB->Reserved3 = 0; |
1797 | if (get_flag) | 1792 | if (get_flag) |
@@ -1972,9 +1967,8 @@ renameRetry: | |||
1972 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1967 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1973 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1968 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1974 | cifs_stats_inc(&tcon->num_renames); | 1969 | cifs_stats_inc(&tcon->num_renames); |
1975 | if (rc) { | 1970 | if (rc) |
1976 | cFYI(1, ("Send error in rename = %d", rc)); | 1971 | cFYI(1, ("Send error in rename = %d", rc)); |
1977 | } | ||
1978 | 1972 | ||
1979 | cifs_buf_release(pSMB); | 1973 | cifs_buf_release(pSMB); |
1980 | 1974 | ||
@@ -2016,7 +2010,7 @@ int CIFSSMBRenameOpenFile(const int xid, struct cifsTconInfo *pTcon, | |||
2016 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 2010 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; |
2017 | rename_info = (struct set_file_rename *) data_offset; | 2011 | rename_info = (struct set_file_rename *) data_offset; |
2018 | pSMB->MaxParameterCount = cpu_to_le16(2); | 2012 | pSMB->MaxParameterCount = cpu_to_le16(2); |
2019 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ | 2013 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */ |
2020 | pSMB->SetupCount = 1; | 2014 | pSMB->SetupCount = 1; |
2021 | pSMB->Reserved3 = 0; | 2015 | pSMB->Reserved3 = 0; |
2022 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); | 2016 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); |
@@ -2052,9 +2046,8 @@ int CIFSSMBRenameOpenFile(const int xid, struct cifsTconInfo *pTcon, | |||
2052 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, | 2046 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, |
2053 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2047 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2054 | cifs_stats_inc(&pTcon->num_t2renames); | 2048 | cifs_stats_inc(&pTcon->num_t2renames); |
2055 | if (rc) { | 2049 | if (rc) |
2056 | cFYI(1, ("Send error in Rename (by file handle) = %d", rc)); | 2050 | cFYI(1, ("Send error in Rename (by file handle) = %d", rc)); |
2057 | } | ||
2058 | 2051 | ||
2059 | cifs_buf_release(pSMB); | 2052 | cifs_buf_release(pSMB); |
2060 | 2053 | ||
@@ -2211,9 +2204,8 @@ createSymLinkRetry: | |||
2211 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2204 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2212 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2205 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2213 | cifs_stats_inc(&tcon->num_symlinks); | 2206 | cifs_stats_inc(&tcon->num_symlinks); |
2214 | if (rc) { | 2207 | if (rc) |
2215 | cFYI(1, ("Send error in SetPathInfo create symlink = %d", rc)); | 2208 | cFYI(1, ("Send error in SetPathInfo create symlink = %d", rc)); |
2216 | } | ||
2217 | 2209 | ||
2218 | if (pSMB) | 2210 | if (pSMB) |
2219 | cifs_buf_release(pSMB); | 2211 | cifs_buf_release(pSMB); |
@@ -2299,9 +2291,8 @@ createHardLinkRetry: | |||
2299 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2291 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2300 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2292 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2301 | cifs_stats_inc(&tcon->num_hardlinks); | 2293 | cifs_stats_inc(&tcon->num_hardlinks); |
2302 | if (rc) { | 2294 | if (rc) |
2303 | cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); | 2295 | cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); |
2304 | } | ||
2305 | 2296 | ||
2306 | cifs_buf_release(pSMB); | 2297 | cifs_buf_release(pSMB); |
2307 | if (rc == -EAGAIN) | 2298 | if (rc == -EAGAIN) |
@@ -2370,9 +2361,9 @@ winCreateHardLinkRetry: | |||
2370 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2361 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2371 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2362 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2372 | cifs_stats_inc(&tcon->num_hardlinks); | 2363 | cifs_stats_inc(&tcon->num_hardlinks); |
2373 | if (rc) { | 2364 | if (rc) |
2374 | cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); | 2365 | cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); |
2375 | } | 2366 | |
2376 | cifs_buf_release(pSMB); | 2367 | cifs_buf_release(pSMB); |
2377 | if (rc == -EAGAIN) | 2368 | if (rc == -EAGAIN) |
2378 | goto winCreateHardLinkRetry; | 2369 | goto winCreateHardLinkRetry; |
@@ -2968,9 +2959,8 @@ setAclRetry: | |||
2968 | pSMB->ByteCount = cpu_to_le16(byte_count); | 2959 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2969 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2960 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2970 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2961 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2971 | if (rc) { | 2962 | if (rc) |
2972 | cFYI(1, ("Set POSIX ACL returned %d", rc)); | 2963 | cFYI(1, ("Set POSIX ACL returned %d", rc)); |
2973 | } | ||
2974 | 2964 | ||
2975 | setACLerrorExit: | 2965 | setACLerrorExit: |
2976 | cifs_buf_release(pSMB); | 2966 | cifs_buf_release(pSMB); |
@@ -2982,7 +2972,7 @@ setACLerrorExit: | |||
2982 | /* BB fix tabs in this function FIXME BB */ | 2972 | /* BB fix tabs in this function FIXME BB */ |
2983 | int | 2973 | int |
2984 | CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, | 2974 | CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, |
2985 | const int netfid, __u64 * pExtAttrBits, __u64 *pMask) | 2975 | const int netfid, __u64 *pExtAttrBits, __u64 *pMask) |
2986 | { | 2976 | { |
2987 | int rc = 0; | 2977 | int rc = 0; |
2988 | struct smb_t2_qfi_req *pSMB = NULL; | 2978 | struct smb_t2_qfi_req *pSMB = NULL; |
@@ -3000,7 +2990,7 @@ GetExtAttrRetry: | |||
3000 | if (rc) | 2990 | if (rc) |
3001 | return rc; | 2991 | return rc; |
3002 | 2992 | ||
3003 | params = 2 /* level */ +2 /* fid */; | 2993 | params = 2 /* level */ + 2 /* fid */; |
3004 | pSMB->t2.TotalDataCount = 0; | 2994 | pSMB->t2.TotalDataCount = 0; |
3005 | pSMB->t2.MaxParameterCount = cpu_to_le16(4); | 2995 | pSMB->t2.MaxParameterCount = cpu_to_le16(4); |
3006 | /* BB find exact max data count below from sess structure BB */ | 2996 | /* BB find exact max data count below from sess structure BB */ |
@@ -3071,7 +3061,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | |||
3071 | { | 3061 | { |
3072 | int rc = 0; | 3062 | int rc = 0; |
3073 | int buf_type = 0; | 3063 | int buf_type = 0; |
3074 | QUERY_SEC_DESC_REQ * pSMB; | 3064 | QUERY_SEC_DESC_REQ *pSMB; |
3075 | struct kvec iov[1]; | 3065 | struct kvec iov[1]; |
3076 | 3066 | ||
3077 | cFYI(1, ("GetCifsACL")); | 3067 | cFYI(1, ("GetCifsACL")); |
@@ -3101,7 +3091,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | |||
3101 | if (rc) { | 3091 | if (rc) { |
3102 | cFYI(1, ("Send error in QuerySecDesc = %d", rc)); | 3092 | cFYI(1, ("Send error in QuerySecDesc = %d", rc)); |
3103 | } else { /* decode response */ | 3093 | } else { /* decode response */ |
3104 | __le32 * parm; | 3094 | __le32 *parm; |
3105 | __u32 parm_len; | 3095 | __u32 parm_len; |
3106 | __u32 acl_len; | 3096 | __u32 acl_len; |
3107 | struct smb_com_ntransact_rsp *pSMBr; | 3097 | struct smb_com_ntransact_rsp *pSMBr; |
@@ -3230,8 +3220,8 @@ int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, | |||
3230 | FILE_ALL_INFO *pFinfo, | 3220 | FILE_ALL_INFO *pFinfo, |
3231 | const struct nls_table *nls_codepage, int remap) | 3221 | const struct nls_table *nls_codepage, int remap) |
3232 | { | 3222 | { |
3233 | QUERY_INFORMATION_REQ * pSMB; | 3223 | QUERY_INFORMATION_REQ *pSMB; |
3234 | QUERY_INFORMATION_RSP * pSMBr; | 3224 | QUERY_INFORMATION_RSP *pSMBr; |
3235 | int rc = 0; | 3225 | int rc = 0; |
3236 | int bytes_returned; | 3226 | int bytes_returned; |
3237 | int name_len; | 3227 | int name_len; |
@@ -3263,9 +3253,11 @@ QInfRetry: | |||
3263 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 3253 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
3264 | if (rc) { | 3254 | if (rc) { |
3265 | cFYI(1, ("Send error in QueryInfo = %d", rc)); | 3255 | cFYI(1, ("Send error in QueryInfo = %d", rc)); |
3266 | } else if (pFinfo) { /* decode response */ | 3256 | } else if (pFinfo) { |
3267 | struct timespec ts; | 3257 | struct timespec ts; |
3268 | __u32 time = le32_to_cpu(pSMBr->last_write_time); | 3258 | __u32 time = le32_to_cpu(pSMBr->last_write_time); |
3259 | |||
3260 | /* decode response */ | ||
3269 | /* BB FIXME - add time zone adjustment BB */ | 3261 | /* BB FIXME - add time zone adjustment BB */ |
3270 | memset(pFinfo, 0, sizeof(FILE_ALL_INFO)); | 3262 | memset(pFinfo, 0, sizeof(FILE_ALL_INFO)); |
3271 | ts.tv_nsec = 0; | 3263 | ts.tv_nsec = 0; |
@@ -3296,7 +3288,7 @@ QInfRetry: | |||
3296 | int | 3288 | int |
3297 | CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, | 3289 | CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, |
3298 | const unsigned char *searchName, | 3290 | const unsigned char *searchName, |
3299 | FILE_ALL_INFO * pFindData, | 3291 | FILE_ALL_INFO *pFindData, |
3300 | int legacy /* old style infolevel */, | 3292 | int legacy /* old style infolevel */, |
3301 | const struct nls_table *nls_codepage, int remap) | 3293 | const struct nls_table *nls_codepage, int remap) |
3302 | { | 3294 | { |
@@ -3371,10 +3363,12 @@ QPathInfoRetry: | |||
3371 | else if (pFindData) { | 3363 | else if (pFindData) { |
3372 | int size; | 3364 | int size; |
3373 | __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); | 3365 | __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); |
3374 | if (legacy) /* we do not read the last field, EAsize, | 3366 | |
3375 | fortunately since it varies by subdialect | 3367 | /* On legacy responses we do not read the last field, |
3376 | and on Set vs. Get, is two bytes or 4 | 3368 | EAsize, fortunately since it varies by subdialect and |
3377 | bytes depending but we don't care here */ | 3369 | also note it differs on Set vs. Get, ie two bytes or 4 |
3370 | bytes depending but we don't care here */ | ||
3371 | if (legacy) | ||
3378 | size = sizeof(FILE_INFO_STANDARD); | 3372 | size = sizeof(FILE_INFO_STANDARD); |
3379 | else | 3373 | else |
3380 | size = sizeof(FILE_ALL_INFO); | 3374 | size = sizeof(FILE_ALL_INFO); |
@@ -3476,85 +3470,6 @@ UnixQPathInfoRetry: | |||
3476 | return rc; | 3470 | return rc; |
3477 | } | 3471 | } |
3478 | 3472 | ||
3479 | #if 0 /* function unused at present */ | ||
3480 | int CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, | ||
3481 | const char *searchName, FILE_ALL_INFO * findData, | ||
3482 | const struct nls_table *nls_codepage) | ||
3483 | { | ||
3484 | /* level 257 SMB_ */ | ||
3485 | TRANSACTION2_FFIRST_REQ *pSMB = NULL; | ||
3486 | TRANSACTION2_FFIRST_RSP *pSMBr = NULL; | ||
3487 | int rc = 0; | ||
3488 | int bytes_returned; | ||
3489 | int name_len; | ||
3490 | __u16 params, byte_count; | ||
3491 | |||
3492 | cFYI(1, ("In FindUnique")); | ||
3493 | findUniqueRetry: | ||
3494 | rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, | ||
3495 | (void **) &pSMBr); | ||
3496 | if (rc) | ||
3497 | return rc; | ||
3498 | |||
3499 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | ||
3500 | name_len = | ||
3501 | cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, | ||
3502 | PATH_MAX, nls_codepage); | ||
3503 | name_len++; /* trailing null */ | ||
3504 | name_len *= 2; | ||
3505 | } else { /* BB improve the check for buffer overruns BB */ | ||
3506 | name_len = strnlen(searchName, PATH_MAX); | ||
3507 | name_len++; /* trailing null */ | ||
3508 | strncpy(pSMB->FileName, searchName, name_len); | ||
3509 | } | ||
3510 | |||
3511 | params = 12 + name_len /* includes null */ ; | ||
3512 | pSMB->TotalDataCount = 0; /* no EAs */ | ||
3513 | pSMB->MaxParameterCount = cpu_to_le16(2); | ||
3514 | pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ | ||
3515 | pSMB->MaxSetupCount = 0; | ||
3516 | pSMB->Reserved = 0; | ||
3517 | pSMB->Flags = 0; | ||
3518 | pSMB->Timeout = 0; | ||
3519 | pSMB->Reserved2 = 0; | ||
3520 | pSMB->ParameterOffset = cpu_to_le16( | ||
3521 | offsetof(struct smb_com_transaction2_ffirst_req, InformationLevel)-4); | ||
3522 | pSMB->DataCount = 0; | ||
3523 | pSMB->DataOffset = 0; | ||
3524 | pSMB->SetupCount = 1; /* one byte, no need to le convert */ | ||
3525 | pSMB->Reserved3 = 0; | ||
3526 | pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST); | ||
3527 | byte_count = params + 1 /* pad */ ; | ||
3528 | pSMB->TotalParameterCount = cpu_to_le16(params); | ||
3529 | pSMB->ParameterCount = pSMB->TotalParameterCount; | ||
3530 | pSMB->SearchAttributes = | ||
3531 | cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | | ||
3532 | ATTR_DIRECTORY); | ||
3533 | pSMB->SearchCount = cpu_to_le16(16); /* BB increase */ | ||
3534 | pSMB->SearchFlags = cpu_to_le16(1); | ||
3535 | pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); | ||
3536 | pSMB->SearchStorageType = 0; /* BB what should we set this to? BB */ | ||
3537 | pSMB->hdr.smb_buf_length += byte_count; | ||
3538 | pSMB->ByteCount = cpu_to_le16(byte_count); | ||
3539 | |||
3540 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | ||
3541 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | ||
3542 | |||
3543 | if (rc) { | ||
3544 | cFYI(1, ("Send error in FindFileDirInfo = %d", rc)); | ||
3545 | } else { /* decode response */ | ||
3546 | cifs_stats_inc(&tcon->num_ffirst); | ||
3547 | /* BB fill in */ | ||
3548 | } | ||
3549 | |||
3550 | cifs_buf_release(pSMB); | ||
3551 | if (rc == -EAGAIN) | ||
3552 | goto findUniqueRetry; | ||
3553 | |||
3554 | return rc; | ||
3555 | } | ||
3556 | #endif /* end unused (temporarily) function */ | ||
3557 | |||
3558 | /* xid, tcon, searchName and codepage are input parms, rest are returned */ | 3473 | /* xid, tcon, searchName and codepage are input parms, rest are returned */ |
3559 | int | 3474 | int |
3560 | CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, | 3475 | CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, |
@@ -3566,7 +3481,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, | |||
3566 | /* level 257 SMB_ */ | 3481 | /* level 257 SMB_ */ |
3567 | TRANSACTION2_FFIRST_REQ *pSMB = NULL; | 3482 | TRANSACTION2_FFIRST_REQ *pSMB = NULL; |
3568 | TRANSACTION2_FFIRST_RSP *pSMBr = NULL; | 3483 | TRANSACTION2_FFIRST_RSP *pSMBr = NULL; |
3569 | T2_FFIRST_RSP_PARMS * parms; | 3484 | T2_FFIRST_RSP_PARMS *parms; |
3570 | int rc = 0; | 3485 | int rc = 0; |
3571 | int bytes_returned = 0; | 3486 | int bytes_returned = 0; |
3572 | int name_len; | 3487 | int name_len; |
@@ -3697,7 +3612,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3697 | { | 3612 | { |
3698 | TRANSACTION2_FNEXT_REQ *pSMB = NULL; | 3613 | TRANSACTION2_FNEXT_REQ *pSMB = NULL; |
3699 | TRANSACTION2_FNEXT_RSP *pSMBr = NULL; | 3614 | TRANSACTION2_FNEXT_RSP *pSMBr = NULL; |
3700 | T2_FNEXT_RSP_PARMS * parms; | 3615 | T2_FNEXT_RSP_PARMS *parms; |
3701 | char *response_data; | 3616 | char *response_data; |
3702 | int rc = 0; | 3617 | int rc = 0; |
3703 | int bytes_returned, name_len; | 3618 | int bytes_returned, name_len; |
@@ -3836,9 +3751,9 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon, | |||
3836 | pSMB->FileID = searchHandle; | 3751 | pSMB->FileID = searchHandle; |
3837 | pSMB->ByteCount = 0; | 3752 | pSMB->ByteCount = 0; |
3838 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); | 3753 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); |
3839 | if (rc) { | 3754 | if (rc) |
3840 | cERROR(1, ("Send error in FindClose = %d", rc)); | 3755 | cERROR(1, ("Send error in FindClose = %d", rc)); |
3841 | } | 3756 | |
3842 | cifs_stats_inc(&tcon->num_fclose); | 3757 | cifs_stats_inc(&tcon->num_fclose); |
3843 | 3758 | ||
3844 | /* Since session is dead, search handle closed on server already */ | 3759 | /* Since session is dead, search handle closed on server already */ |
@@ -3851,7 +3766,7 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon, | |||
3851 | int | 3766 | int |
3852 | CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, | 3767 | CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, |
3853 | const unsigned char *searchName, | 3768 | const unsigned char *searchName, |
3854 | __u64 * inode_number, | 3769 | __u64 *inode_number, |
3855 | const struct nls_table *nls_codepage, int remap) | 3770 | const struct nls_table *nls_codepage, int remap) |
3856 | { | 3771 | { |
3857 | int rc = 0; | 3772 | int rc = 0; |
@@ -4560,9 +4475,8 @@ SETFSUnixRetry: | |||
4560 | cERROR(1, ("Send error in SETFSUnixInfo = %d", rc)); | 4475 | cERROR(1, ("Send error in SETFSUnixInfo = %d", rc)); |
4561 | } else { /* decode response */ | 4476 | } else { /* decode response */ |
4562 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); | 4477 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
4563 | if (rc) { | 4478 | if (rc) |
4564 | rc = -EIO; /* bad smb */ | 4479 | rc = -EIO; /* bad smb */ |
4565 | } | ||
4566 | } | 4480 | } |
4567 | cifs_buf_release(pSMB); | 4481 | cifs_buf_release(pSMB); |
4568 | 4482 | ||
@@ -4744,9 +4658,8 @@ SetEOFRetry: | |||
4744 | pSMB->ByteCount = cpu_to_le16(byte_count); | 4658 | pSMB->ByteCount = cpu_to_le16(byte_count); |
4745 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4659 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4746 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4660 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4747 | if (rc) { | 4661 | if (rc) |
4748 | cFYI(1, ("SetPathInfo (file size) returned %d", rc)); | 4662 | cFYI(1, ("SetPathInfo (file size) returned %d", rc)); |
4749 | } | ||
4750 | 4663 | ||
4751 | cifs_buf_release(pSMB); | 4664 | cifs_buf_release(pSMB); |
4752 | 4665 | ||
@@ -4897,9 +4810,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, | |||
4897 | pSMB->ByteCount = cpu_to_le16(byte_count); | 4810 | pSMB->ByteCount = cpu_to_le16(byte_count); |
4898 | memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); | 4811 | memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); |
4899 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); | 4812 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); |
4900 | if (rc) { | 4813 | if (rc) |
4901 | cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc)); | 4814 | cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc)); |
4902 | } | ||
4903 | 4815 | ||
4904 | /* Note: On -EAGAIN error only caller can retry on handle based calls | 4816 | /* Note: On -EAGAIN error only caller can retry on handle based calls |
4905 | since file handle passed in no longer valid */ | 4817 | since file handle passed in no longer valid */ |
@@ -4975,9 +4887,8 @@ SetTimesRetry: | |||
4975 | pSMB->ByteCount = cpu_to_le16(byte_count); | 4887 | pSMB->ByteCount = cpu_to_le16(byte_count); |
4976 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4888 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4977 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4889 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4978 | if (rc) { | 4890 | if (rc) |
4979 | cFYI(1, ("SetPathInfo (times) returned %d", rc)); | 4891 | cFYI(1, ("SetPathInfo (times) returned %d", rc)); |
4980 | } | ||
4981 | 4892 | ||
4982 | cifs_buf_release(pSMB); | 4893 | cifs_buf_release(pSMB); |
4983 | 4894 | ||
@@ -5027,9 +4938,8 @@ SetAttrLgcyRetry: | |||
5027 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 4938 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
5028 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4939 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
5029 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4940 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
5030 | if (rc) { | 4941 | if (rc) |
5031 | cFYI(1, ("Error in LegacySetAttr = %d", rc)); | 4942 | cFYI(1, ("Error in LegacySetAttr = %d", rc)); |
5032 | } | ||
5033 | 4943 | ||
5034 | cifs_buf_release(pSMB); | 4944 | cifs_buf_release(pSMB); |
5035 | 4945 | ||
@@ -5138,9 +5048,8 @@ setPermsRetry: | |||
5138 | pSMB->ByteCount = cpu_to_le16(byte_count); | 5048 | pSMB->ByteCount = cpu_to_le16(byte_count); |
5139 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 5049 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
5140 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 5050 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
5141 | if (rc) { | 5051 | if (rc) |
5142 | cFYI(1, ("SetPathInfo (perms) returned %d", rc)); | 5052 | cFYI(1, ("SetPathInfo (perms) returned %d", rc)); |
5143 | } | ||
5144 | 5053 | ||
5145 | if (pSMB) | 5054 | if (pSMB) |
5146 | cifs_buf_release(pSMB); | 5055 | cifs_buf_release(pSMB); |
@@ -5615,9 +5524,8 @@ SetEARetry: | |||
5615 | pSMB->ByteCount = cpu_to_le16(byte_count); | 5524 | pSMB->ByteCount = cpu_to_le16(byte_count); |
5616 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 5525 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
5617 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 5526 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
5618 | if (rc) { | 5527 | if (rc) |
5619 | cFYI(1, ("SetPathInfo (EA) returned %d", rc)); | 5528 | cFYI(1, ("SetPathInfo (EA) returned %d", rc)); |
5620 | } | ||
5621 | 5529 | ||
5622 | cifs_buf_release(pSMB); | 5530 | cifs_buf_release(pSMB); |
5623 | 5531 | ||
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 65d0ba72e78f..8dbfa97cd18c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1722,8 +1722,15 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, | |||
1722 | originally at mount time */ | 1722 | originally at mount time */ |
1723 | if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0) | 1723 | if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0) |
1724 | cap &= ~CIFS_UNIX_POSIX_ACL_CAP; | 1724 | cap &= ~CIFS_UNIX_POSIX_ACL_CAP; |
1725 | if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) | 1725 | if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) { |
1726 | if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) | ||
1727 | cERROR(1, ("POSIXPATH support change")); | ||
1726 | cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; | 1728 | cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; |
1729 | } else if ((cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) { | ||
1730 | cERROR(1, ("possible reconnect error")); | ||
1731 | cERROR(1, | ||
1732 | ("server disabled POSIX path support")); | ||
1733 | } | ||
1727 | } | 1734 | } |
1728 | 1735 | ||
1729 | cap &= CIFS_UNIX_CAP_MASK; | 1736 | cap &= CIFS_UNIX_CAP_MASK; |
@@ -1753,9 +1760,8 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, | |||
1753 | if (sb && (CIFS_SB(sb)->rsize > 127 * 1024)) { | 1760 | if (sb && (CIFS_SB(sb)->rsize > 127 * 1024)) { |
1754 | if ((cap & CIFS_UNIX_LARGE_READ_CAP) == 0) { | 1761 | if ((cap & CIFS_UNIX_LARGE_READ_CAP) == 0) { |
1755 | CIFS_SB(sb)->rsize = 127 * 1024; | 1762 | CIFS_SB(sb)->rsize = 127 * 1024; |
1756 | #ifdef CONFIG_CIFS_DEBUG2 | 1763 | cFYI(DBG2, |
1757 | cFYI(1, ("larger reads not supported by srv")); | 1764 | ("larger reads not supported by srv")); |
1758 | #endif | ||
1759 | } | 1765 | } |
1760 | } | 1766 | } |
1761 | 1767 | ||
@@ -1792,6 +1798,26 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, | |||
1792 | } | 1798 | } |
1793 | } | 1799 | } |
1794 | 1800 | ||
1801 | static void | ||
1802 | convert_delimiter(char *path, char delim) | ||
1803 | { | ||
1804 | int i; | ||
1805 | char old_delim; | ||
1806 | |||
1807 | if (path == NULL) | ||
1808 | return; | ||
1809 | |||
1810 | if (delim == '/') | ||
1811 | old_delim = '\\'; | ||
1812 | else | ||
1813 | old_delim = '/'; | ||
1814 | |||
1815 | for (i = 0; path[i] != '\0'; i++) { | ||
1816 | if (path[i] == old_delim) | ||
1817 | path[i] = delim; | ||
1818 | } | ||
1819 | } | ||
1820 | |||
1795 | int | 1821 | int |
1796 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | 1822 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, |
1797 | char *mount_data, const char *devname) | 1823 | char *mount_data, const char *devname) |
@@ -2057,7 +2083,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2057 | cifs_sb->prepath = volume_info.prepath; | 2083 | cifs_sb->prepath = volume_info.prepath; |
2058 | if (cifs_sb->prepath) { | 2084 | if (cifs_sb->prepath) { |
2059 | cifs_sb->prepathlen = strlen(cifs_sb->prepath); | 2085 | cifs_sb->prepathlen = strlen(cifs_sb->prepath); |
2060 | cifs_sb->prepath[0] = CIFS_DIR_SEP(cifs_sb); | 2086 | /* we can not convert the / to \ in the path |
2087 | separators in the prefixpath yet because we do not | ||
2088 | know (until reset_cifs_unix_caps is called later) | ||
2089 | whether POSIX PATH CAP is available. We normalize | ||
2090 | the / to \ after reset_cifs_unix_caps is called */ | ||
2061 | volume_info.prepath = NULL; | 2091 | volume_info.prepath = NULL; |
2062 | } else | 2092 | } else |
2063 | cifs_sb->prepathlen = 0; | 2093 | cifs_sb->prepathlen = 0; |
@@ -2225,11 +2255,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2225 | else | 2255 | else |
2226 | tcon->unix_ext = 0; /* server does not support them */ | 2256 | tcon->unix_ext = 0; /* server does not support them */ |
2227 | 2257 | ||
2258 | /* convert forward to back slashes in prepath here if needed */ | ||
2259 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) == 0) | ||
2260 | convert_delimiter(cifs_sb->prepath, | ||
2261 | CIFS_DIR_SEP(cifs_sb)); | ||
2262 | |||
2228 | if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) { | 2263 | if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) { |
2229 | cifs_sb->rsize = 1024 * 127; | 2264 | cifs_sb->rsize = 1024 * 127; |
2230 | #ifdef CONFIG_CIFS_DEBUG2 | 2265 | cFYI(DBG2, |
2231 | cFYI(1, ("no very large read support, rsize now 127K")); | 2266 | ("no very large read support, rsize now 127K")); |
2232 | #endif | ||
2233 | } | 2267 | } |
2234 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) | 2268 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) |
2235 | cifs_sb->wsize = min(cifs_sb->wsize, | 2269 | cifs_sb->wsize = min(cifs_sb->wsize, |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 699ec1198409..4e83b47c4b34 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * vfs operations that deal with dentries | 4 | * vfs operations that deal with dentries |
5 | * | 5 | * |
6 | * Copyright (C) International Business Machines Corp., 2002,2007 | 6 | * Copyright (C) International Business Machines Corp., 2002,2008 |
7 | * Author(s): Steve French (sfrench@us.ibm.com) | 7 | * Author(s): Steve French (sfrench@us.ibm.com) |
8 | * | 8 | * |
9 | * This library is free software; you can redistribute it and/or modify | 9 | * This library is free software; you can redistribute it and/or modify |
@@ -111,16 +111,6 @@ cifs_bp_rename_retry: | |||
111 | return full_path; | 111 | return full_path; |
112 | } | 112 | } |
113 | 113 | ||
114 | /* char * build_wildcard_path_from_dentry(struct dentry *direntry) | ||
115 | { | ||
116 | if(full_path == NULL) | ||
117 | return full_path; | ||
118 | |||
119 | full_path[namelen] = '\\'; | ||
120 | full_path[namelen+1] = '*'; | ||
121 | full_path[namelen+2] = 0; | ||
122 | BB remove above eight lines BB */ | ||
123 | |||
124 | /* Inode operations in similar order to how they appear in Linux file fs.h */ | 114 | /* Inode operations in similar order to how they appear in Linux file fs.h */ |
125 | 115 | ||
126 | int | 116 | int |
@@ -171,9 +161,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
171 | disposition = FILE_OVERWRITE_IF; | 161 | disposition = FILE_OVERWRITE_IF; |
172 | else if ((oflags & O_CREAT) == O_CREAT) | 162 | else if ((oflags & O_CREAT) == O_CREAT) |
173 | disposition = FILE_OPEN_IF; | 163 | disposition = FILE_OPEN_IF; |
174 | else { | 164 | else |
175 | cFYI(1, ("Create flag not set in create function")); | 165 | cFYI(1, ("Create flag not set in create function")); |
176 | } | ||
177 | } | 166 | } |
178 | 167 | ||
179 | /* BB add processing to set equivalent of mode - e.g. via CreateX with | 168 | /* BB add processing to set equivalent of mode - e.g. via CreateX with |
@@ -367,7 +356,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, | |||
367 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { | 356 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { |
368 | int oplock = 0; | 357 | int oplock = 0; |
369 | u16 fileHandle; | 358 | u16 fileHandle; |
370 | FILE_ALL_INFO * buf; | 359 | FILE_ALL_INFO *buf; |
371 | 360 | ||
372 | cFYI(1, ("sfu compat create special file")); | 361 | cFYI(1, ("sfu compat create special file")); |
373 | 362 | ||
@@ -534,9 +523,8 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) | |||
534 | int isValid = 1; | 523 | int isValid = 1; |
535 | 524 | ||
536 | if (direntry->d_inode) { | 525 | if (direntry->d_inode) { |
537 | if (cifs_revalidate(direntry)) { | 526 | if (cifs_revalidate(direntry)) |
538 | return 0; | 527 | return 0; |
539 | } | ||
540 | } else { | 528 | } else { |
541 | cFYI(1, ("neg dentry 0x%p name = %s", | 529 | cFYI(1, ("neg dentry 0x%p name = %s", |
542 | direntry, direntry->d_name.name)); | 530 | direntry, direntry->d_name.name)); |
diff --git a/fs/cifs/dns_resolve.h b/fs/cifs/dns_resolve.h index 073fdc3db419..966e9288930b 100644 --- a/fs/cifs/dns_resolve.h +++ b/fs/cifs/dns_resolve.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/dns_resolve.h -- DNS Resolver upcall management for CIFS DFS | 2 | * fs/cifs/dns_resolve.h -- DNS Resolver upcall management for CIFS DFS |
3 | * Handles host name to IP address resolution | 3 | * Handles host name to IP address resolution |
4 | * | 4 | * |
5 | * Copyright (c) International Business Machines Corp., 2008 | 5 | * Copyright (c) International Business Machines Corp., 2008 |
6 | * Author(s): Steve French (sfrench@us.ibm.com) | 6 | * Author(s): Steve French (sfrench@us.ibm.com) |
7 | * | 7 | * |
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c index 995474c90885..7d1d5aa4c430 100644 --- a/fs/cifs/fcntl.c +++ b/fs/cifs/fcntl.c | |||
@@ -35,9 +35,8 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags) | |||
35 | 35 | ||
36 | /* No way on Linux VFS to ask to monitor xattr | 36 | /* No way on Linux VFS to ask to monitor xattr |
37 | changes (and no stream support either */ | 37 | changes (and no stream support either */ |
38 | if (fcntl_notify_flags & DN_ACCESS) { | 38 | if (fcntl_notify_flags & DN_ACCESS) |
39 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_ACCESS; | 39 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_ACCESS; |
40 | } | ||
41 | if (fcntl_notify_flags & DN_MODIFY) { | 40 | if (fcntl_notify_flags & DN_MODIFY) { |
42 | /* What does this mean on directories? */ | 41 | /* What does this mean on directories? */ |
43 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE | | 42 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE | |
@@ -47,9 +46,8 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags) | |||
47 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION | | 46 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION | |
48 | FILE_NOTIFY_CHANGE_LAST_WRITE; | 47 | FILE_NOTIFY_CHANGE_LAST_WRITE; |
49 | } | 48 | } |
50 | if (fcntl_notify_flags & DN_DELETE) { | 49 | if (fcntl_notify_flags & DN_DELETE) |
51 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE; | 50 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE; |
52 | } | ||
53 | if (fcntl_notify_flags & DN_RENAME) { | 51 | if (fcntl_notify_flags & DN_RENAME) { |
54 | /* BB review this - checking various server behaviors */ | 52 | /* BB review this - checking various server behaviors */ |
55 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME | | 53 | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME | |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 5f7c374ae89c..fa849c91d323 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -353,9 +353,9 @@ static int cifs_reopen_file(struct file *file, int can_flush) | |||
353 | int disposition = FILE_OPEN; | 353 | int disposition = FILE_OPEN; |
354 | __u16 netfid; | 354 | __u16 netfid; |
355 | 355 | ||
356 | if (file->private_data) { | 356 | if (file->private_data) |
357 | pCifsFile = (struct cifsFileInfo *)file->private_data; | 357 | pCifsFile = (struct cifsFileInfo *)file->private_data; |
358 | } else | 358 | else |
359 | return -EBADF; | 359 | return -EBADF; |
360 | 360 | ||
361 | xid = GetXid(); | 361 | xid = GetXid(); |
@@ -499,9 +499,8 @@ int cifs_close(struct inode *inode, struct file *file) | |||
499 | the struct would be in each open file, | 499 | the struct would be in each open file, |
500 | but this should give enough time to | 500 | but this should give enough time to |
501 | clear the socket */ | 501 | clear the socket */ |
502 | #ifdef CONFIG_CIFS_DEBUG2 | 502 | cFYI(DBG2, |
503 | cFYI(1, ("close delay, write pending")); | 503 | ("close delay, write pending")); |
504 | #endif /* DEBUG2 */ | ||
505 | msleep(timeout); | 504 | msleep(timeout); |
506 | timeout *= 4; | 505 | timeout *= 4; |
507 | } | 506 | } |
@@ -1423,9 +1422,8 @@ static int cifs_writepage(struct page *page, struct writeback_control *wbc) | |||
1423 | xid = GetXid(); | 1422 | xid = GetXid(); |
1424 | /* BB add check for wbc flags */ | 1423 | /* BB add check for wbc flags */ |
1425 | page_cache_get(page); | 1424 | page_cache_get(page); |
1426 | if (!PageUptodate(page)) { | 1425 | if (!PageUptodate(page)) |
1427 | cFYI(1, ("ppw - page not up to date")); | 1426 | cFYI(1, ("ppw - page not up to date")); |
1428 | } | ||
1429 | 1427 | ||
1430 | /* | 1428 | /* |
1431 | * Set the "writeback" flag, and clear "dirty" in the radix tree. | 1429 | * Set the "writeback" flag, and clear "dirty" in the radix tree. |
@@ -1460,9 +1458,9 @@ static int cifs_commit_write(struct file *file, struct page *page, | |||
1460 | cFYI(1, ("commit write for page %p up to position %lld for %d", | 1458 | cFYI(1, ("commit write for page %p up to position %lld for %d", |
1461 | page, position, to)); | 1459 | page, position, to)); |
1462 | spin_lock(&inode->i_lock); | 1460 | spin_lock(&inode->i_lock); |
1463 | if (position > inode->i_size) { | 1461 | if (position > inode->i_size) |
1464 | i_size_write(inode, position); | 1462 | i_size_write(inode, position); |
1465 | } | 1463 | |
1466 | spin_unlock(&inode->i_lock); | 1464 | spin_unlock(&inode->i_lock); |
1467 | if (!PageUptodate(page)) { | 1465 | if (!PageUptodate(page)) { |
1468 | position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + offset; | 1466 | position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + offset; |
@@ -1596,9 +1594,9 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1596 | } | 1594 | } |
1597 | open_file = (struct cifsFileInfo *)file->private_data; | 1595 | open_file = (struct cifsFileInfo *)file->private_data; |
1598 | 1596 | ||
1599 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) { | 1597 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) |
1600 | cFYI(1, ("attempting read on write only file instance")); | 1598 | cFYI(1, ("attempting read on write only file instance")); |
1601 | } | 1599 | |
1602 | for (total_read = 0, current_offset = read_data; | 1600 | for (total_read = 0, current_offset = read_data; |
1603 | read_size > total_read; | 1601 | read_size > total_read; |
1604 | total_read += bytes_read, current_offset += bytes_read) { | 1602 | total_read += bytes_read, current_offset += bytes_read) { |
@@ -1625,9 +1623,8 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1625 | smb_read_data + | 1623 | smb_read_data + |
1626 | 4 /* RFC1001 length field */ + | 1624 | 4 /* RFC1001 length field */ + |
1627 | le16_to_cpu(pSMBr->DataOffset), | 1625 | le16_to_cpu(pSMBr->DataOffset), |
1628 | bytes_read)) { | 1626 | bytes_read)) |
1629 | rc = -EFAULT; | 1627 | rc = -EFAULT; |
1630 | } | ||
1631 | 1628 | ||
1632 | if (buf_type == CIFS_SMALL_BUFFER) | 1629 | if (buf_type == CIFS_SMALL_BUFFER) |
1633 | cifs_small_buf_release(smb_read_data); | 1630 | cifs_small_buf_release(smb_read_data); |
@@ -1814,9 +1811,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
1814 | pTcon = cifs_sb->tcon; | 1811 | pTcon = cifs_sb->tcon; |
1815 | 1812 | ||
1816 | pagevec_init(&lru_pvec, 0); | 1813 | pagevec_init(&lru_pvec, 0); |
1817 | #ifdef CONFIG_CIFS_DEBUG2 | 1814 | cFYI(DBG2, ("rpages: num pages %d", num_pages)); |
1818 | cFYI(1, ("rpages: num pages %d", num_pages)); | ||
1819 | #endif | ||
1820 | for (i = 0; i < num_pages; ) { | 1815 | for (i = 0; i < num_pages; ) { |
1821 | unsigned contig_pages; | 1816 | unsigned contig_pages; |
1822 | struct page *tmp_page; | 1817 | struct page *tmp_page; |
@@ -1849,10 +1844,8 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
1849 | /* Read size needs to be in multiples of one page */ | 1844 | /* Read size needs to be in multiples of one page */ |
1850 | read_size = min_t(const unsigned int, read_size, | 1845 | read_size = min_t(const unsigned int, read_size, |
1851 | cifs_sb->rsize & PAGE_CACHE_MASK); | 1846 | cifs_sb->rsize & PAGE_CACHE_MASK); |
1852 | #ifdef CONFIG_CIFS_DEBUG2 | 1847 | cFYI(DBG2, ("rpages: read size 0x%x contiguous pages %d", |
1853 | cFYI(1, ("rpages: read size 0x%x contiguous pages %d", | ||
1854 | read_size, contig_pages)); | 1848 | read_size, contig_pages)); |
1855 | #endif | ||
1856 | rc = -EAGAIN; | 1849 | rc = -EAGAIN; |
1857 | while (rc == -EAGAIN) { | 1850 | while (rc == -EAGAIN) { |
1858 | if ((open_file->invalidHandle) && | 1851 | if ((open_file->invalidHandle) && |
@@ -2026,7 +2019,7 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | |||
2026 | struct cifs_sb_info *cifs_sb; | 2019 | struct cifs_sb_info *cifs_sb; |
2027 | 2020 | ||
2028 | cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); | 2021 | cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); |
2029 | if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) { | 2022 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
2030 | /* since no page cache to corrupt on directio | 2023 | /* since no page cache to corrupt on directio |
2031 | we can change size safely */ | 2024 | we can change size safely */ |
2032 | return 1; | 2025 | return 1; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index b1a4a65eaa08..24eb4d392155 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -29,6 +29,130 @@ | |||
29 | #include "cifs_debug.h" | 29 | #include "cifs_debug.h" |
30 | #include "cifs_fs_sb.h" | 30 | #include "cifs_fs_sb.h" |
31 | 31 | ||
32 | |||
33 | static void cifs_set_ops(struct inode *inode) | ||
34 | { | ||
35 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | ||
36 | |||
37 | switch (inode->i_mode & S_IFMT) { | ||
38 | case S_IFREG: | ||
39 | inode->i_op = &cifs_file_inode_ops; | ||
40 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | ||
41 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
42 | inode->i_fop = &cifs_file_direct_nobrl_ops; | ||
43 | else | ||
44 | inode->i_fop = &cifs_file_direct_ops; | ||
45 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
46 | inode->i_fop = &cifs_file_nobrl_ops; | ||
47 | else { /* not direct, send byte range locks */ | ||
48 | inode->i_fop = &cifs_file_ops; | ||
49 | } | ||
50 | |||
51 | |||
52 | /* check if server can support readpages */ | ||
53 | if (cifs_sb->tcon->ses->server->maxBuf < | ||
54 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) | ||
55 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | ||
56 | else | ||
57 | inode->i_data.a_ops = &cifs_addr_ops; | ||
58 | break; | ||
59 | case S_IFDIR: | ||
60 | inode->i_op = &cifs_dir_inode_ops; | ||
61 | inode->i_fop = &cifs_dir_ops; | ||
62 | break; | ||
63 | case S_IFLNK: | ||
64 | inode->i_op = &cifs_symlink_inode_ops; | ||
65 | break; | ||
66 | default: | ||
67 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | ||
68 | break; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | static void cifs_unix_info_to_inode(struct inode *inode, | ||
73 | FILE_UNIX_BASIC_INFO *info, int force_uid_gid) | ||
74 | { | ||
75 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | ||
76 | struct cifsInodeInfo *cifsInfo = CIFS_I(inode); | ||
77 | __u64 num_of_bytes = le64_to_cpu(info->NumOfBytes); | ||
78 | __u64 end_of_file = le64_to_cpu(info->EndOfFile); | ||
79 | |||
80 | inode->i_atime = cifs_NTtimeToUnix(le64_to_cpu(info->LastAccessTime)); | ||
81 | inode->i_mtime = | ||
82 | cifs_NTtimeToUnix(le64_to_cpu(info->LastModificationTime)); | ||
83 | inode->i_ctime = cifs_NTtimeToUnix(le64_to_cpu(info->LastStatusChange)); | ||
84 | inode->i_mode = le64_to_cpu(info->Permissions); | ||
85 | |||
86 | /* | ||
87 | * Since we set the inode type below we need to mask off | ||
88 | * to avoid strange results if bits set above. | ||
89 | */ | ||
90 | inode->i_mode &= ~S_IFMT; | ||
91 | switch (le32_to_cpu(info->Type)) { | ||
92 | case UNIX_FILE: | ||
93 | inode->i_mode |= S_IFREG; | ||
94 | break; | ||
95 | case UNIX_SYMLINK: | ||
96 | inode->i_mode |= S_IFLNK; | ||
97 | break; | ||
98 | case UNIX_DIR: | ||
99 | inode->i_mode |= S_IFDIR; | ||
100 | break; | ||
101 | case UNIX_CHARDEV: | ||
102 | inode->i_mode |= S_IFCHR; | ||
103 | inode->i_rdev = MKDEV(le64_to_cpu(info->DevMajor), | ||
104 | le64_to_cpu(info->DevMinor) & MINORMASK); | ||
105 | break; | ||
106 | case UNIX_BLOCKDEV: | ||
107 | inode->i_mode |= S_IFBLK; | ||
108 | inode->i_rdev = MKDEV(le64_to_cpu(info->DevMajor), | ||
109 | le64_to_cpu(info->DevMinor) & MINORMASK); | ||
110 | break; | ||
111 | case UNIX_FIFO: | ||
112 | inode->i_mode |= S_IFIFO; | ||
113 | break; | ||
114 | case UNIX_SOCKET: | ||
115 | inode->i_mode |= S_IFSOCK; | ||
116 | break; | ||
117 | default: | ||
118 | /* safest to call it a file if we do not know */ | ||
119 | inode->i_mode |= S_IFREG; | ||
120 | cFYI(1, ("unknown type %d", le32_to_cpu(info->Type))); | ||
121 | break; | ||
122 | } | ||
123 | |||
124 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) && | ||
125 | !force_uid_gid) | ||
126 | inode->i_uid = cifs_sb->mnt_uid; | ||
127 | else | ||
128 | inode->i_uid = le64_to_cpu(info->Uid); | ||
129 | |||
130 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) && | ||
131 | !force_uid_gid) | ||
132 | inode->i_gid = cifs_sb->mnt_gid; | ||
133 | else | ||
134 | inode->i_gid = le64_to_cpu(info->Gid); | ||
135 | |||
136 | inode->i_nlink = le64_to_cpu(info->Nlinks); | ||
137 | |||
138 | spin_lock(&inode->i_lock); | ||
139 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | ||
140 | /* | ||
141 | * We can not safely change the file size here if the client | ||
142 | * is writing to it due to potential races. | ||
143 | */ | ||
144 | i_size_write(inode, end_of_file); | ||
145 | |||
146 | /* | ||
147 | * i_blocks is not related to (i_size / i_blksize), | ||
148 | * but instead 512 byte (2**9) size is required for | ||
149 | * calculating num blocks. | ||
150 | */ | ||
151 | inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; | ||
152 | } | ||
153 | spin_unlock(&inode->i_lock); | ||
154 | } | ||
155 | |||
32 | int cifs_get_inode_info_unix(struct inode **pinode, | 156 | int cifs_get_inode_info_unix(struct inode **pinode, |
33 | const unsigned char *search_path, struct super_block *sb, int xid) | 157 | const unsigned char *search_path, struct super_block *sb, int xid) |
34 | { | 158 | { |
@@ -74,7 +198,6 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
74 | } | 198 | } |
75 | } else { | 199 | } else { |
76 | struct cifsInodeInfo *cifsInfo; | 200 | struct cifsInodeInfo *cifsInfo; |
77 | __u32 type = le32_to_cpu(findData.Type); | ||
78 | __u64 num_of_bytes = le64_to_cpu(findData.NumOfBytes); | 201 | __u64 num_of_bytes = le64_to_cpu(findData.NumOfBytes); |
79 | __u64 end_of_file = le64_to_cpu(findData.EndOfFile); | 202 | __u64 end_of_file = le64_to_cpu(findData.EndOfFile); |
80 | 203 | ||
@@ -105,112 +228,16 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
105 | /* this is ok to set on every inode revalidate */ | 228 | /* this is ok to set on every inode revalidate */ |
106 | atomic_set(&cifsInfo->inUse, 1); | 229 | atomic_set(&cifsInfo->inUse, 1); |
107 | 230 | ||
108 | inode->i_atime = | 231 | cifs_unix_info_to_inode(inode, &findData, 0); |
109 | cifs_NTtimeToUnix(le64_to_cpu(findData.LastAccessTime)); | ||
110 | inode->i_mtime = | ||
111 | cifs_NTtimeToUnix(le64_to_cpu | ||
112 | (findData.LastModificationTime)); | ||
113 | inode->i_ctime = | ||
114 | cifs_NTtimeToUnix(le64_to_cpu(findData.LastStatusChange)); | ||
115 | inode->i_mode = le64_to_cpu(findData.Permissions); | ||
116 | /* since we set the inode type below we need to mask off | ||
117 | to avoid strange results if bits set above */ | ||
118 | inode->i_mode &= ~S_IFMT; | ||
119 | if (type == UNIX_FILE) { | ||
120 | inode->i_mode |= S_IFREG; | ||
121 | } else if (type == UNIX_SYMLINK) { | ||
122 | inode->i_mode |= S_IFLNK; | ||
123 | } else if (type == UNIX_DIR) { | ||
124 | inode->i_mode |= S_IFDIR; | ||
125 | } else if (type == UNIX_CHARDEV) { | ||
126 | inode->i_mode |= S_IFCHR; | ||
127 | inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), | ||
128 | le64_to_cpu(findData.DevMinor) & MINORMASK); | ||
129 | } else if (type == UNIX_BLOCKDEV) { | ||
130 | inode->i_mode |= S_IFBLK; | ||
131 | inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor), | ||
132 | le64_to_cpu(findData.DevMinor) & MINORMASK); | ||
133 | } else if (type == UNIX_FIFO) { | ||
134 | inode->i_mode |= S_IFIFO; | ||
135 | } else if (type == UNIX_SOCKET) { | ||
136 | inode->i_mode |= S_IFSOCK; | ||
137 | } else { | ||
138 | /* safest to call it a file if we do not know */ | ||
139 | inode->i_mode |= S_IFREG; | ||
140 | cFYI(1, ("unknown type %d", type)); | ||
141 | } | ||
142 | 232 | ||
143 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) | ||
144 | inode->i_uid = cifs_sb->mnt_uid; | ||
145 | else | ||
146 | inode->i_uid = le64_to_cpu(findData.Uid); | ||
147 | |||
148 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) | ||
149 | inode->i_gid = cifs_sb->mnt_gid; | ||
150 | else | ||
151 | inode->i_gid = le64_to_cpu(findData.Gid); | ||
152 | |||
153 | inode->i_nlink = le64_to_cpu(findData.Nlinks); | ||
154 | |||
155 | spin_lock(&inode->i_lock); | ||
156 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | ||
157 | /* can not safely change the file size here if the | ||
158 | client is writing to it due to potential races */ | ||
159 | i_size_write(inode, end_of_file); | ||
160 | |||
161 | /* blksize needs to be multiple of two. So safer to default to | ||
162 | blksize and blkbits set in superblock so 2**blkbits and blksize | ||
163 | will match rather than setting to: | ||
164 | (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ | ||
165 | |||
166 | /* This seems incredibly stupid but it turns out that i_blocks | ||
167 | is not related to (i_size / i_blksize), instead 512 byte size | ||
168 | is required for calculating num blocks */ | ||
169 | |||
170 | /* 512 bytes (2**9) is the fake blocksize that must be used */ | ||
171 | /* for this calculation */ | ||
172 | inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; | ||
173 | } | ||
174 | spin_unlock(&inode->i_lock); | ||
175 | 233 | ||
176 | if (num_of_bytes < end_of_file) | 234 | if (num_of_bytes < end_of_file) |
177 | cFYI(1, ("allocation size less than end of file")); | 235 | cFYI(1, ("allocation size less than end of file")); |
178 | cFYI(1, ("Size %ld and blocks %llu", | 236 | cFYI(1, ("Size %ld and blocks %llu", |
179 | (unsigned long) inode->i_size, | 237 | (unsigned long) inode->i_size, |
180 | (unsigned long long)inode->i_blocks)); | 238 | (unsigned long long)inode->i_blocks)); |
181 | if (S_ISREG(inode->i_mode)) { | 239 | |
182 | cFYI(1, ("File inode")); | 240 | cifs_set_ops(inode); |
183 | inode->i_op = &cifs_file_inode_ops; | ||
184 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | ||
185 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
186 | inode->i_fop = | ||
187 | &cifs_file_direct_nobrl_ops; | ||
188 | else | ||
189 | inode->i_fop = &cifs_file_direct_ops; | ||
190 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
191 | inode->i_fop = &cifs_file_nobrl_ops; | ||
192 | else /* not direct, send byte range locks */ | ||
193 | inode->i_fop = &cifs_file_ops; | ||
194 | |||
195 | /* check if server can support readpages */ | ||
196 | if (pTcon->ses->server->maxBuf < | ||
197 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) | ||
198 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | ||
199 | else | ||
200 | inode->i_data.a_ops = &cifs_addr_ops; | ||
201 | } else if (S_ISDIR(inode->i_mode)) { | ||
202 | cFYI(1, ("Directory inode")); | ||
203 | inode->i_op = &cifs_dir_inode_ops; | ||
204 | inode->i_fop = &cifs_dir_ops; | ||
205 | } else if (S_ISLNK(inode->i_mode)) { | ||
206 | cFYI(1, ("Symbolic Link inode")); | ||
207 | inode->i_op = &cifs_symlink_inode_ops; | ||
208 | /* tmp_inode->i_fop = */ /* do not need to set to anything */ | ||
209 | } else { | ||
210 | cFYI(1, ("Init special inode")); | ||
211 | init_special_inode(inode, inode->i_mode, | ||
212 | inode->i_rdev); | ||
213 | } | ||
214 | } | 241 | } |
215 | return rc; | 242 | return rc; |
216 | } | 243 | } |
@@ -490,9 +517,9 @@ int cifs_get_inode_info(struct inode **pinode, | |||
490 | if (decode_sfu_inode(inode, | 517 | if (decode_sfu_inode(inode, |
491 | le64_to_cpu(pfindData->EndOfFile), | 518 | le64_to_cpu(pfindData->EndOfFile), |
492 | search_path, | 519 | search_path, |
493 | cifs_sb, xid)) { | 520 | cifs_sb, xid)) |
494 | cFYI(1, ("Unrecognized sfu inode type")); | 521 | cFYI(1, ("Unrecognized sfu inode type")); |
495 | } | 522 | |
496 | cFYI(1, ("sfu mode 0%o", inode->i_mode)); | 523 | cFYI(1, ("sfu mode 0%o", inode->i_mode)); |
497 | } else { | 524 | } else { |
498 | inode->i_mode |= S_IFREG; | 525 | inode->i_mode |= S_IFREG; |
@@ -546,36 +573,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
546 | atomic_set(&cifsInfo->inUse, 1); | 573 | atomic_set(&cifsInfo->inUse, 1); |
547 | } | 574 | } |
548 | 575 | ||
549 | if (S_ISREG(inode->i_mode)) { | 576 | cifs_set_ops(inode); |
550 | cFYI(1, ("File inode")); | ||
551 | inode->i_op = &cifs_file_inode_ops; | ||
552 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | ||
553 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
554 | inode->i_fop = | ||
555 | &cifs_file_direct_nobrl_ops; | ||
556 | else | ||
557 | inode->i_fop = &cifs_file_direct_ops; | ||
558 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
559 | inode->i_fop = &cifs_file_nobrl_ops; | ||
560 | else /* not direct, send byte range locks */ | ||
561 | inode->i_fop = &cifs_file_ops; | ||
562 | |||
563 | if (pTcon->ses->server->maxBuf < | ||
564 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) | ||
565 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | ||
566 | else | ||
567 | inode->i_data.a_ops = &cifs_addr_ops; | ||
568 | } else if (S_ISDIR(inode->i_mode)) { | ||
569 | cFYI(1, ("Directory inode")); | ||
570 | inode->i_op = &cifs_dir_inode_ops; | ||
571 | inode->i_fop = &cifs_dir_ops; | ||
572 | } else if (S_ISLNK(inode->i_mode)) { | ||
573 | cFYI(1, ("Symbolic Link inode")); | ||
574 | inode->i_op = &cifs_symlink_inode_ops; | ||
575 | } else { | ||
576 | init_special_inode(inode, inode->i_mode, | ||
577 | inode->i_rdev); | ||
578 | } | ||
579 | } | 577 | } |
580 | kfree(buf); | 578 | kfree(buf); |
581 | return rc; | 579 | return rc; |
@@ -792,17 +790,12 @@ psx_del_no_retry: | |||
792 | } | 790 | } |
793 | 791 | ||
794 | static void posix_fill_in_inode(struct inode *tmp_inode, | 792 | static void posix_fill_in_inode(struct inode *tmp_inode, |
795 | FILE_UNIX_BASIC_INFO *pData, int *pobject_type, int isNewInode) | 793 | FILE_UNIX_BASIC_INFO *pData, int isNewInode) |
796 | { | 794 | { |
795 | struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); | ||
797 | loff_t local_size; | 796 | loff_t local_size; |
798 | struct timespec local_mtime; | 797 | struct timespec local_mtime; |
799 | 798 | ||
800 | struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); | ||
801 | struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb); | ||
802 | |||
803 | __u32 type = le32_to_cpu(pData->Type); | ||
804 | __u64 num_of_bytes = le64_to_cpu(pData->NumOfBytes); | ||
805 | __u64 end_of_file = le64_to_cpu(pData->EndOfFile); | ||
806 | cifsInfo->time = jiffies; | 799 | cifsInfo->time = jiffies; |
807 | atomic_inc(&cifsInfo->inUse); | 800 | atomic_inc(&cifsInfo->inUse); |
808 | 801 | ||
@@ -810,115 +803,27 @@ static void posix_fill_in_inode(struct inode *tmp_inode, | |||
810 | local_mtime = tmp_inode->i_mtime; | 803 | local_mtime = tmp_inode->i_mtime; |
811 | local_size = tmp_inode->i_size; | 804 | local_size = tmp_inode->i_size; |
812 | 805 | ||
813 | tmp_inode->i_atime = | 806 | cifs_unix_info_to_inode(tmp_inode, pData, 1); |
814 | cifs_NTtimeToUnix(le64_to_cpu(pData->LastAccessTime)); | 807 | cifs_set_ops(tmp_inode); |
815 | tmp_inode->i_mtime = | ||
816 | cifs_NTtimeToUnix(le64_to_cpu(pData->LastModificationTime)); | ||
817 | tmp_inode->i_ctime = | ||
818 | cifs_NTtimeToUnix(le64_to_cpu(pData->LastStatusChange)); | ||
819 | |||
820 | tmp_inode->i_mode = le64_to_cpu(pData->Permissions); | ||
821 | /* since we set the inode type below we need to mask off type | ||
822 | to avoid strange results if bits above were corrupt */ | ||
823 | tmp_inode->i_mode &= ~S_IFMT; | ||
824 | if (type == UNIX_FILE) { | ||
825 | *pobject_type = DT_REG; | ||
826 | tmp_inode->i_mode |= S_IFREG; | ||
827 | } else if (type == UNIX_SYMLINK) { | ||
828 | *pobject_type = DT_LNK; | ||
829 | tmp_inode->i_mode |= S_IFLNK; | ||
830 | } else if (type == UNIX_DIR) { | ||
831 | *pobject_type = DT_DIR; | ||
832 | tmp_inode->i_mode |= S_IFDIR; | ||
833 | } else if (type == UNIX_CHARDEV) { | ||
834 | *pobject_type = DT_CHR; | ||
835 | tmp_inode->i_mode |= S_IFCHR; | ||
836 | tmp_inode->i_rdev = MKDEV(le64_to_cpu(pData->DevMajor), | ||
837 | le64_to_cpu(pData->DevMinor) & MINORMASK); | ||
838 | } else if (type == UNIX_BLOCKDEV) { | ||
839 | *pobject_type = DT_BLK; | ||
840 | tmp_inode->i_mode |= S_IFBLK; | ||
841 | tmp_inode->i_rdev = MKDEV(le64_to_cpu(pData->DevMajor), | ||
842 | le64_to_cpu(pData->DevMinor) & MINORMASK); | ||
843 | } else if (type == UNIX_FIFO) { | ||
844 | *pobject_type = DT_FIFO; | ||
845 | tmp_inode->i_mode |= S_IFIFO; | ||
846 | } else if (type == UNIX_SOCKET) { | ||
847 | *pobject_type = DT_SOCK; | ||
848 | tmp_inode->i_mode |= S_IFSOCK; | ||
849 | } else { | ||
850 | /* safest to just call it a file */ | ||
851 | *pobject_type = DT_REG; | ||
852 | tmp_inode->i_mode |= S_IFREG; | ||
853 | cFYI(1, ("unknown inode type %d", type)); | ||
854 | } | ||
855 | |||
856 | #ifdef CONFIG_CIFS_DEBUG2 | ||
857 | cFYI(1, ("object type: %d", type)); | ||
858 | #endif | ||
859 | tmp_inode->i_uid = le64_to_cpu(pData->Uid); | ||
860 | tmp_inode->i_gid = le64_to_cpu(pData->Gid); | ||
861 | tmp_inode->i_nlink = le64_to_cpu(pData->Nlinks); | ||
862 | |||
863 | spin_lock(&tmp_inode->i_lock); | ||
864 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | ||
865 | /* can not safely change the file size here if the | ||
866 | client is writing to it due to potential races */ | ||
867 | i_size_write(tmp_inode, end_of_file); | ||
868 | 808 | ||
869 | /* 512 bytes (2**9) is the fake blocksize that must be used */ | 809 | if (!S_ISREG(tmp_inode->i_mode)) |
870 | /* for this calculation, not the real blocksize */ | 810 | return; |
871 | tmp_inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; | ||
872 | } | ||
873 | spin_unlock(&tmp_inode->i_lock); | ||
874 | |||
875 | if (S_ISREG(tmp_inode->i_mode)) { | ||
876 | cFYI(1, ("File inode")); | ||
877 | tmp_inode->i_op = &cifs_file_inode_ops; | ||
878 | |||
879 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | ||
880 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
881 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; | ||
882 | else | ||
883 | tmp_inode->i_fop = &cifs_file_direct_ops; | ||
884 | 811 | ||
885 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 812 | /* |
886 | tmp_inode->i_fop = &cifs_file_nobrl_ops; | 813 | * No sense invalidating pages for new inode |
887 | else | 814 | * since we we have not started caching |
888 | tmp_inode->i_fop = &cifs_file_ops; | 815 | * readahead file data yet. |
889 | 816 | */ | |
890 | if ((cifs_sb->tcon) && (cifs_sb->tcon->ses) && | 817 | if (isNewInode) |
891 | (cifs_sb->tcon->ses->server->maxBuf < | 818 | return; |
892 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)) | ||
893 | tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | ||
894 | else | ||
895 | tmp_inode->i_data.a_ops = &cifs_addr_ops; | ||
896 | |||
897 | if (isNewInode) | ||
898 | return; /* No sense invalidating pages for new inode | ||
899 | since we we have not started caching | ||
900 | readahead file data yet */ | ||
901 | 819 | ||
902 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && | 820 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && |
903 | (local_size == tmp_inode->i_size)) { | 821 | (local_size == tmp_inode->i_size)) { |
904 | cFYI(1, ("inode exists but unchanged")); | 822 | cFYI(1, ("inode exists but unchanged")); |
905 | } else { | ||
906 | /* file may have changed on server */ | ||
907 | cFYI(1, ("invalidate inode, readdir detected change")); | ||
908 | invalidate_remote_inode(tmp_inode); | ||
909 | } | ||
910 | } else if (S_ISDIR(tmp_inode->i_mode)) { | ||
911 | cFYI(1, ("Directory inode")); | ||
912 | tmp_inode->i_op = &cifs_dir_inode_ops; | ||
913 | tmp_inode->i_fop = &cifs_dir_ops; | ||
914 | } else if (S_ISLNK(tmp_inode->i_mode)) { | ||
915 | cFYI(1, ("Symbolic Link inode")); | ||
916 | tmp_inode->i_op = &cifs_symlink_inode_ops; | ||
917 | /* tmp_inode->i_fop = *//* do not need to set to anything */ | ||
918 | } else { | 823 | } else { |
919 | cFYI(1, ("Special inode")); | 824 | /* file may have changed on server */ |
920 | init_special_inode(tmp_inode, tmp_inode->i_mode, | 825 | cFYI(1, ("invalidate inode, readdir detected change")); |
921 | tmp_inode->i_rdev); | 826 | invalidate_remote_inode(tmp_inode); |
922 | } | 827 | } |
923 | } | 828 | } |
924 | 829 | ||
@@ -968,7 +873,6 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
968 | cFYI(1, ("posix mkdir returned 0x%x", rc)); | 873 | cFYI(1, ("posix mkdir returned 0x%x", rc)); |
969 | d_drop(direntry); | 874 | d_drop(direntry); |
970 | } else { | 875 | } else { |
971 | int obj_type; | ||
972 | if (pInfo->Type == cpu_to_le32(-1)) { | 876 | if (pInfo->Type == cpu_to_le32(-1)) { |
973 | /* no return info, go query for it */ | 877 | /* no return info, go query for it */ |
974 | kfree(pInfo); | 878 | kfree(pInfo); |
@@ -1004,7 +908,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
1004 | /* we already checked in POSIXCreate whether | 908 | /* we already checked in POSIXCreate whether |
1005 | frame was long enough */ | 909 | frame was long enough */ |
1006 | posix_fill_in_inode(direntry->d_inode, | 910 | posix_fill_in_inode(direntry->d_inode, |
1007 | pInfo, &obj_type, 1 /* NewInode */); | 911 | pInfo, 1 /* NewInode */); |
1008 | #ifdef CONFIG_CIFS_DEBUG2 | 912 | #ifdef CONFIG_CIFS_DEBUG2 |
1009 | cFYI(1, ("instantiated dentry %p %s to inode %p", | 913 | cFYI(1, ("instantiated dentry %p %s to inode %p", |
1010 | direntry, direntry->d_name.name, newinode)); | 914 | direntry, direntry->d_name.name, newinode)); |
@@ -1214,9 +1118,8 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, | |||
1214 | } /* if we can not get memory just leave rc as EEXIST */ | 1118 | } /* if we can not get memory just leave rc as EEXIST */ |
1215 | } | 1119 | } |
1216 | 1120 | ||
1217 | if (rc) { | 1121 | if (rc) |
1218 | cFYI(1, ("rename rc %d", rc)); | 1122 | cFYI(1, ("rename rc %d", rc)); |
1219 | } | ||
1220 | 1123 | ||
1221 | if ((rc == -EIO) || (rc == -EEXIST)) { | 1124 | if ((rc == -EIO) || (rc == -EEXIST)) { |
1222 | int oplock = FALSE; | 1125 | int oplock = FALSE; |
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index d24fe6880a04..5c792df13d62 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) | 31 | #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) |
32 | 32 | ||
33 | int cifs_ioctl (struct inode *inode, struct file *filep, | 33 | int cifs_ioctl(struct inode *inode, struct file *filep, |
34 | unsigned int command, unsigned long arg) | 34 | unsigned int command, unsigned long arg) |
35 | { | 35 | { |
36 | int rc = -ENOTTY; /* strange error - but the precedent */ | 36 | int rc = -ENOTTY; /* strange error - but the precedent */ |
diff --git a/fs/cifs/md4.c b/fs/cifs/md4.c index a2415c1a14db..a725c2609d67 100644 --- a/fs/cifs/md4.c +++ b/fs/cifs/md4.c | |||
@@ -56,7 +56,7 @@ lshift(__u32 x, int s) | |||
56 | 56 | ||
57 | /* this applies md4 to 64 byte chunks */ | 57 | /* this applies md4 to 64 byte chunks */ |
58 | static void | 58 | static void |
59 | mdfour64(__u32 * M, __u32 * A, __u32 *B, __u32 * C, __u32 *D) | 59 | mdfour64(__u32 *M, __u32 *A, __u32 *B, __u32 *C, __u32 *D) |
60 | { | 60 | { |
61 | int j; | 61 | int j; |
62 | __u32 AA, BB, CC, DD; | 62 | __u32 AA, BB, CC, DD; |
@@ -137,7 +137,7 @@ mdfour64(__u32 * M, __u32 * A, __u32 *B, __u32 * C, __u32 *D) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | static void | 139 | static void |
140 | copy64(__u32 * M, unsigned char *in) | 140 | copy64(__u32 *M, unsigned char *in) |
141 | { | 141 | { |
142 | int i; | 142 | int i; |
143 | 143 | ||
diff --git a/fs/cifs/md5.c b/fs/cifs/md5.c index f13f96d42fcf..462bbfefd4b6 100644 --- a/fs/cifs/md5.c +++ b/fs/cifs/md5.c | |||
@@ -161,7 +161,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx) | |||
161 | 161 | ||
162 | /* This is the central step in the MD5 algorithm. */ | 162 | /* This is the central step in the MD5 algorithm. */ |
163 | #define MD5STEP(f, w, x, y, z, data, s) \ | 163 | #define MD5STEP(f, w, x, y, z, data, s) \ |
164 | ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) | 164 | (w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x) |
165 | 165 | ||
166 | /* | 166 | /* |
167 | * The core of the MD5 algorithm, this alters an existing MD5 hash to | 167 | * The core of the MD5 algorithm, this alters an existing MD5 hash to |
@@ -302,9 +302,8 @@ hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, | |||
302 | int i; | 302 | int i; |
303 | 303 | ||
304 | /* if key is longer than 64 bytes truncate it */ | 304 | /* if key is longer than 64 bytes truncate it */ |
305 | if (key_len > 64) { | 305 | if (key_len > 64) |
306 | key_len = 64; | 306 | key_len = 64; |
307 | } | ||
308 | 307 | ||
309 | /* start out by storing key in pads */ | 308 | /* start out by storing key in pads */ |
310 | memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad)); | 309 | memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad)); |
@@ -359,9 +358,9 @@ hmac_md5(unsigned char key[16], unsigned char *data, int data_len, | |||
359 | { | 358 | { |
360 | struct HMACMD5Context ctx; | 359 | struct HMACMD5Context ctx; |
361 | hmac_md5_init_limK_to_64(key, 16, &ctx); | 360 | hmac_md5_init_limK_to_64(key, 16, &ctx); |
362 | if (data_len != 0) { | 361 | if (data_len != 0) |
363 | hmac_md5_update(data, data_len, &ctx); | 362 | hmac_md5_update(data, data_len, &ctx); |
364 | } | 363 | |
365 | hmac_md5_final(digest, &ctx); | 364 | hmac_md5_final(digest, &ctx); |
366 | } | 365 | } |
367 | #endif | 366 | #endif |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 15546c2354c5..2a42d9fedbb2 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/misc.c | 2 | * fs/cifs/misc.c |
3 | * | 3 | * |
4 | * Copyright (C) International Business Machines Corp., 2002,2007 | 4 | * Copyright (C) International Business Machines Corp., 2002,2008 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * This library is free software; you can redistribute it and/or modify | 7 | * This library is free software; you can redistribute it and/or modify |
@@ -320,9 +320,9 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , | |||
320 | if (treeCon->ses) { | 320 | if (treeCon->ses) { |
321 | if (treeCon->ses->capabilities & CAP_UNICODE) | 321 | if (treeCon->ses->capabilities & CAP_UNICODE) |
322 | buffer->Flags2 |= SMBFLG2_UNICODE; | 322 | buffer->Flags2 |= SMBFLG2_UNICODE; |
323 | if (treeCon->ses->capabilities & CAP_STATUS32) { | 323 | if (treeCon->ses->capabilities & CAP_STATUS32) |
324 | buffer->Flags2 |= SMBFLG2_ERR_STATUS; | 324 | buffer->Flags2 |= SMBFLG2_ERR_STATUS; |
325 | } | 325 | |
326 | /* Uid is not converted */ | 326 | /* Uid is not converted */ |
327 | buffer->Uid = treeCon->ses->Suid; | 327 | buffer->Uid = treeCon->ses->Suid; |
328 | buffer->Mid = GetNextMid(treeCon->ses->server); | 328 | buffer->Mid = GetNextMid(treeCon->ses->server); |
@@ -610,7 +610,8 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) | |||
610 | 610 | ||
611 | buffer = (unsigned char *) smb_buf; | 611 | buffer = (unsigned char *) smb_buf; |
612 | for (i = 0, j = 0; i < smb_buf_length; i++, j++) { | 612 | for (i = 0, j = 0; i < smb_buf_length; i++, j++) { |
613 | if (i % 8 == 0) { /* have reached the beginning of line */ | 613 | if (i % 8 == 0) { |
614 | /* have reached the beginning of line */ | ||
614 | printk(KERN_DEBUG "| "); | 615 | printk(KERN_DEBUG "| "); |
615 | j = 0; | 616 | j = 0; |
616 | } | 617 | } |
@@ -621,7 +622,8 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) | |||
621 | else | 622 | else |
622 | debug_line[1 + (2 * j)] = '_'; | 623 | debug_line[1 + (2 * j)] = '_'; |
623 | 624 | ||
624 | if (i % 8 == 7) { /* reached end of line, time to print ascii */ | 625 | if (i % 8 == 7) { |
626 | /* reached end of line, time to print ascii */ | ||
625 | debug_line[16] = 0; | 627 | debug_line[16] = 0; |
626 | printk(" | %s\n", debug_line); | 628 | printk(" | %s\n", debug_line); |
627 | } | 629 | } |
@@ -631,7 +633,7 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) | |||
631 | debug_line[2 * j] = ' '; | 633 | debug_line[2 * j] = ' '; |
632 | debug_line[1 + (2 * j)] = ' '; | 634 | debug_line[1 + (2 * j)] = ' '; |
633 | } | 635 | } |
634 | printk( " | %s\n", debug_line); | 636 | printk(" | %s\n", debug_line); |
635 | return; | 637 | return; |
636 | } | 638 | } |
637 | 639 | ||
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 646e1f06941b..3b5a5ce882b6 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/netmisc.c | 2 | * fs/cifs/netmisc.c |
3 | * | 3 | * |
4 | * Copyright (c) International Business Machines Corp., 2002 | 4 | * Copyright (c) International Business Machines Corp., 2002,2008 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * Error mapping routines from Samba libsmb/errormap.c | 7 | * Error mapping routines from Samba libsmb/errormap.c |
@@ -150,9 +150,7 @@ static int canonicalize_unc(char *cp) | |||
150 | if (cp[i] == '\\') | 150 | if (cp[i] == '\\') |
151 | break; | 151 | break; |
152 | if (cp[i] == '/') { | 152 | if (cp[i] == '/') { |
153 | #ifdef CONFIG_CIFS_DEBUG2 | 153 | cFYI(DBG2, ("change slash to \\ in malformed UNC")); |
154 | cFYI(1, ("change slash to backslash in malformed UNC")); | ||
155 | #endif | ||
156 | cp[i] = '\\'; | 154 | cp[i] = '\\'; |
157 | return 1; | 155 | return 1; |
158 | } | 156 | } |
@@ -178,9 +176,7 @@ cifs_inet_pton(int address_family, char *cp, void *dst) | |||
178 | } else if (address_family == AF_INET6) { | 176 | } else if (address_family == AF_INET6) { |
179 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); | 177 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); |
180 | } | 178 | } |
181 | #ifdef CONFIG_CIFS_DEBUG2 | 179 | cFYI(DBG2, ("address conversion returned %d for %s", ret, cp)); |
182 | cFYI(1, ("address conversion returned %d for %s", ret, cp)); | ||
183 | #endif | ||
184 | if (ret > 0) | 180 | if (ret > 0) |
185 | ret = 1; | 181 | ret = 1; |
186 | return ret; | 182 | return ret; |
@@ -253,7 +249,8 @@ static const struct { | |||
253 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, { | 249 | ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, { |
254 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, { | 250 | ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, { |
255 | ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, { | 251 | ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, { |
256 | ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, { /* mapping changed since shell does lookup on * and expects file not found */ | 252 | /* mapping changed since shell does lookup on * expects FileNotFound */ |
253 | ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, { | ||
257 | ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, { | 254 | ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, { |
258 | ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, { | 255 | ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, { |
259 | ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, { | 256 | ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, { |
@@ -820,7 +817,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr) | |||
820 | /* old style errors */ | 817 | /* old style errors */ |
821 | 818 | ||
822 | /* DOS class smb error codes - map DOS */ | 819 | /* DOS class smb error codes - map DOS */ |
823 | if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */ | 820 | if (smberrclass == ERRDOS) { |
821 | /* 1 byte field no need to byte reverse */ | ||
824 | for (i = 0; | 822 | for (i = 0; |
825 | i < | 823 | i < |
826 | sizeof(mapping_table_ERRDOS) / | 824 | sizeof(mapping_table_ERRDOS) / |
@@ -834,7 +832,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr) | |||
834 | } | 832 | } |
835 | /* else try next error mapping one to see if match */ | 833 | /* else try next error mapping one to see if match */ |
836 | } | 834 | } |
837 | } else if (smberrclass == ERRSRV) { /* server class of error codes */ | 835 | } else if (smberrclass == ERRSRV) { |
836 | /* server class of error codes */ | ||
838 | for (i = 0; | 837 | for (i = 0; |
839 | i < | 838 | i < |
840 | sizeof(mapping_table_ERRSRV) / | 839 | sizeof(mapping_table_ERRSRV) / |
@@ -922,8 +921,8 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) | |||
922 | { | 921 | { |
923 | struct timespec ts; | 922 | struct timespec ts; |
924 | int sec, min, days, month, year; | 923 | int sec, min, days, month, year; |
925 | SMB_TIME * st = (SMB_TIME *)&time; | 924 | SMB_TIME *st = (SMB_TIME *)&time; |
926 | SMB_DATE * sd = (SMB_DATE *)&date; | 925 | SMB_DATE *sd = (SMB_DATE *)&date; |
927 | 926 | ||
928 | cFYI(1, ("date %d time %d", date, time)); | 927 | cFYI(1, ("date %d time %d", date, time)); |
929 | 928 | ||
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 0f22def4bdff..32b445edc882 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Directory search handling | 4 | * Directory search handling |
5 | * | 5 | * |
6 | * Copyright (C) International Business Machines Corp., 2004, 2007 | 6 | * Copyright (C) International Business Machines Corp., 2004, 2008 |
7 | * Author(s): Steve French (sfrench@us.ibm.com) | 7 | * Author(s): Steve French (sfrench@us.ibm.com) |
8 | * | 8 | * |
9 | * This library is free software; you can redistribute it and/or modify | 9 | * This library is free software; you can redistribute it and/or modify |
@@ -42,17 +42,18 @@ static void dump_cifs_file_struct(struct file *file, char *label) | |||
42 | cFYI(1, ("empty cifs private file data")); | 42 | cFYI(1, ("empty cifs private file data")); |
43 | return; | 43 | return; |
44 | } | 44 | } |
45 | if (cf->invalidHandle) { | 45 | if (cf->invalidHandle) |
46 | cFYI(1, ("invalid handle")); | 46 | cFYI(1, ("invalid handle")); |
47 | } | 47 | if (cf->srch_inf.endOfSearch) |
48 | if (cf->srch_inf.endOfSearch) { | ||
49 | cFYI(1, ("end of search")); | 48 | cFYI(1, ("end of search")); |
50 | } | 49 | if (cf->srch_inf.emptyDir) |
51 | if (cf->srch_inf.emptyDir) { | ||
52 | cFYI(1, ("empty dir")); | 50 | cFYI(1, ("empty dir")); |
53 | } | ||
54 | } | 51 | } |
55 | } | 52 | } |
53 | #else | ||
54 | static inline void dump_cifs_file_struct(struct file *file, char *label) | ||
55 | { | ||
56 | } | ||
56 | #endif /* DEBUG2 */ | 57 | #endif /* DEBUG2 */ |
57 | 58 | ||
58 | /* Returns one if new inode created (which therefore needs to be hashed) */ | 59 | /* Returns one if new inode created (which therefore needs to be hashed) */ |
@@ -150,7 +151,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
150 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); | 151 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); |
151 | } else { /* legacy, OS2 and DOS style */ | 152 | } else { /* legacy, OS2 and DOS style */ |
152 | /* struct timespec ts;*/ | 153 | /* struct timespec ts;*/ |
153 | FIND_FILE_STANDARD_INFO * pfindData = | 154 | FIND_FILE_STANDARD_INFO *pfindData = |
154 | (FIND_FILE_STANDARD_INFO *)buf; | 155 | (FIND_FILE_STANDARD_INFO *)buf; |
155 | 156 | ||
156 | tmp_inode->i_mtime = cnvrtDosUnixTm( | 157 | tmp_inode->i_mtime = cnvrtDosUnixTm( |
@@ -198,9 +199,8 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
198 | if (attr & ATTR_DIRECTORY) { | 199 | if (attr & ATTR_DIRECTORY) { |
199 | *pobject_type = DT_DIR; | 200 | *pobject_type = DT_DIR; |
200 | /* override default perms since we do not lock dirs */ | 201 | /* override default perms since we do not lock dirs */ |
201 | if (atomic_read(&cifsInfo->inUse) == 0) { | 202 | if (atomic_read(&cifsInfo->inUse) == 0) |
202 | tmp_inode->i_mode = cifs_sb->mnt_dir_mode; | 203 | tmp_inode->i_mode = cifs_sb->mnt_dir_mode; |
203 | } | ||
204 | tmp_inode->i_mode |= S_IFDIR; | 204 | tmp_inode->i_mode |= S_IFDIR; |
205 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | 205 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && |
206 | (attr & ATTR_SYSTEM)) { | 206 | (attr & ATTR_SYSTEM)) { |
@@ -231,9 +231,8 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
231 | } /* could add code here - to validate if device or weird share type? */ | 231 | } /* could add code here - to validate if device or weird share type? */ |
232 | 232 | ||
233 | /* can not fill in nlink here as in qpathinfo version and Unx search */ | 233 | /* can not fill in nlink here as in qpathinfo version and Unx search */ |
234 | if (atomic_read(&cifsInfo->inUse) == 0) { | 234 | if (atomic_read(&cifsInfo->inUse) == 0) |
235 | atomic_set(&cifsInfo->inUse, 1); | 235 | atomic_set(&cifsInfo->inUse, 1); |
236 | } | ||
237 | 236 | ||
238 | spin_lock(&tmp_inode->i_lock); | 237 | spin_lock(&tmp_inode->i_lock); |
239 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | 238 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
@@ -461,9 +460,8 @@ static int initiate_cifs_search(const int xid, struct file *file) | |||
461 | 460 | ||
462 | full_path = build_path_from_dentry(file->f_path.dentry); | 461 | full_path = build_path_from_dentry(file->f_path.dentry); |
463 | 462 | ||
464 | if (full_path == NULL) { | 463 | if (full_path == NULL) |
465 | return -ENOMEM; | 464 | return -ENOMEM; |
466 | } | ||
467 | 465 | ||
468 | cFYI(1, ("Full path: %s start at: %lld", full_path, file->f_pos)); | 466 | cFYI(1, ("Full path: %s start at: %lld", full_path, file->f_pos)); |
469 | 467 | ||
@@ -471,9 +469,9 @@ ffirst_retry: | |||
471 | /* test for Unix extensions */ | 469 | /* test for Unix extensions */ |
472 | /* but now check for them on the share/mount not on the SMB session */ | 470 | /* but now check for them on the share/mount not on the SMB session */ |
473 | /* if (pTcon->ses->capabilities & CAP_UNIX) { */ | 471 | /* if (pTcon->ses->capabilities & CAP_UNIX) { */ |
474 | if (pTcon->unix_ext) { | 472 | if (pTcon->unix_ext) |
475 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX; | 473 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX; |
476 | } else if ((pTcon->ses->capabilities & | 474 | else if ((pTcon->ses->capabilities & |
477 | (CAP_NT_SMBS | CAP_NT_FIND)) == 0) { | 475 | (CAP_NT_SMBS | CAP_NT_FIND)) == 0) { |
478 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD; | 476 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD; |
479 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 477 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
@@ -514,10 +512,10 @@ static int cifs_unicode_bytelen(char *str) | |||
514 | static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) | 512 | static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) |
515 | { | 513 | { |
516 | char *new_entry; | 514 | char *new_entry; |
517 | FILE_DIRECTORY_INFO * pDirInfo = (FILE_DIRECTORY_INFO *)old_entry; | 515 | FILE_DIRECTORY_INFO *pDirInfo = (FILE_DIRECTORY_INFO *)old_entry; |
518 | 516 | ||
519 | if (level == SMB_FIND_FILE_INFO_STANDARD) { | 517 | if (level == SMB_FIND_FILE_INFO_STANDARD) { |
520 | FIND_FILE_STANDARD_INFO * pfData; | 518 | FIND_FILE_STANDARD_INFO *pfData; |
521 | pfData = (FIND_FILE_STANDARD_INFO *)pDirInfo; | 519 | pfData = (FIND_FILE_STANDARD_INFO *)pDirInfo; |
522 | 520 | ||
523 | new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) + | 521 | new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) + |
@@ -553,7 +551,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) | |||
553 | int len = 0; | 551 | int len = 0; |
554 | 552 | ||
555 | if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) { | 553 | if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) { |
556 | FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; | 554 | FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry; |
557 | filename = &pFindData->FileName[0]; | 555 | filename = &pFindData->FileName[0]; |
558 | if (cfile->srch_inf.unicode) { | 556 | if (cfile->srch_inf.unicode) { |
559 | len = cifs_unicode_bytelen(filename); | 557 | len = cifs_unicode_bytelen(filename); |
@@ -562,30 +560,30 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) | |||
562 | len = strnlen(filename, 5); | 560 | len = strnlen(filename, 5); |
563 | } | 561 | } |
564 | } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) { | 562 | } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) { |
565 | FILE_DIRECTORY_INFO * pFindData = | 563 | FILE_DIRECTORY_INFO *pFindData = |
566 | (FILE_DIRECTORY_INFO *)current_entry; | 564 | (FILE_DIRECTORY_INFO *)current_entry; |
567 | filename = &pFindData->FileName[0]; | 565 | filename = &pFindData->FileName[0]; |
568 | len = le32_to_cpu(pFindData->FileNameLength); | 566 | len = le32_to_cpu(pFindData->FileNameLength); |
569 | } else if (cfile->srch_inf.info_level == | 567 | } else if (cfile->srch_inf.info_level == |
570 | SMB_FIND_FILE_FULL_DIRECTORY_INFO) { | 568 | SMB_FIND_FILE_FULL_DIRECTORY_INFO) { |
571 | FILE_FULL_DIRECTORY_INFO * pFindData = | 569 | FILE_FULL_DIRECTORY_INFO *pFindData = |
572 | (FILE_FULL_DIRECTORY_INFO *)current_entry; | 570 | (FILE_FULL_DIRECTORY_INFO *)current_entry; |
573 | filename = &pFindData->FileName[0]; | 571 | filename = &pFindData->FileName[0]; |
574 | len = le32_to_cpu(pFindData->FileNameLength); | 572 | len = le32_to_cpu(pFindData->FileNameLength); |
575 | } else if (cfile->srch_inf.info_level == | 573 | } else if (cfile->srch_inf.info_level == |
576 | SMB_FIND_FILE_ID_FULL_DIR_INFO) { | 574 | SMB_FIND_FILE_ID_FULL_DIR_INFO) { |
577 | SEARCH_ID_FULL_DIR_INFO * pFindData = | 575 | SEARCH_ID_FULL_DIR_INFO *pFindData = |
578 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; | 576 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; |
579 | filename = &pFindData->FileName[0]; | 577 | filename = &pFindData->FileName[0]; |
580 | len = le32_to_cpu(pFindData->FileNameLength); | 578 | len = le32_to_cpu(pFindData->FileNameLength); |
581 | } else if (cfile->srch_inf.info_level == | 579 | } else if (cfile->srch_inf.info_level == |
582 | SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { | 580 | SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { |
583 | FILE_BOTH_DIRECTORY_INFO * pFindData = | 581 | FILE_BOTH_DIRECTORY_INFO *pFindData = |
584 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; | 582 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; |
585 | filename = &pFindData->FileName[0]; | 583 | filename = &pFindData->FileName[0]; |
586 | len = le32_to_cpu(pFindData->FileNameLength); | 584 | len = le32_to_cpu(pFindData->FileNameLength); |
587 | } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) { | 585 | } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) { |
588 | FIND_FILE_STANDARD_INFO * pFindData = | 586 | FIND_FILE_STANDARD_INFO *pFindData = |
589 | (FIND_FILE_STANDARD_INFO *)current_entry; | 587 | (FIND_FILE_STANDARD_INFO *)current_entry; |
590 | filename = &pFindData->FileName[0]; | 588 | filename = &pFindData->FileName[0]; |
591 | len = pFindData->FileNameLength; | 589 | len = pFindData->FileNameLength; |
@@ -666,9 +664,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
666 | . and .. for the root of a drive and for those we need | 664 | . and .. for the root of a drive and for those we need |
667 | to start two entries earlier */ | 665 | to start two entries earlier */ |
668 | 666 | ||
669 | #ifdef CONFIG_CIFS_DEBUG2 | ||
670 | dump_cifs_file_struct(file, "In fce "); | 667 | dump_cifs_file_struct(file, "In fce "); |
671 | #endif | ||
672 | if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) && | 668 | if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) && |
673 | is_dir_changed(file)) || | 669 | is_dir_changed(file)) || |
674 | (index_to_find < first_entry_in_buffer)) { | 670 | (index_to_find < first_entry_in_buffer)) { |
@@ -718,7 +714,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
718 | pos_in_buf = index_to_find - first_entry_in_buffer; | 714 | pos_in_buf = index_to_find - first_entry_in_buffer; |
719 | cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf)); | 715 | cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf)); |
720 | 716 | ||
721 | for (i=0; (i < (pos_in_buf)) && (current_entry != NULL); i++) { | 717 | for (i = 0; (i < (pos_in_buf)) && (current_entry != NULL); i++) { |
722 | /* go entry by entry figuring out which is first */ | 718 | /* go entry by entry figuring out which is first */ |
723 | current_entry = nxt_dir_entry(current_entry, end_of_smb, | 719 | current_entry = nxt_dir_entry(current_entry, end_of_smb, |
724 | cifsFile->srch_inf.info_level); | 720 | cifsFile->srch_inf.info_level); |
@@ -793,7 +789,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, | |||
793 | filename = &pFindData->FileName[0]; | 789 | filename = &pFindData->FileName[0]; |
794 | len = le32_to_cpu(pFindData->FileNameLength); | 790 | len = le32_to_cpu(pFindData->FileNameLength); |
795 | } else if (level == SMB_FIND_FILE_INFO_STANDARD) { | 791 | } else if (level == SMB_FIND_FILE_INFO_STANDARD) { |
796 | FIND_FILE_STANDARD_INFO * pFindData = | 792 | FIND_FILE_STANDARD_INFO *pFindData = |
797 | (FIND_FILE_STANDARD_INFO *)current_entry; | 793 | (FIND_FILE_STANDARD_INFO *)current_entry; |
798 | filename = &pFindData->FileName[0]; | 794 | filename = &pFindData->FileName[0]; |
799 | /* one byte length, no name conversion */ | 795 | /* one byte length, no name conversion */ |
@@ -928,7 +924,7 @@ static int cifs_save_resume_key(const char *current_entry, | |||
928 | level = cifsFile->srch_inf.info_level; | 924 | level = cifsFile->srch_inf.info_level; |
929 | 925 | ||
930 | if (level == SMB_FIND_FILE_UNIX) { | 926 | if (level == SMB_FIND_FILE_UNIX) { |
931 | FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; | 927 | FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry; |
932 | 928 | ||
933 | filename = &pFindData->FileName[0]; | 929 | filename = &pFindData->FileName[0]; |
934 | if (cifsFile->srch_inf.unicode) { | 930 | if (cifsFile->srch_inf.unicode) { |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index d2153abcba6d..ed150efbe27c 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -417,10 +417,6 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, | |||
417 | 417 | ||
418 | calc_lanman_hash(ses, lnm_session_key); | 418 | calc_lanman_hash(ses, lnm_session_key); |
419 | ses->flags |= CIFS_SES_LANMAN; | 419 | ses->flags |= CIFS_SES_LANMAN; |
420 | /* #ifdef CONFIG_CIFS_DEBUG2 | ||
421 | cifs_dump_mem("cryptkey: ",ses->server->cryptKey, | ||
422 | CIFS_SESS_KEY_SIZE); | ||
423 | #endif */ | ||
424 | memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_SESS_KEY_SIZE); | 420 | memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_SESS_KEY_SIZE); |
425 | bcc_ptr += CIFS_SESS_KEY_SIZE; | 421 | bcc_ptr += CIFS_SESS_KEY_SIZE; |
426 | 422 | ||
diff --git a/fs/cifs/smbdes.c b/fs/cifs/smbdes.c index cfa6d21fb4e8..04943c976f98 100644 --- a/fs/cifs/smbdes.c +++ b/fs/cifs/smbdes.c | |||
@@ -114,42 +114,42 @@ static uchar sbox[8][4][16] = { | |||
114 | {{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, | 114 | {{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, |
115 | {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, | 115 | {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, |
116 | {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, | 116 | {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, |
117 | {15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}}, | 117 | {15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13} }, |
118 | 118 | ||
119 | {{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10}, | 119 | {{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10}, |
120 | {3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5}, | 120 | {3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5}, |
121 | {0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15}, | 121 | {0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15}, |
122 | {13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}}, | 122 | {13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9} }, |
123 | 123 | ||
124 | {{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8}, | 124 | {{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8}, |
125 | {13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1}, | 125 | {13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1}, |
126 | {13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7}, | 126 | {13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7}, |
127 | {1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}}, | 127 | {1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12} }, |
128 | 128 | ||
129 | {{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15}, | 129 | {{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15}, |
130 | {13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9}, | 130 | {13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9}, |
131 | {10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4}, | 131 | {10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4}, |
132 | {3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}}, | 132 | {3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14} }, |
133 | 133 | ||
134 | {{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9}, | 134 | {{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9}, |
135 | {14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6}, | 135 | {14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6}, |
136 | {4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14}, | 136 | {4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14}, |
137 | {11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}}, | 137 | {11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3} }, |
138 | 138 | ||
139 | {{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11}, | 139 | {{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11}, |
140 | {10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8}, | 140 | {10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8}, |
141 | {9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6}, | 141 | {9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6}, |
142 | {4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}}, | 142 | {4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13} }, |
143 | 143 | ||
144 | {{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1}, | 144 | {{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1}, |
145 | {13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6}, | 145 | {13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6}, |
146 | {1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2}, | 146 | {1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2}, |
147 | {6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}}, | 147 | {6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12} }, |
148 | 148 | ||
149 | {{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7}, | 149 | {{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7}, |
150 | {1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2}, | 150 | {1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2}, |
151 | {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, | 151 | {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, |
152 | {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}} | 152 | {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11} } |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static void | 155 | static void |
@@ -313,9 +313,8 @@ str_to_key(unsigned char *str, unsigned char *key) | |||
313 | key[5] = ((str[4] & 0x1F) << 2) | (str[5] >> 6); | 313 | key[5] = ((str[4] & 0x1F) << 2) | (str[5] >> 6); |
314 | key[6] = ((str[5] & 0x3F) << 1) | (str[6] >> 7); | 314 | key[6] = ((str[5] & 0x3F) << 1) | (str[6] >> 7); |
315 | key[7] = str[6] & 0x7F; | 315 | key[7] = str[6] & 0x7F; |
316 | for (i = 0; i < 8; i++) { | 316 | for (i = 0; i < 8; i++) |
317 | key[i] = (key[i] << 1); | 317 | key[i] = (key[i] << 1); |
318 | } | ||
319 | } | 318 | } |
320 | 319 | ||
321 | static void | 320 | static void |
@@ -344,9 +343,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw) | |||
344 | 343 | ||
345 | dohash(outb, inb, keyb, forw); | 344 | dohash(outb, inb, keyb, forw); |
346 | 345 | ||
347 | for (i = 0; i < 8; i++) { | 346 | for (i = 0; i < 8; i++) |
348 | out[i] = 0; | 347 | out[i] = 0; |
349 | } | ||
350 | 348 | ||
351 | for (i = 0; i < 64; i++) { | 349 | for (i = 0; i < 64; i++) { |
352 | if (outb[i]) | 350 | if (outb[i]) |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 50b623ad9320..3612d6c0a0bb 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/transport.c | 2 | * fs/cifs/transport.c |
3 | * | 3 | * |
4 | * Copyright (C) International Business Machines Corp., 2002,2007 | 4 | * Copyright (C) International Business Machines Corp., 2002,2008 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * Jeremy Allison (jra@samba.org) 2006. | 6 | * Jeremy Allison (jra@samba.org) 2006. |
7 | * | 7 | * |
@@ -358,9 +358,9 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, | |||
358 | } else if (ses->status != CifsGood) { | 358 | } else if (ses->status != CifsGood) { |
359 | /* check if SMB session is bad because we are setting it up */ | 359 | /* check if SMB session is bad because we are setting it up */ |
360 | if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && | 360 | if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && |
361 | (in_buf->Command != SMB_COM_NEGOTIATE)) { | 361 | (in_buf->Command != SMB_COM_NEGOTIATE)) |
362 | return -EAGAIN; | 362 | return -EAGAIN; |
363 | } /* else ok - we are setting up session */ | 363 | /* else ok - we are setting up session */ |
364 | } | 364 | } |
365 | *ppmidQ = AllocMidQEntry(in_buf, ses); | 365 | *ppmidQ = AllocMidQEntry(in_buf, ses); |
366 | if (*ppmidQ == NULL) | 366 | if (*ppmidQ == NULL) |
@@ -437,9 +437,8 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, | |||
437 | iov[0].iov_len = in_buf->smb_buf_length + 4; | 437 | iov[0].iov_len = in_buf->smb_buf_length + 4; |
438 | flags |= CIFS_NO_RESP; | 438 | flags |= CIFS_NO_RESP; |
439 | rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); | 439 | rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); |
440 | #ifdef CONFIG_CIFS_DEBUG2 | 440 | cFYI(DBG2, ("SendRcvNoRsp flags %d rc %d", flags, rc)); |
441 | cFYI(1, ("SendRcvNoR flags %d rc %d", flags, rc)); | 441 | |
442 | #endif | ||
443 | return rc; | 442 | return rc; |
444 | } | 443 | } |
445 | 444 | ||
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 54e8ef96cb79..8cd6a445b017 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -139,9 +139,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
139 | } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) { | 139 | } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) { |
140 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) | 140 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) |
141 | goto set_ea_exit; | 141 | goto set_ea_exit; |
142 | if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) { | 142 | if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) |
143 | cFYI(1, ("attempt to set cifs inode metadata")); | 143 | cFYI(1, ("attempt to set cifs inode metadata")); |
144 | } | 144 | |
145 | ea_name += 5; /* skip past user. prefix */ | 145 | ea_name += 5; /* skip past user. prefix */ |
146 | rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, | 146 | rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, |
147 | (__u16)value_size, cifs_sb->local_nls, | 147 | (__u16)value_size, cifs_sb->local_nls, |
@@ -262,7 +262,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
262 | cifs_sb->mnt_cifs_flags & | 262 | cifs_sb->mnt_cifs_flags & |
263 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 263 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
264 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 264 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
265 | else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 265 | else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { |
266 | __u16 fid; | 266 | __u16 fid; |
267 | int oplock = FALSE; | 267 | int oplock = FALSE; |
268 | struct cifs_ntsd *pacl = NULL; | 268 | struct cifs_ntsd *pacl = NULL; |
@@ -303,11 +303,10 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
303 | } else if (strncmp(ea_name, | 303 | } else if (strncmp(ea_name, |
304 | CIFS_XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) { | 304 | CIFS_XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) { |
305 | cFYI(1, ("Security xattr namespace not supported yet")); | 305 | cFYI(1, ("Security xattr namespace not supported yet")); |
306 | } else { | 306 | } else |
307 | cFYI(1, | 307 | cFYI(1, |
308 | ("illegal xattr request %s (only user namespace supported)", | 308 | ("illegal xattr request %s (only user namespace supported)", |
309 | ea_name)); | 309 | ea_name)); |
310 | } | ||
311 | 310 | ||
312 | /* We could add an additional check for streams ie | 311 | /* We could add an additional check for streams ie |
313 | if proc/fs/cifs/streamstoxattr is set then | 312 | if proc/fs/cifs/streamstoxattr is set then |