diff options
Diffstat (limited to 'fs')
83 files changed, 1144 insertions, 926 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 41a958a7585e..5e1a4fb5cacb 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1424,6 +1424,18 @@ struct elf_note_info { | |||
1424 | int thread_notes; | 1424 | int thread_notes; |
1425 | }; | 1425 | }; |
1426 | 1426 | ||
1427 | /* | ||
1428 | * When a regset has a writeback hook, we call it on each thread before | ||
1429 | * dumping user memory. On register window machines, this makes sure the | ||
1430 | * user memory backing the register data is up to date before we read it. | ||
1431 | */ | ||
1432 | static void do_thread_regset_writeback(struct task_struct *task, | ||
1433 | const struct user_regset *regset) | ||
1434 | { | ||
1435 | if (regset->writeback) | ||
1436 | regset->writeback(task, regset, 1); | ||
1437 | } | ||
1438 | |||
1427 | static int fill_thread_core_info(struct elf_thread_core_info *t, | 1439 | static int fill_thread_core_info(struct elf_thread_core_info *t, |
1428 | const struct user_regset_view *view, | 1440 | const struct user_regset_view *view, |
1429 | long signr, size_t *total) | 1441 | long signr, size_t *total) |
@@ -1445,6 +1457,8 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, | |||
1445 | sizeof(t->prstatus), &t->prstatus); | 1457 | sizeof(t->prstatus), &t->prstatus); |
1446 | *total += notesize(&t->notes[0]); | 1458 | *total += notesize(&t->notes[0]); |
1447 | 1459 | ||
1460 | do_thread_regset_writeback(t->task, &view->regsets[0]); | ||
1461 | |||
1448 | /* | 1462 | /* |
1449 | * Each other regset might generate a note too. For each regset | 1463 | * Each other regset might generate a note too. For each regset |
1450 | * that has no core_note_type or is inactive, we leave t->notes[i] | 1464 | * that has no core_note_type or is inactive, we leave t->notes[i] |
@@ -1452,6 +1466,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t, | |||
1452 | */ | 1466 | */ |
1453 | for (i = 1; i < view->n; ++i) { | 1467 | for (i = 1; i < view->n; ++i) { |
1454 | const struct user_regset *regset = &view->regsets[i]; | 1468 | const struct user_regset *regset = &view->regsets[i]; |
1469 | do_thread_regset_writeback(t->task, regset); | ||
1455 | if (regset->core_note_type && | 1470 | if (regset->core_note_type && |
1456 | (!regset->active || regset->active(t->task, regset))) { | 1471 | (!regset->active || regset->active(t->task, regset))) { |
1457 | int ret; | 1472 | int ret; |
diff --git a/fs/buffer.c b/fs/buffer.c index 3ebccf4aa7e3..ddfdd2c80bf9 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -627,8 +627,7 @@ repeat: | |||
627 | } | 627 | } |
628 | 628 | ||
629 | /** | 629 | /** |
630 | * sync_mapping_buffers - write out and wait upon a mapping's "associated" | 630 | * sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers |
631 | * buffers | ||
632 | * @mapping: the mapping which wants those buffers written | 631 | * @mapping: the mapping which wants those buffers written |
633 | * | 632 | * |
634 | * Starts I/O against the buffers at mapping->private_list, and waits upon | 633 | * Starts I/O against the buffers at mapping->private_list, and waits upon |
@@ -836,7 +835,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list) | |||
836 | smp_mb(); | 835 | smp_mb(); |
837 | if (buffer_dirty(bh)) { | 836 | if (buffer_dirty(bh)) { |
838 | list_add(&bh->b_assoc_buffers, | 837 | list_add(&bh->b_assoc_buffers, |
839 | &bh->b_assoc_map->private_list); | 838 | &mapping->private_list); |
840 | bh->b_assoc_map = mapping; | 839 | bh->b_assoc_map = mapping; |
841 | } | 840 | } |
842 | spin_unlock(lock); | 841 | spin_unlock(lock); |
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 |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index d26e2826ba5b..e9602d85c11d 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -29,10 +29,6 @@ | |||
29 | 29 | ||
30 | #define DEBUGFS_MAGIC 0x64626720 | 30 | #define DEBUGFS_MAGIC 0x64626720 |
31 | 31 | ||
32 | /* declared over in file.c */ | ||
33 | extern struct file_operations debugfs_file_operations; | ||
34 | extern struct inode_operations debugfs_link_operations; | ||
35 | |||
36 | static struct vfsmount *debugfs_mount; | 32 | static struct vfsmount *debugfs_mount; |
37 | static int debugfs_mount_count; | 33 | static int debugfs_mount_count; |
38 | 34 | ||
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index dc74b186145d..6df1debdccce 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -263,52 +263,102 @@ out: | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | /* This function must zero any hole we create */ | 266 | /** |
267 | * ecryptfs_prepare_write | ||
268 | * @file: The eCryptfs file | ||
269 | * @page: The eCryptfs page | ||
270 | * @from: The start byte from which we will write | ||
271 | * @to: The end byte to which we will write | ||
272 | * | ||
273 | * This function must zero any hole we create | ||
274 | * | ||
275 | * Returns zero on success; non-zero otherwise | ||
276 | */ | ||
267 | static int ecryptfs_prepare_write(struct file *file, struct page *page, | 277 | static int ecryptfs_prepare_write(struct file *file, struct page *page, |
268 | unsigned from, unsigned to) | 278 | unsigned from, unsigned to) |
269 | { | 279 | { |
270 | int rc = 0; | ||
271 | loff_t prev_page_end_size; | 280 | loff_t prev_page_end_size; |
281 | int rc = 0; | ||
272 | 282 | ||
273 | if (!PageUptodate(page)) { | 283 | if (!PageUptodate(page)) { |
274 | rc = ecryptfs_read_lower_page_segment(page, page->index, 0, | 284 | struct ecryptfs_crypt_stat *crypt_stat = |
275 | PAGE_CACHE_SIZE, | 285 | &ecryptfs_inode_to_private( |
276 | page->mapping->host); | 286 | file->f_path.dentry->d_inode)->crypt_stat; |
277 | if (rc) { | 287 | |
278 | printk(KERN_ERR "%s: Error attemping to read lower " | 288 | if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED) |
279 | "page segment; rc = [%d]\n", __FUNCTION__, rc); | 289 | || (crypt_stat->flags & ECRYPTFS_NEW_FILE)) { |
280 | ClearPageUptodate(page); | 290 | rc = ecryptfs_read_lower_page_segment( |
281 | goto out; | 291 | page, page->index, 0, PAGE_CACHE_SIZE, |
282 | } else | 292 | page->mapping->host); |
293 | if (rc) { | ||
294 | printk(KERN_ERR "%s: Error attemping to read " | ||
295 | "lower page segment; rc = [%d]\n", | ||
296 | __FUNCTION__, rc); | ||
297 | ClearPageUptodate(page); | ||
298 | goto out; | ||
299 | } else | ||
300 | SetPageUptodate(page); | ||
301 | } else if (crypt_stat->flags & ECRYPTFS_VIEW_AS_ENCRYPTED) { | ||
302 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) { | ||
303 | rc = ecryptfs_copy_up_encrypted_with_header( | ||
304 | page, crypt_stat); | ||
305 | if (rc) { | ||
306 | printk(KERN_ERR "%s: Error attempting " | ||
307 | "to copy the encrypted content " | ||
308 | "from the lower file whilst " | ||
309 | "inserting the metadata from " | ||
310 | "the xattr into the header; rc " | ||
311 | "= [%d]\n", __FUNCTION__, rc); | ||
312 | ClearPageUptodate(page); | ||
313 | goto out; | ||
314 | } | ||
315 | SetPageUptodate(page); | ||
316 | } else { | ||
317 | rc = ecryptfs_read_lower_page_segment( | ||
318 | page, page->index, 0, PAGE_CACHE_SIZE, | ||
319 | page->mapping->host); | ||
320 | if (rc) { | ||
321 | printk(KERN_ERR "%s: Error reading " | ||
322 | "page; rc = [%d]\n", | ||
323 | __FUNCTION__, rc); | ||
324 | ClearPageUptodate(page); | ||
325 | goto out; | ||
326 | } | ||
327 | SetPageUptodate(page); | ||
328 | } | ||
329 | } else { | ||
330 | rc = ecryptfs_decrypt_page(page); | ||
331 | if (rc) { | ||
332 | printk(KERN_ERR "%s: Error decrypting page " | ||
333 | "at index [%ld]; rc = [%d]\n", | ||
334 | __FUNCTION__, page->index, rc); | ||
335 | ClearPageUptodate(page); | ||
336 | goto out; | ||
337 | } | ||
283 | SetPageUptodate(page); | 338 | SetPageUptodate(page); |
339 | } | ||
284 | } | 340 | } |
285 | |||
286 | prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT); | 341 | prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT); |
287 | 342 | /* If creating a page or more of holes, zero them out via truncate. | |
288 | /* | 343 | * Note, this will increase i_size. */ |
289 | * If creating a page or more of holes, zero them out via truncate. | ||
290 | * Note, this will increase i_size. | ||
291 | */ | ||
292 | if (page->index != 0) { | 344 | if (page->index != 0) { |
293 | if (prev_page_end_size > i_size_read(page->mapping->host)) { | 345 | if (prev_page_end_size > i_size_read(page->mapping->host)) { |
294 | rc = ecryptfs_truncate(file->f_path.dentry, | 346 | rc = ecryptfs_truncate(file->f_path.dentry, |
295 | prev_page_end_size); | 347 | prev_page_end_size); |
296 | if (rc) { | 348 | if (rc) { |
297 | printk(KERN_ERR "Error on attempt to " | 349 | printk(KERN_ERR "%s: Error on attempt to " |
298 | "truncate to (higher) offset [%lld];" | 350 | "truncate to (higher) offset [%lld];" |
299 | " rc = [%d]\n", prev_page_end_size, rc); | 351 | " rc = [%d]\n", __FUNCTION__, |
352 | prev_page_end_size, rc); | ||
300 | goto out; | 353 | goto out; |
301 | } | 354 | } |
302 | } | 355 | } |
303 | } | 356 | } |
304 | /* | 357 | /* Writing to a new page, and creating a small hole from start |
305 | * Writing to a new page, and creating a small hole from start of page? | 358 | * of page? Zero it out. */ |
306 | * Zero it out. | 359 | if ((i_size_read(page->mapping->host) == prev_page_end_size) |
307 | */ | 360 | && (from != 0)) |
308 | if ((i_size_read(page->mapping->host) == prev_page_end_size) && | ||
309 | (from != 0)) { | ||
310 | zero_user(page, 0, PAGE_CACHE_SIZE); | 361 | zero_user(page, 0, PAGE_CACHE_SIZE); |
311 | } | ||
312 | out: | 362 | out: |
313 | return rc; | 363 | return rc; |
314 | } | 364 | } |
@@ -173,8 +173,15 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | |||
173 | return NULL; | 173 | return NULL; |
174 | 174 | ||
175 | if (write) { | 175 | if (write) { |
176 | struct rlimit *rlim = current->signal->rlim; | ||
177 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; | 176 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; |
177 | struct rlimit *rlim; | ||
178 | |||
179 | /* | ||
180 | * We've historically supported up to 32 pages (ARG_MAX) | ||
181 | * of argument strings even with small stacks | ||
182 | */ | ||
183 | if (size <= ARG_MAX) | ||
184 | return page; | ||
178 | 185 | ||
179 | /* | 186 | /* |
180 | * Limit to 1/4-th the stack size for the argv+env strings. | 187 | * Limit to 1/4-th the stack size for the argv+env strings. |
@@ -183,6 +190,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | |||
183 | * - the program will have a reasonable amount of stack left | 190 | * - the program will have a reasonable amount of stack left |
184 | * to work from. | 191 | * to work from. |
185 | */ | 192 | */ |
193 | rlim = current->signal->rlim; | ||
186 | if (size > rlim[RLIMIT_STACK].rlim_cur / 4) { | 194 | if (size > rlim[RLIMIT_STACK].rlim_cur / 4) { |
187 | put_page(page); | 195 | put_page(page); |
188 | return NULL; | 196 | return NULL; |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 18769cc32377..ad5360664082 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -806,8 +806,8 @@ static match_table_t tokens = { | |||
806 | {Opt_quota, "quota"}, | 806 | {Opt_quota, "quota"}, |
807 | {Opt_usrquota, "usrquota"}, | 807 | {Opt_usrquota, "usrquota"}, |
808 | {Opt_barrier, "barrier=%u"}, | 808 | {Opt_barrier, "barrier=%u"}, |
809 | {Opt_err, NULL}, | ||
810 | {Opt_resize, "resize"}, | 809 | {Opt_resize, "resize"}, |
810 | {Opt_err, NULL}, | ||
811 | }; | 811 | }; |
812 | 812 | ||
813 | static ext3_fsblk_t get_sb_block(void **data) | 813 | static ext3_fsblk_t get_sb_block(void **data) |
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 33888bb58144..2c23bade9aa6 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -46,7 +46,7 @@ const struct file_operations ext4_dir_operations = { | |||
46 | #ifdef CONFIG_COMPAT | 46 | #ifdef CONFIG_COMPAT |
47 | .compat_ioctl = ext4_compat_ioctl, | 47 | .compat_ioctl = ext4_compat_ioctl, |
48 | #endif | 48 | #endif |
49 | .fsync = ext4_sync_file, /* BKL held */ | 49 | .fsync = ext4_sync_file, |
50 | .release = ext4_release_dir, | 50 | .release = ext4_release_dir, |
51 | }; | 51 | }; |
52 | 52 | ||
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index bc7081f1fbe8..9ae6e67090cd 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -148,6 +148,7 @@ static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, | |||
148 | { | 148 | { |
149 | struct ext4_inode_info *ei = EXT4_I(inode); | 149 | struct ext4_inode_info *ei = EXT4_I(inode); |
150 | ext4_fsblk_t bg_start; | 150 | ext4_fsblk_t bg_start; |
151 | ext4_fsblk_t last_block; | ||
151 | ext4_grpblk_t colour; | 152 | ext4_grpblk_t colour; |
152 | int depth; | 153 | int depth; |
153 | 154 | ||
@@ -169,8 +170,13 @@ static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, | |||
169 | /* OK. use inode's group */ | 170 | /* OK. use inode's group */ |
170 | bg_start = (ei->i_block_group * EXT4_BLOCKS_PER_GROUP(inode->i_sb)) + | 171 | bg_start = (ei->i_block_group * EXT4_BLOCKS_PER_GROUP(inode->i_sb)) + |
171 | le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_first_data_block); | 172 | le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_first_data_block); |
172 | colour = (current->pid % 16) * | 173 | last_block = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es) - 1; |
174 | |||
175 | if (bg_start + EXT4_BLOCKS_PER_GROUP(inode->i_sb) <= last_block) | ||
176 | colour = (current->pid % 16) * | ||
173 | (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); | 177 | (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); |
178 | else | ||
179 | colour = (current->pid % 16) * ((last_block - bg_start) / 16); | ||
174 | return bg_start + colour + block; | 180 | return bg_start + colour + block; |
175 | } | 181 | } |
176 | 182 | ||
@@ -349,7 +355,7 @@ static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path) | |||
349 | #define ext4_ext_show_leaf(inode,path) | 355 | #define ext4_ext_show_leaf(inode,path) |
350 | #endif | 356 | #endif |
351 | 357 | ||
352 | static void ext4_ext_drop_refs(struct ext4_ext_path *path) | 358 | void ext4_ext_drop_refs(struct ext4_ext_path *path) |
353 | { | 359 | { |
354 | int depth = path->p_depth; | 360 | int depth = path->p_depth; |
355 | int i; | 361 | int i; |
@@ -2168,6 +2174,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
2168 | newblock = iblock - ee_block + ext_pblock(ex); | 2174 | newblock = iblock - ee_block + ext_pblock(ex); |
2169 | ex2 = ex; | 2175 | ex2 = ex; |
2170 | 2176 | ||
2177 | err = ext4_ext_get_access(handle, inode, path + depth); | ||
2178 | if (err) | ||
2179 | goto out; | ||
2180 | |||
2171 | /* ex1: ee_block to iblock - 1 : uninitialized */ | 2181 | /* ex1: ee_block to iblock - 1 : uninitialized */ |
2172 | if (iblock > ee_block) { | 2182 | if (iblock > ee_block) { |
2173 | ex1 = ex; | 2183 | ex1 = ex; |
@@ -2200,16 +2210,20 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
2200 | newdepth = ext_depth(inode); | 2210 | newdepth = ext_depth(inode); |
2201 | if (newdepth != depth) { | 2211 | if (newdepth != depth) { |
2202 | depth = newdepth; | 2212 | depth = newdepth; |
2203 | path = ext4_ext_find_extent(inode, iblock, NULL); | 2213 | ext4_ext_drop_refs(path); |
2214 | path = ext4_ext_find_extent(inode, iblock, path); | ||
2204 | if (IS_ERR(path)) { | 2215 | if (IS_ERR(path)) { |
2205 | err = PTR_ERR(path); | 2216 | err = PTR_ERR(path); |
2206 | path = NULL; | ||
2207 | goto out; | 2217 | goto out; |
2208 | } | 2218 | } |
2209 | eh = path[depth].p_hdr; | 2219 | eh = path[depth].p_hdr; |
2210 | ex = path[depth].p_ext; | 2220 | ex = path[depth].p_ext; |
2211 | if (ex2 != &newex) | 2221 | if (ex2 != &newex) |
2212 | ex2 = ex; | 2222 | ex2 = ex; |
2223 | |||
2224 | err = ext4_ext_get_access(handle, inode, path + depth); | ||
2225 | if (err) | ||
2226 | goto out; | ||
2213 | } | 2227 | } |
2214 | allocated = max_blocks; | 2228 | allocated = max_blocks; |
2215 | } | 2229 | } |
@@ -2230,9 +2244,6 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
2230 | ex2->ee_len = cpu_to_le16(allocated); | 2244 | ex2->ee_len = cpu_to_le16(allocated); |
2231 | if (ex2 != ex) | 2245 | if (ex2 != ex) |
2232 | goto insert; | 2246 | goto insert; |
2233 | err = ext4_ext_get_access(handle, inode, path + depth); | ||
2234 | if (err) | ||
2235 | goto out; | ||
2236 | /* | 2247 | /* |
2237 | * New (initialized) extent starts from the first block | 2248 | * New (initialized) extent starts from the first block |
2238 | * in the current extent. i.e., ex2 == ex | 2249 | * in the current extent. i.e., ex2 == ex |
@@ -2276,9 +2287,22 @@ out: | |||
2276 | } | 2287 | } |
2277 | 2288 | ||
2278 | /* | 2289 | /* |
2290 | * Block allocation/map/preallocation routine for extents based files | ||
2291 | * | ||
2292 | * | ||
2279 | * Need to be called with | 2293 | * Need to be called with |
2280 | * down_read(&EXT4_I(inode)->i_data_sem) if not allocating file system block | 2294 | * down_read(&EXT4_I(inode)->i_data_sem) if not allocating file system block |
2281 | * (ie, create is zero). Otherwise down_write(&EXT4_I(inode)->i_data_sem) | 2295 | * (ie, create is zero). Otherwise down_write(&EXT4_I(inode)->i_data_sem) |
2296 | * | ||
2297 | * return > 0, number of of blocks already mapped/allocated | ||
2298 | * if create == 0 and these are pre-allocated blocks | ||
2299 | * buffer head is unmapped | ||
2300 | * otherwise blocks are mapped | ||
2301 | * | ||
2302 | * return = 0, if plain look up failed (blocks have not been allocated) | ||
2303 | * buffer head is unmapped | ||
2304 | * | ||
2305 | * return < 0, error case. | ||
2282 | */ | 2306 | */ |
2283 | int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | 2307 | int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, |
2284 | ext4_lblk_t iblock, | 2308 | ext4_lblk_t iblock, |
@@ -2623,7 +2647,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) | |||
2623 | * modify 1 super block, 1 block bitmap and 1 group descriptor. | 2647 | * modify 1 super block, 1 block bitmap and 1 group descriptor. |
2624 | */ | 2648 | */ |
2625 | credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + 3; | 2649 | credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + 3; |
2626 | down_write((&EXT4_I(inode)->i_data_sem)); | 2650 | mutex_lock(&inode->i_mutex); |
2627 | retry: | 2651 | retry: |
2628 | while (ret >= 0 && ret < max_blocks) { | 2652 | while (ret >= 0 && ret < max_blocks) { |
2629 | block = block + ret; | 2653 | block = block + ret; |
@@ -2634,16 +2658,17 @@ retry: | |||
2634 | break; | 2658 | break; |
2635 | } | 2659 | } |
2636 | 2660 | ||
2637 | ret = ext4_ext_get_blocks(handle, inode, block, | 2661 | ret = ext4_get_blocks_wrap(handle, inode, block, |
2638 | max_blocks, &map_bh, | 2662 | max_blocks, &map_bh, |
2639 | EXT4_CREATE_UNINITIALIZED_EXT, 0); | 2663 | EXT4_CREATE_UNINITIALIZED_EXT, 0); |
2640 | WARN_ON(ret <= 0); | ||
2641 | if (ret <= 0) { | 2664 | if (ret <= 0) { |
2642 | ext4_error(inode->i_sb, "ext4_fallocate", | 2665 | #ifdef EXT4FS_DEBUG |
2643 | "ext4_ext_get_blocks returned error: " | 2666 | WARN_ON(ret <= 0); |
2644 | "inode#%lu, block=%u, max_blocks=%lu", | 2667 | printk(KERN_ERR "%s: ext4_ext_get_blocks " |
2668 | "returned error inode#%lu, block=%u, " | ||
2669 | "max_blocks=%lu", __func__, | ||
2645 | inode->i_ino, block, max_blocks); | 2670 | inode->i_ino, block, max_blocks); |
2646 | ret = -EIO; | 2671 | #endif |
2647 | ext4_mark_inode_dirty(handle, inode); | 2672 | ext4_mark_inode_dirty(handle, inode); |
2648 | ret2 = ext4_journal_stop(handle); | 2673 | ret2 = ext4_journal_stop(handle); |
2649 | break; | 2674 | break; |
@@ -2680,7 +2705,6 @@ retry: | |||
2680 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | 2705 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
2681 | goto retry; | 2706 | goto retry; |
2682 | 2707 | ||
2683 | up_write((&EXT4_I(inode)->i_data_sem)); | ||
2684 | /* | 2708 | /* |
2685 | * Time to update the file size. | 2709 | * Time to update the file size. |
2686 | * Update only when preallocation was requested beyond the file size. | 2710 | * Update only when preallocation was requested beyond the file size. |
@@ -2692,21 +2716,18 @@ retry: | |||
2692 | * if no error, we assume preallocation succeeded | 2716 | * if no error, we assume preallocation succeeded |
2693 | * completely | 2717 | * completely |
2694 | */ | 2718 | */ |
2695 | mutex_lock(&inode->i_mutex); | ||
2696 | i_size_write(inode, offset + len); | 2719 | i_size_write(inode, offset + len); |
2697 | EXT4_I(inode)->i_disksize = i_size_read(inode); | 2720 | EXT4_I(inode)->i_disksize = i_size_read(inode); |
2698 | mutex_unlock(&inode->i_mutex); | ||
2699 | } else if (ret < 0 && nblocks) { | 2721 | } else if (ret < 0 && nblocks) { |
2700 | /* Handle partial allocation scenario */ | 2722 | /* Handle partial allocation scenario */ |
2701 | loff_t newsize; | 2723 | loff_t newsize; |
2702 | 2724 | ||
2703 | mutex_lock(&inode->i_mutex); | ||
2704 | newsize = (nblocks << blkbits) + i_size_read(inode); | 2725 | newsize = (nblocks << blkbits) + i_size_read(inode); |
2705 | i_size_write(inode, EXT4_BLOCK_ALIGN(newsize, blkbits)); | 2726 | i_size_write(inode, EXT4_BLOCK_ALIGN(newsize, blkbits)); |
2706 | EXT4_I(inode)->i_disksize = i_size_read(inode); | 2727 | EXT4_I(inode)->i_disksize = i_size_read(inode); |
2707 | mutex_unlock(&inode->i_mutex); | ||
2708 | } | 2728 | } |
2709 | } | 2729 | } |
2710 | 2730 | ||
2731 | mutex_unlock(&inode->i_mutex); | ||
2711 | return ret > 0 ? ret2 : ret; | 2732 | return ret > 0 ? ret2 : ret; |
2712 | } | 2733 | } |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index da18a74b966a..8036b9b5376b 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -702,7 +702,12 @@ got: | |||
702 | ei->i_dir_start_lookup = 0; | 702 | ei->i_dir_start_lookup = 0; |
703 | ei->i_disksize = 0; | 703 | ei->i_disksize = 0; |
704 | 704 | ||
705 | ei->i_flags = EXT4_I(dir)->i_flags & ~EXT4_INDEX_FL; | 705 | /* |
706 | * Don't inherit extent flag from directory. We set extent flag on | ||
707 | * newly created directory and file only if -o extent mount option is | ||
708 | * specified | ||
709 | */ | ||
710 | ei->i_flags = EXT4_I(dir)->i_flags & ~(EXT4_INDEX_FL|EXT4_EXTENTS_FL); | ||
706 | if (S_ISLNK(mode)) | 711 | if (S_ISLNK(mode)) |
707 | ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL); | 712 | ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL); |
708 | /* dirsync only applies to directories */ | 713 | /* dirsync only applies to directories */ |
@@ -745,12 +750,15 @@ got: | |||
745 | goto fail_free_drop; | 750 | goto fail_free_drop; |
746 | } | 751 | } |
747 | if (test_opt(sb, EXTENTS)) { | 752 | if (test_opt(sb, EXTENTS)) { |
748 | EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; | 753 | /* set extent flag only for directory and file */ |
749 | ext4_ext_tree_init(handle, inode); | 754 | if (S_ISDIR(mode) || S_ISREG(mode)) { |
750 | err = ext4_update_incompat_feature(handle, sb, | 755 | EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; |
751 | EXT4_FEATURE_INCOMPAT_EXTENTS); | 756 | ext4_ext_tree_init(handle, inode); |
752 | if (err) | 757 | err = ext4_update_incompat_feature(handle, sb, |
753 | goto fail; | 758 | EXT4_FEATURE_INCOMPAT_EXTENTS); |
759 | if (err) | ||
760 | goto fail; | ||
761 | } | ||
754 | } | 762 | } |
755 | 763 | ||
756 | ext4_debug("allocating inode %lu\n", inode->i_ino); | 764 | ext4_debug("allocating inode %lu\n", inode->i_ino); |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 7dd9b50d5ebc..945cbf6cb1fc 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -403,6 +403,7 @@ static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind) | |||
403 | __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; | 403 | __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; |
404 | __le32 *p; | 404 | __le32 *p; |
405 | ext4_fsblk_t bg_start; | 405 | ext4_fsblk_t bg_start; |
406 | ext4_fsblk_t last_block; | ||
406 | ext4_grpblk_t colour; | 407 | ext4_grpblk_t colour; |
407 | 408 | ||
408 | /* Try to find previous block */ | 409 | /* Try to find previous block */ |
@@ -420,8 +421,13 @@ static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind) | |||
420 | * into the same cylinder group then. | 421 | * into the same cylinder group then. |
421 | */ | 422 | */ |
422 | bg_start = ext4_group_first_block_no(inode->i_sb, ei->i_block_group); | 423 | bg_start = ext4_group_first_block_no(inode->i_sb, ei->i_block_group); |
423 | colour = (current->pid % 16) * | 424 | last_block = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es) - 1; |
425 | |||
426 | if (bg_start + EXT4_BLOCKS_PER_GROUP(inode->i_sb) <= last_block) | ||
427 | colour = (current->pid % 16) * | ||
424 | (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); | 428 | (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); |
429 | else | ||
430 | colour = (current->pid % 16) * ((last_block - bg_start) / 16); | ||
425 | return bg_start + colour; | 431 | return bg_start + colour; |
426 | } | 432 | } |
427 | 433 | ||
@@ -768,7 +774,6 @@ err_out: | |||
768 | * | 774 | * |
769 | * `handle' can be NULL if create == 0. | 775 | * `handle' can be NULL if create == 0. |
770 | * | 776 | * |
771 | * The BKL may not be held on entry here. Be sure to take it early. | ||
772 | * return > 0, # of blocks mapped or allocated. | 777 | * return > 0, # of blocks mapped or allocated. |
773 | * return = 0, if plain lookup failed. | 778 | * return = 0, if plain lookup failed. |
774 | * return < 0, error case. | 779 | * return < 0, error case. |
@@ -903,11 +908,38 @@ out: | |||
903 | */ | 908 | */ |
904 | #define DIO_CREDITS 25 | 909 | #define DIO_CREDITS 25 |
905 | 910 | ||
911 | |||
912 | /* | ||
913 | * | ||
914 | * | ||
915 | * ext4_ext4 get_block() wrapper function | ||
916 | * It will do a look up first, and returns if the blocks already mapped. | ||
917 | * Otherwise it takes the write lock of the i_data_sem and allocate blocks | ||
918 | * and store the allocated blocks in the result buffer head and mark it | ||
919 | * mapped. | ||
920 | * | ||
921 | * If file type is extents based, it will call ext4_ext_get_blocks(), | ||
922 | * Otherwise, call with ext4_get_blocks_handle() to handle indirect mapping | ||
923 | * based files | ||
924 | * | ||
925 | * On success, it returns the number of blocks being mapped or allocate. | ||
926 | * if create==0 and the blocks are pre-allocated and uninitialized block, | ||
927 | * the result buffer head is unmapped. If the create ==1, it will make sure | ||
928 | * the buffer head is mapped. | ||
929 | * | ||
930 | * It returns 0 if plain look up failed (blocks have not been allocated), in | ||
931 | * that casem, buffer head is unmapped | ||
932 | * | ||
933 | * It returns the error in case of allocation failure. | ||
934 | */ | ||
906 | int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, | 935 | int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, |
907 | unsigned long max_blocks, struct buffer_head *bh, | 936 | unsigned long max_blocks, struct buffer_head *bh, |
908 | int create, int extend_disksize) | 937 | int create, int extend_disksize) |
909 | { | 938 | { |
910 | int retval; | 939 | int retval; |
940 | |||
941 | clear_buffer_mapped(bh); | ||
942 | |||
911 | /* | 943 | /* |
912 | * Try to see if we can get the block without requesting | 944 | * Try to see if we can get the block without requesting |
913 | * for new file system block. | 945 | * for new file system block. |
@@ -921,12 +953,26 @@ int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, | |||
921 | inode, block, max_blocks, bh, 0, 0); | 953 | inode, block, max_blocks, bh, 0, 0); |
922 | } | 954 | } |
923 | up_read((&EXT4_I(inode)->i_data_sem)); | 955 | up_read((&EXT4_I(inode)->i_data_sem)); |
924 | if (!create || (retval > 0)) | 956 | |
957 | /* If it is only a block(s) look up */ | ||
958 | if (!create) | ||
959 | return retval; | ||
960 | |||
961 | /* | ||
962 | * Returns if the blocks have already allocated | ||
963 | * | ||
964 | * Note that if blocks have been preallocated | ||
965 | * ext4_ext_get_block() returns th create = 0 | ||
966 | * with buffer head unmapped. | ||
967 | */ | ||
968 | if (retval > 0 && buffer_mapped(bh)) | ||
925 | return retval; | 969 | return retval; |
926 | 970 | ||
927 | /* | 971 | /* |
928 | * We need to allocate new blocks which will result | 972 | * New blocks allocate and/or writing to uninitialized extent |
929 | * in i_data update | 973 | * will possibly result in updating i_data, so we take |
974 | * the write lock of i_data_sem, and call get_blocks() | ||
975 | * with create == 1 flag. | ||
930 | */ | 976 | */ |
931 | down_write((&EXT4_I(inode)->i_data_sem)); | 977 | down_write((&EXT4_I(inode)->i_data_sem)); |
932 | /* | 978 | /* |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index dd0fcfcb35ce..ef97f19c2f9d 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -627,21 +627,19 @@ static ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb, | |||
627 | return block; | 627 | return block; |
628 | } | 628 | } |
629 | 629 | ||
630 | static inline void *mb_correct_addr_and_bit(int *bit, void *addr) | ||
631 | { | ||
630 | #if BITS_PER_LONG == 64 | 632 | #if BITS_PER_LONG == 64 |
631 | #define mb_correct_addr_and_bit(bit, addr) \ | 633 | *bit += ((unsigned long) addr & 7UL) << 3; |
632 | { \ | 634 | addr = (void *) ((unsigned long) addr & ~7UL); |
633 | bit += ((unsigned long) addr & 7UL) << 3; \ | ||
634 | addr = (void *) ((unsigned long) addr & ~7UL); \ | ||
635 | } | ||
636 | #elif BITS_PER_LONG == 32 | 635 | #elif BITS_PER_LONG == 32 |
637 | #define mb_correct_addr_and_bit(bit, addr) \ | 636 | *bit += ((unsigned long) addr & 3UL) << 3; |
638 | { \ | 637 | addr = (void *) ((unsigned long) addr & ~3UL); |
639 | bit += ((unsigned long) addr & 3UL) << 3; \ | ||
640 | addr = (void *) ((unsigned long) addr & ~3UL); \ | ||
641 | } | ||
642 | #else | 638 | #else |
643 | #error "how many bits you are?!" | 639 | #error "how many bits you are?!" |
644 | #endif | 640 | #endif |
641 | return addr; | ||
642 | } | ||
645 | 643 | ||
646 | static inline int mb_test_bit(int bit, void *addr) | 644 | static inline int mb_test_bit(int bit, void *addr) |
647 | { | 645 | { |
@@ -649,34 +647,54 @@ static inline int mb_test_bit(int bit, void *addr) | |||
649 | * ext4_test_bit on architecture like powerpc | 647 | * ext4_test_bit on architecture like powerpc |
650 | * needs unsigned long aligned address | 648 | * needs unsigned long aligned address |
651 | */ | 649 | */ |
652 | mb_correct_addr_and_bit(bit, addr); | 650 | addr = mb_correct_addr_and_bit(&bit, addr); |
653 | return ext4_test_bit(bit, addr); | 651 | return ext4_test_bit(bit, addr); |
654 | } | 652 | } |
655 | 653 | ||
656 | static inline void mb_set_bit(int bit, void *addr) | 654 | static inline void mb_set_bit(int bit, void *addr) |
657 | { | 655 | { |
658 | mb_correct_addr_and_bit(bit, addr); | 656 | addr = mb_correct_addr_and_bit(&bit, addr); |
659 | ext4_set_bit(bit, addr); | 657 | ext4_set_bit(bit, addr); |
660 | } | 658 | } |
661 | 659 | ||
662 | static inline void mb_set_bit_atomic(spinlock_t *lock, int bit, void *addr) | 660 | static inline void mb_set_bit_atomic(spinlock_t *lock, int bit, void *addr) |
663 | { | 661 | { |
664 | mb_correct_addr_and_bit(bit, addr); | 662 | addr = mb_correct_addr_and_bit(&bit, addr); |
665 | ext4_set_bit_atomic(lock, bit, addr); | 663 | ext4_set_bit_atomic(lock, bit, addr); |
666 | } | 664 | } |
667 | 665 | ||
668 | static inline void mb_clear_bit(int bit, void *addr) | 666 | static inline void mb_clear_bit(int bit, void *addr) |
669 | { | 667 | { |
670 | mb_correct_addr_and_bit(bit, addr); | 668 | addr = mb_correct_addr_and_bit(&bit, addr); |
671 | ext4_clear_bit(bit, addr); | 669 | ext4_clear_bit(bit, addr); |
672 | } | 670 | } |
673 | 671 | ||
674 | static inline void mb_clear_bit_atomic(spinlock_t *lock, int bit, void *addr) | 672 | static inline void mb_clear_bit_atomic(spinlock_t *lock, int bit, void *addr) |
675 | { | 673 | { |
676 | mb_correct_addr_and_bit(bit, addr); | 674 | addr = mb_correct_addr_and_bit(&bit, addr); |
677 | ext4_clear_bit_atomic(lock, bit, addr); | 675 | ext4_clear_bit_atomic(lock, bit, addr); |
678 | } | 676 | } |
679 | 677 | ||
678 | static inline int mb_find_next_zero_bit(void *addr, int max, int start) | ||
679 | { | ||
680 | int fix = 0; | ||
681 | addr = mb_correct_addr_and_bit(&fix, addr); | ||
682 | max += fix; | ||
683 | start += fix; | ||
684 | |||
685 | return ext4_find_next_zero_bit(addr, max, start) - fix; | ||
686 | } | ||
687 | |||
688 | static inline int mb_find_next_bit(void *addr, int max, int start) | ||
689 | { | ||
690 | int fix = 0; | ||
691 | addr = mb_correct_addr_and_bit(&fix, addr); | ||
692 | max += fix; | ||
693 | start += fix; | ||
694 | |||
695 | return ext4_find_next_bit(addr, max, start) - fix; | ||
696 | } | ||
697 | |||
680 | static void *mb_find_buddy(struct ext4_buddy *e4b, int order, int *max) | 698 | static void *mb_find_buddy(struct ext4_buddy *e4b, int order, int *max) |
681 | { | 699 | { |
682 | char *bb; | 700 | char *bb; |
@@ -906,7 +924,7 @@ static void ext4_mb_mark_free_simple(struct super_block *sb, | |||
906 | unsigned short chunk; | 924 | unsigned short chunk; |
907 | unsigned short border; | 925 | unsigned short border; |
908 | 926 | ||
909 | BUG_ON(len >= EXT4_BLOCKS_PER_GROUP(sb)); | 927 | BUG_ON(len > EXT4_BLOCKS_PER_GROUP(sb)); |
910 | 928 | ||
911 | border = 2 << sb->s_blocksize_bits; | 929 | border = 2 << sb->s_blocksize_bits; |
912 | 930 | ||
@@ -946,12 +964,12 @@ static void ext4_mb_generate_buddy(struct super_block *sb, | |||
946 | 964 | ||
947 | /* initialize buddy from bitmap which is aggregation | 965 | /* initialize buddy from bitmap which is aggregation |
948 | * of on-disk bitmap and preallocations */ | 966 | * of on-disk bitmap and preallocations */ |
949 | i = ext4_find_next_zero_bit(bitmap, max, 0); | 967 | i = mb_find_next_zero_bit(bitmap, max, 0); |
950 | grp->bb_first_free = i; | 968 | grp->bb_first_free = i; |
951 | while (i < max) { | 969 | while (i < max) { |
952 | fragments++; | 970 | fragments++; |
953 | first = i; | 971 | first = i; |
954 | i = ext4_find_next_bit(bitmap, max, i); | 972 | i = mb_find_next_bit(bitmap, max, i); |
955 | len = i - first; | 973 | len = i - first; |
956 | free += len; | 974 | free += len; |
957 | if (len > 1) | 975 | if (len > 1) |
@@ -959,7 +977,7 @@ static void ext4_mb_generate_buddy(struct super_block *sb, | |||
959 | else | 977 | else |
960 | grp->bb_counters[0]++; | 978 | grp->bb_counters[0]++; |
961 | if (i < max) | 979 | if (i < max) |
962 | i = ext4_find_next_zero_bit(bitmap, max, i); | 980 | i = mb_find_next_zero_bit(bitmap, max, i); |
963 | } | 981 | } |
964 | grp->bb_fragments = fragments; | 982 | grp->bb_fragments = fragments; |
965 | 983 | ||
@@ -967,6 +985,10 @@ static void ext4_mb_generate_buddy(struct super_block *sb, | |||
967 | ext4_error(sb, __FUNCTION__, | 985 | ext4_error(sb, __FUNCTION__, |
968 | "EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n", | 986 | "EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n", |
969 | group, free, grp->bb_free); | 987 | group, free, grp->bb_free); |
988 | /* | ||
989 | * If we intent to continue, we consider group descritor | ||
990 | * corrupt and update bb_free using bitmap value | ||
991 | */ | ||
970 | grp->bb_free = free; | 992 | grp->bb_free = free; |
971 | } | 993 | } |
972 | 994 | ||
@@ -1778,7 +1800,7 @@ static void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, | |||
1778 | buddy = mb_find_buddy(e4b, i, &max); | 1800 | buddy = mb_find_buddy(e4b, i, &max); |
1779 | BUG_ON(buddy == NULL); | 1801 | BUG_ON(buddy == NULL); |
1780 | 1802 | ||
1781 | k = ext4_find_next_zero_bit(buddy, max, 0); | 1803 | k = mb_find_next_zero_bit(buddy, max, 0); |
1782 | BUG_ON(k >= max); | 1804 | BUG_ON(k >= max); |
1783 | 1805 | ||
1784 | ac->ac_found++; | 1806 | ac->ac_found++; |
@@ -1818,11 +1840,11 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | |||
1818 | i = e4b->bd_info->bb_first_free; | 1840 | i = e4b->bd_info->bb_first_free; |
1819 | 1841 | ||
1820 | while (free && ac->ac_status == AC_STATUS_CONTINUE) { | 1842 | while (free && ac->ac_status == AC_STATUS_CONTINUE) { |
1821 | i = ext4_find_next_zero_bit(bitmap, | 1843 | i = mb_find_next_zero_bit(bitmap, |
1822 | EXT4_BLOCKS_PER_GROUP(sb), i); | 1844 | EXT4_BLOCKS_PER_GROUP(sb), i); |
1823 | if (i >= EXT4_BLOCKS_PER_GROUP(sb)) { | 1845 | if (i >= EXT4_BLOCKS_PER_GROUP(sb)) { |
1824 | /* | 1846 | /* |
1825 | * IF we corrupt the bitmap we won't find any | 1847 | * IF we have corrupt bitmap, we won't find any |
1826 | * free blocks even though group info says we | 1848 | * free blocks even though group info says we |
1827 | * we have free blocks | 1849 | * we have free blocks |
1828 | */ | 1850 | */ |
@@ -1838,6 +1860,12 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | |||
1838 | ext4_error(sb, __FUNCTION__, "%d free blocks as per " | 1860 | ext4_error(sb, __FUNCTION__, "%d free blocks as per " |
1839 | "group info. But got %d blocks\n", | 1861 | "group info. But got %d blocks\n", |
1840 | free, ex.fe_len); | 1862 | free, ex.fe_len); |
1863 | /* | ||
1864 | * The number of free blocks differs. This mostly | ||
1865 | * indicate that the bitmap is corrupt. So exit | ||
1866 | * without claiming the space. | ||
1867 | */ | ||
1868 | break; | ||
1841 | } | 1869 | } |
1842 | 1870 | ||
1843 | ext4_mb_measure_extent(ac, &ex, e4b); | 1871 | ext4_mb_measure_extent(ac, &ex, e4b); |
@@ -3740,10 +3768,10 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, | |||
3740 | } | 3768 | } |
3741 | 3769 | ||
3742 | while (bit < end) { | 3770 | while (bit < end) { |
3743 | bit = ext4_find_next_zero_bit(bitmap_bh->b_data, end, bit); | 3771 | bit = mb_find_next_zero_bit(bitmap_bh->b_data, end, bit); |
3744 | if (bit >= end) | 3772 | if (bit >= end) |
3745 | break; | 3773 | break; |
3746 | next = ext4_find_next_bit(bitmap_bh->b_data, end, bit); | 3774 | next = mb_find_next_bit(bitmap_bh->b_data, end, bit); |
3747 | if (next > end) | 3775 | if (next > end) |
3748 | next = end; | 3776 | next = end; |
3749 | start = group * EXT4_BLOCKS_PER_GROUP(sb) + bit + | 3777 | start = group * EXT4_BLOCKS_PER_GROUP(sb) + bit + |
@@ -3771,6 +3799,10 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, | |||
3771 | (unsigned long) pa->pa_len); | 3799 | (unsigned long) pa->pa_len); |
3772 | ext4_error(sb, __FUNCTION__, "free %u, pa_free %u\n", | 3800 | ext4_error(sb, __FUNCTION__, "free %u, pa_free %u\n", |
3773 | free, pa->pa_free); | 3801 | free, pa->pa_free); |
3802 | /* | ||
3803 | * pa is already deleted so we use the value obtained | ||
3804 | * from the bitmap and continue. | ||
3805 | */ | ||
3774 | } | 3806 | } |
3775 | atomic_add(free, &sbi->s_mb_discarded); | 3807 | atomic_add(free, &sbi->s_mb_discarded); |
3776 | if (ac) | 3808 | if (ac) |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 8c6c685b9d22..5c1e27de7755 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -43,6 +43,7 @@ static int finish_range(handle_t *handle, struct inode *inode, | |||
43 | 43 | ||
44 | if (IS_ERR(path)) { | 44 | if (IS_ERR(path)) { |
45 | retval = PTR_ERR(path); | 45 | retval = PTR_ERR(path); |
46 | path = NULL; | ||
46 | goto err_out; | 47 | goto err_out; |
47 | } | 48 | } |
48 | 49 | ||
@@ -74,6 +75,10 @@ static int finish_range(handle_t *handle, struct inode *inode, | |||
74 | } | 75 | } |
75 | retval = ext4_ext_insert_extent(handle, inode, path, &newext); | 76 | retval = ext4_ext_insert_extent(handle, inode, path, &newext); |
76 | err_out: | 77 | err_out: |
78 | if (path) { | ||
79 | ext4_ext_drop_refs(path); | ||
80 | kfree(path); | ||
81 | } | ||
77 | lb->first_pblock = 0; | 82 | lb->first_pblock = 0; |
78 | return retval; | 83 | return retval; |
79 | } | 84 | } |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index a9347fb43bcc..28aa2ed4297e 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1804,12 +1804,8 @@ retry: | |||
1804 | inode->i_fop = &ext4_dir_operations; | 1804 | inode->i_fop = &ext4_dir_operations; |
1805 | inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize; | 1805 | inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize; |
1806 | dir_block = ext4_bread (handle, inode, 0, 1, &err); | 1806 | dir_block = ext4_bread (handle, inode, 0, 1, &err); |
1807 | if (!dir_block) { | 1807 | if (!dir_block) |
1808 | ext4_dec_count(handle, inode); /* is this nlink == 0? */ | 1808 | goto out_clear_inode; |
1809 | ext4_mark_inode_dirty(handle, inode); | ||
1810 | iput (inode); | ||
1811 | goto out_stop; | ||
1812 | } | ||
1813 | BUFFER_TRACE(dir_block, "get_write_access"); | 1809 | BUFFER_TRACE(dir_block, "get_write_access"); |
1814 | ext4_journal_get_write_access(handle, dir_block); | 1810 | ext4_journal_get_write_access(handle, dir_block); |
1815 | de = (struct ext4_dir_entry_2 *) dir_block->b_data; | 1811 | de = (struct ext4_dir_entry_2 *) dir_block->b_data; |
@@ -1832,7 +1828,8 @@ retry: | |||
1832 | ext4_mark_inode_dirty(handle, inode); | 1828 | ext4_mark_inode_dirty(handle, inode); |
1833 | err = ext4_add_entry (handle, dentry, inode); | 1829 | err = ext4_add_entry (handle, dentry, inode); |
1834 | if (err) { | 1830 | if (err) { |
1835 | inode->i_nlink = 0; | 1831 | out_clear_inode: |
1832 | clear_nlink(inode); | ||
1836 | ext4_mark_inode_dirty(handle, inode); | 1833 | ext4_mark_inode_dirty(handle, inode); |
1837 | iput (inode); | 1834 | iput (inode); |
1838 | goto out_stop; | 1835 | goto out_stop; |
@@ -2164,7 +2161,7 @@ static int ext4_unlink(struct inode * dir, struct dentry *dentry) | |||
2164 | dir->i_ctime = dir->i_mtime = ext4_current_time(dir); | 2161 | dir->i_ctime = dir->i_mtime = ext4_current_time(dir); |
2165 | ext4_update_dx_flag(dir); | 2162 | ext4_update_dx_flag(dir); |
2166 | ext4_mark_inode_dirty(handle, dir); | 2163 | ext4_mark_inode_dirty(handle, dir); |
2167 | ext4_dec_count(handle, inode); | 2164 | drop_nlink(inode); |
2168 | if (!inode->i_nlink) | 2165 | if (!inode->i_nlink) |
2169 | ext4_orphan_add(handle, inode); | 2166 | ext4_orphan_add(handle, inode); |
2170 | inode->i_ctime = ext4_current_time(inode); | 2167 | inode->i_ctime = ext4_current_time(inode); |
@@ -2214,7 +2211,7 @@ retry: | |||
2214 | err = __page_symlink(inode, symname, l, | 2211 | err = __page_symlink(inode, symname, l, |
2215 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | 2212 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); |
2216 | if (err) { | 2213 | if (err) { |
2217 | ext4_dec_count(handle, inode); | 2214 | clear_nlink(inode); |
2218 | ext4_mark_inode_dirty(handle, inode); | 2215 | ext4_mark_inode_dirty(handle, inode); |
2219 | iput (inode); | 2216 | iput (inode); |
2220 | goto out_stop; | 2217 | goto out_stop; |
@@ -2223,7 +2220,6 @@ retry: | |||
2223 | inode->i_op = &ext4_fast_symlink_inode_operations; | 2220 | inode->i_op = &ext4_fast_symlink_inode_operations; |
2224 | memcpy((char*)&EXT4_I(inode)->i_data,symname,l); | 2221 | memcpy((char*)&EXT4_I(inode)->i_data,symname,l); |
2225 | inode->i_size = l-1; | 2222 | inode->i_size = l-1; |
2226 | EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL; | ||
2227 | } | 2223 | } |
2228 | EXT4_I(inode)->i_disksize = inode->i_size; | 2224 | EXT4_I(inode)->i_disksize = inode->i_size; |
2229 | err = ext4_add_nondir(handle, dentry, inode); | 2225 | err = ext4_add_nondir(handle, dentry, inode); |
@@ -2407,7 +2403,7 @@ static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2407 | ext4_dec_count(handle, old_dir); | 2403 | ext4_dec_count(handle, old_dir); |
2408 | if (new_inode) { | 2404 | if (new_inode) { |
2409 | /* checked empty_dir above, can't have another parent, | 2405 | /* checked empty_dir above, can't have another parent, |
2410 | * ext3_dec_count() won't work for many-linked dirs */ | 2406 | * ext4_dec_count() won't work for many-linked dirs */ |
2411 | new_inode->i_nlink = 0; | 2407 | new_inode->i_nlink = 0; |
2412 | } else { | 2408 | } else { |
2413 | ext4_inc_count(handle, new_dir); | 2409 | ext4_inc_count(handle, new_dir); |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 9477a2bd6ff2..e29efa0f9d62 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1037,6 +1037,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1037 | ext4_warning(sb, __FUNCTION__, | 1037 | ext4_warning(sb, __FUNCTION__, |
1038 | "multiple resizers run on filesystem!"); | 1038 | "multiple resizers run on filesystem!"); |
1039 | unlock_super(sb); | 1039 | unlock_super(sb); |
1040 | ext4_journal_stop(handle); | ||
1040 | err = -EBUSY; | 1041 | err = -EBUSY; |
1041 | goto exit_put; | 1042 | goto exit_put; |
1042 | } | 1043 | } |
diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c index 878bf25dbc6a..92fb358ce824 100644 --- a/fs/hfs/brec.c +++ b/fs/hfs/brec.c | |||
@@ -229,7 +229,7 @@ skip: | |||
229 | static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) | 229 | static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) |
230 | { | 230 | { |
231 | struct hfs_btree *tree; | 231 | struct hfs_btree *tree; |
232 | struct hfs_bnode *node, *new_node; | 232 | struct hfs_bnode *node, *new_node, *next_node; |
233 | struct hfs_bnode_desc node_desc; | 233 | struct hfs_bnode_desc node_desc; |
234 | int num_recs, new_rec_off, new_off, old_rec_off; | 234 | int num_recs, new_rec_off, new_off, old_rec_off; |
235 | int data_start, data_end, size; | 235 | int data_start, data_end, size; |
@@ -248,6 +248,17 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) | |||
248 | new_node->type = node->type; | 248 | new_node->type = node->type; |
249 | new_node->height = node->height; | 249 | new_node->height = node->height; |
250 | 250 | ||
251 | if (node->next) | ||
252 | next_node = hfs_bnode_find(tree, node->next); | ||
253 | else | ||
254 | next_node = NULL; | ||
255 | |||
256 | if (IS_ERR(next_node)) { | ||
257 | hfs_bnode_put(node); | ||
258 | hfs_bnode_put(new_node); | ||
259 | return next_node; | ||
260 | } | ||
261 | |||
251 | size = tree->node_size / 2 - node->num_recs * 2 - 14; | 262 | size = tree->node_size / 2 - node->num_recs * 2 - 14; |
252 | old_rec_off = tree->node_size - 4; | 263 | old_rec_off = tree->node_size - 4; |
253 | num_recs = 1; | 264 | num_recs = 1; |
@@ -261,6 +272,8 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) | |||
261 | /* panic? */ | 272 | /* panic? */ |
262 | hfs_bnode_put(node); | 273 | hfs_bnode_put(node); |
263 | hfs_bnode_put(new_node); | 274 | hfs_bnode_put(new_node); |
275 | if (next_node) | ||
276 | hfs_bnode_put(next_node); | ||
264 | return ERR_PTR(-ENOSPC); | 277 | return ERR_PTR(-ENOSPC); |
265 | } | 278 | } |
266 | 279 | ||
@@ -315,8 +328,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) | |||
315 | hfs_bnode_write(node, &node_desc, 0, sizeof(node_desc)); | 328 | hfs_bnode_write(node, &node_desc, 0, sizeof(node_desc)); |
316 | 329 | ||
317 | /* update next bnode header */ | 330 | /* update next bnode header */ |
318 | if (new_node->next) { | 331 | if (next_node) { |
319 | struct hfs_bnode *next_node = hfs_bnode_find(tree, new_node->next); | ||
320 | next_node->prev = new_node->this; | 332 | next_node->prev = new_node->this; |
321 | hfs_bnode_read(next_node, &node_desc, 0, sizeof(node_desc)); | 333 | hfs_bnode_read(next_node, &node_desc, 0, sizeof(node_desc)); |
322 | node_desc.prev = cpu_to_be32(next_node->prev); | 334 | node_desc.prev = cpu_to_be32(next_node->prev); |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 038ed7436199..c6cbb6cd59b2 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -369,7 +369,7 @@ out: | |||
369 | 369 | ||
370 | 370 | ||
371 | /** | 371 | /** |
372 | * int journal_restart() - restart a handle . | 372 | * int journal_restart() - restart a handle. |
373 | * @handle: handle to restart | 373 | * @handle: handle to restart |
374 | * @nblocks: nr credits requested | 374 | * @nblocks: nr credits requested |
375 | * | 375 | * |
@@ -844,8 +844,7 @@ out: | |||
844 | } | 844 | } |
845 | 845 | ||
846 | /** | 846 | /** |
847 | * int journal_get_undo_access() - Notify intent to modify metadata with | 847 | * int journal_get_undo_access() - Notify intent to modify metadata with non-rewindable consequences |
848 | * non-rewindable consequences | ||
849 | * @handle: transaction | 848 | * @handle: transaction |
850 | * @bh: buffer to undo | 849 | * @bh: buffer to undo |
851 | * @credits: store the number of taken credits here (if not NULL) | 850 | * @credits: store the number of taken credits here (if not NULL) |
@@ -921,12 +920,14 @@ out: | |||
921 | } | 920 | } |
922 | 921 | ||
923 | /** | 922 | /** |
924 | * int journal_dirty_data() - mark a buffer as containing dirty data which | 923 | * int journal_dirty_data() - mark a buffer as containing dirty data to be flushed |
925 | * needs to be flushed before we can commit the | ||
926 | * current transaction. | ||
927 | * @handle: transaction | 924 | * @handle: transaction |
928 | * @bh: bufferhead to mark | 925 | * @bh: bufferhead to mark |
929 | * | 926 | * |
927 | * Description: | ||
928 | * Mark a buffer as containing dirty data which needs to be flushed before | ||
929 | * we can commit the current transaction. | ||
930 | * | ||
930 | * The buffer is placed on the transaction's data list and is marked as | 931 | * The buffer is placed on the transaction's data list and is marked as |
931 | * belonging to the transaction. | 932 | * belonging to the transaction. |
932 | * | 933 | * |
@@ -1098,11 +1099,11 @@ no_journal: | |||
1098 | } | 1099 | } |
1099 | 1100 | ||
1100 | /** | 1101 | /** |
1101 | * int journal_dirty_metadata() - mark a buffer as containing dirty metadata | 1102 | * int journal_dirty_metadata() - mark a buffer as containing dirty metadata |
1102 | * @handle: transaction to add buffer to. | 1103 | * @handle: transaction to add buffer to. |
1103 | * @bh: buffer to mark | 1104 | * @bh: buffer to mark |
1104 | * | 1105 | * |
1105 | * mark dirty metadata which needs to be journaled as part of the current | 1106 | * Mark dirty metadata which needs to be journaled as part of the current |
1106 | * transaction. | 1107 | * transaction. |
1107 | * | 1108 | * |
1108 | * The buffer is placed on the transaction's metadata list and is marked | 1109 | * The buffer is placed on the transaction's metadata list and is marked |
diff --git a/fs/mpage.c b/fs/mpage.c index 5df564366f36..235e4d3873a8 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -325,16 +325,12 @@ confused: | |||
325 | } | 325 | } |
326 | 326 | ||
327 | /** | 327 | /** |
328 | * mpage_readpages - populate an address space with some pages, and | 328 | * mpage_readpages - populate an address space with some pages & start reads against them |
329 | * start reads against them. | ||
330 | * | ||
331 | * @mapping: the address_space | 329 | * @mapping: the address_space |
332 | * @pages: The address of a list_head which contains the target pages. These | 330 | * @pages: The address of a list_head which contains the target pages. These |
333 | * pages have their ->index populated and are otherwise uninitialised. | 331 | * pages have their ->index populated and are otherwise uninitialised. |
334 | * | ||
335 | * The page at @pages->prev has the lowest file offset, and reads should be | 332 | * The page at @pages->prev has the lowest file offset, and reads should be |
336 | * issued in @pages->prev to @pages->next order. | 333 | * issued in @pages->prev to @pages->next order. |
337 | * | ||
338 | * @nr_pages: The number of pages at *@pages | 334 | * @nr_pages: The number of pages at *@pages |
339 | * @get_block: The filesystem's block mapper function. | 335 | * @get_block: The filesystem's block mapper function. |
340 | * | 336 | * |
@@ -360,6 +356,7 @@ confused: | |||
360 | * So an mpage read of the first 16 blocks of an ext2 file will cause I/O to be | 356 | * So an mpage read of the first 16 blocks of an ext2 file will cause I/O to be |
361 | * submitted in the following order: | 357 | * submitted in the following order: |
362 | * 12 0 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 | 358 | * 12 0 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 |
359 | * | ||
363 | * because the indirect block has to be read to get the mappings of blocks | 360 | * because the indirect block has to be read to get the mappings of blocks |
364 | * 13,14,15,16. Obviously, this impacts performance. | 361 | * 13,14,15,16. Obviously, this impacts performance. |
365 | * | 362 | * |
@@ -656,9 +653,7 @@ out: | |||
656 | } | 653 | } |
657 | 654 | ||
658 | /** | 655 | /** |
659 | * mpage_writepages - walk the list of dirty pages of the given | 656 | * mpage_writepages - walk the list of dirty pages of the given address space & writepage() all of them |
660 | * address space and writepage() all of them. | ||
661 | * | ||
662 | * @mapping: address space structure to write | 657 | * @mapping: address space structure to write |
663 | * @wbc: subtract the number of written pages from *@wbc->nr_to_write | 658 | * @wbc: subtract the number of written pages from *@wbc->nr_to_write |
664 | * @get_block: the filesystem's block mapper function. | 659 | * @get_block: the filesystem's block mapper function. |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index ae04892a5e5d..6cea7479c5b4 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -710,6 +710,8 @@ int nfs_lookup_verify_inode(struct inode *inode, struct nameidata *nd) | |||
710 | { | 710 | { |
711 | struct nfs_server *server = NFS_SERVER(inode); | 711 | struct nfs_server *server = NFS_SERVER(inode); |
712 | 712 | ||
713 | if (test_bit(NFS_INO_MOUNTPOINT, &NFS_I(inode)->flags)) | ||
714 | return 0; | ||
713 | if (nd != NULL) { | 715 | if (nd != NULL) { |
714 | /* VFS wants an on-the-wire revalidation */ | 716 | /* VFS wants an on-the-wire revalidation */ |
715 | if (nd->flags & LOOKUP_REVAL) | 717 | if (nd->flags & LOOKUP_REVAL) |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 966a8850aa30..a4c7cf2bff3a 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -299,6 +299,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) | |||
299 | else | 299 | else |
300 | inode->i_op = &nfs_mountpoint_inode_operations; | 300 | inode->i_op = &nfs_mountpoint_inode_operations; |
301 | inode->i_fop = NULL; | 301 | inode->i_fop = NULL; |
302 | set_bit(NFS_INO_MOUNTPOINT, &nfsi->flags); | ||
302 | } | 303 | } |
303 | } else if (S_ISLNK(inode->i_mode)) | 304 | } else if (S_ISLNK(inode->i_mode)) |
304 | inode->i_op = &nfs_symlink_inode_operations; | 305 | inode->i_op = &nfs_symlink_inode_operations; |
@@ -1003,8 +1004,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1003 | 1004 | ||
1004 | server = NFS_SERVER(inode); | 1005 | server = NFS_SERVER(inode); |
1005 | /* Update the fsid? */ | 1006 | /* Update the fsid? */ |
1006 | if (S_ISDIR(inode->i_mode) | 1007 | if (S_ISDIR(inode->i_mode) && |
1007 | && !nfs_fsid_equal(&server->fsid, &fattr->fsid)) | 1008 | !nfs_fsid_equal(&server->fsid, &fattr->fsid) && |
1009 | !test_bit(NFS_INO_MOUNTPOINT, &nfsi->flags)) | ||
1008 | server->fsid = fattr->fsid; | 1010 | server->fsid = fattr->fsid; |
1009 | 1011 | ||
1010 | /* | 1012 | /* |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 0f5619611b8d..931992763e68 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/mount.h> | 5 | #include <linux/mount.h> |
6 | #include <linux/security.h> | ||
6 | 7 | ||
7 | struct nfs_string; | 8 | struct nfs_string; |
8 | 9 | ||
@@ -57,6 +58,8 @@ struct nfs_parsed_mount_data { | |||
57 | char *export_path; | 58 | char *export_path; |
58 | int protocol; | 59 | int protocol; |
59 | } nfs_server; | 60 | } nfs_server; |
61 | |||
62 | struct security_mnt_opts lsm_opts; | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | /* client.c */ | 65 | /* client.c */ |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index bdcf6d3ef62f..dd4dfcd632ec 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -684,8 +684,9 @@ static void nfs_parse_server_address(char *value, | |||
684 | static int nfs_parse_mount_options(char *raw, | 684 | static int nfs_parse_mount_options(char *raw, |
685 | struct nfs_parsed_mount_data *mnt) | 685 | struct nfs_parsed_mount_data *mnt) |
686 | { | 686 | { |
687 | char *p, *string; | 687 | char *p, *string, *secdata; |
688 | unsigned short port = 0; | 688 | unsigned short port = 0; |
689 | int rc; | ||
689 | 690 | ||
690 | if (!raw) { | 691 | if (!raw) { |
691 | dfprintk(MOUNT, "NFS: mount options string was NULL.\n"); | 692 | dfprintk(MOUNT, "NFS: mount options string was NULL.\n"); |
@@ -693,6 +694,20 @@ static int nfs_parse_mount_options(char *raw, | |||
693 | } | 694 | } |
694 | dfprintk(MOUNT, "NFS: nfs mount opts='%s'\n", raw); | 695 | dfprintk(MOUNT, "NFS: nfs mount opts='%s'\n", raw); |
695 | 696 | ||
697 | secdata = alloc_secdata(); | ||
698 | if (!secdata) | ||
699 | goto out_nomem; | ||
700 | |||
701 | rc = security_sb_copy_data(raw, secdata); | ||
702 | if (rc) | ||
703 | goto out_security_failure; | ||
704 | |||
705 | rc = security_sb_parse_opts_str(secdata, &mnt->lsm_opts); | ||
706 | if (rc) | ||
707 | goto out_security_failure; | ||
708 | |||
709 | free_secdata(secdata); | ||
710 | |||
696 | while ((p = strsep(&raw, ",")) != NULL) { | 711 | while ((p = strsep(&raw, ",")) != NULL) { |
697 | substring_t args[MAX_OPT_ARGS]; | 712 | substring_t args[MAX_OPT_ARGS]; |
698 | int option, token; | 713 | int option, token; |
@@ -1042,7 +1057,10 @@ static int nfs_parse_mount_options(char *raw, | |||
1042 | out_nomem: | 1057 | out_nomem: |
1043 | printk(KERN_INFO "NFS: not enough memory to parse option\n"); | 1058 | printk(KERN_INFO "NFS: not enough memory to parse option\n"); |
1044 | return 0; | 1059 | return 0; |
1045 | 1060 | out_security_failure: | |
1061 | free_secdata(secdata); | ||
1062 | printk(KERN_INFO "NFS: security options invalid: %d\n", rc); | ||
1063 | return 0; | ||
1046 | out_unrec_vers: | 1064 | out_unrec_vers: |
1047 | printk(KERN_INFO "NFS: unrecognized NFS version number\n"); | 1065 | printk(KERN_INFO "NFS: unrecognized NFS version number\n"); |
1048 | return 0; | 1066 | return 0; |
@@ -1214,6 +1232,33 @@ static int nfs_validate_mount_data(void *options, | |||
1214 | args->namlen = data->namlen; | 1232 | args->namlen = data->namlen; |
1215 | args->bsize = data->bsize; | 1233 | args->bsize = data->bsize; |
1216 | args->auth_flavors[0] = data->pseudoflavor; | 1234 | args->auth_flavors[0] = data->pseudoflavor; |
1235 | |||
1236 | /* | ||
1237 | * The legacy version 6 binary mount data from userspace has a | ||
1238 | * field used only to transport selinux information into the | ||
1239 | * the kernel. To continue to support that functionality we | ||
1240 | * have a touch of selinux knowledge here in the NFS code. The | ||
1241 | * userspace code converted context=blah to just blah so we are | ||
1242 | * converting back to the full string selinux understands. | ||
1243 | */ | ||
1244 | if (data->context[0]){ | ||
1245 | #ifdef CONFIG_SECURITY_SELINUX | ||
1246 | int rc; | ||
1247 | char *opts_str = kmalloc(sizeof(data->context) + 8, GFP_KERNEL); | ||
1248 | if (!opts_str) | ||
1249 | return -ENOMEM; | ||
1250 | strcpy(opts_str, "context="); | ||
1251 | data->context[NFS_MAX_CONTEXT_LEN] = '\0'; | ||
1252 | strcat(opts_str, &data->context[0]); | ||
1253 | rc = security_sb_parse_opts_str(opts_str, &args->lsm_opts); | ||
1254 | kfree(opts_str); | ||
1255 | if (rc) | ||
1256 | return rc; | ||
1257 | #else | ||
1258 | return -EINVAL; | ||
1259 | #endif | ||
1260 | } | ||
1261 | |||
1217 | break; | 1262 | break; |
1218 | default: { | 1263 | default: { |
1219 | unsigned int len; | 1264 | unsigned int len; |
@@ -1476,6 +1521,8 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
1476 | }; | 1521 | }; |
1477 | int error; | 1522 | int error; |
1478 | 1523 | ||
1524 | security_init_mnt_opts(&data.lsm_opts); | ||
1525 | |||
1479 | /* Validate the mount data */ | 1526 | /* Validate the mount data */ |
1480 | error = nfs_validate_mount_data(raw_data, &data, &mntfh, dev_name); | 1527 | error = nfs_validate_mount_data(raw_data, &data, &mntfh, dev_name); |
1481 | if (error < 0) | 1528 | if (error < 0) |
@@ -1515,6 +1562,10 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
1515 | goto error_splat_super; | 1562 | goto error_splat_super; |
1516 | } | 1563 | } |
1517 | 1564 | ||
1565 | error = security_sb_set_mnt_opts(s, &data.lsm_opts); | ||
1566 | if (error) | ||
1567 | goto error_splat_root; | ||
1568 | |||
1518 | s->s_flags |= MS_ACTIVE; | 1569 | s->s_flags |= MS_ACTIVE; |
1519 | mnt->mnt_sb = s; | 1570 | mnt->mnt_sb = s; |
1520 | mnt->mnt_root = mntroot; | 1571 | mnt->mnt_root = mntroot; |
@@ -1523,12 +1574,15 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
1523 | out: | 1574 | out: |
1524 | kfree(data.nfs_server.hostname); | 1575 | kfree(data.nfs_server.hostname); |
1525 | kfree(data.mount_server.hostname); | 1576 | kfree(data.mount_server.hostname); |
1577 | security_free_mnt_opts(&data.lsm_opts); | ||
1526 | return error; | 1578 | return error; |
1527 | 1579 | ||
1528 | out_err_nosb: | 1580 | out_err_nosb: |
1529 | nfs_free_server(server); | 1581 | nfs_free_server(server); |
1530 | goto out; | 1582 | goto out; |
1531 | 1583 | ||
1584 | error_splat_root: | ||
1585 | dput(mntroot); | ||
1532 | error_splat_super: | 1586 | error_splat_super: |
1533 | up_write(&s->s_umount); | 1587 | up_write(&s->s_umount); |
1534 | deactivate_super(s); | 1588 | deactivate_super(s); |
@@ -1608,6 +1662,9 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
1608 | mnt->mnt_sb = s; | 1662 | mnt->mnt_sb = s; |
1609 | mnt->mnt_root = mntroot; | 1663 | mnt->mnt_root = mntroot; |
1610 | 1664 | ||
1665 | /* clone any lsm security options from the parent to the new sb */ | ||
1666 | security_sb_clone_mnt_opts(data->sb, s); | ||
1667 | |||
1611 | dprintk("<-- nfs_xdev_get_sb() = 0\n"); | 1668 | dprintk("<-- nfs_xdev_get_sb() = 0\n"); |
1612 | return 0; | 1669 | return 0; |
1613 | 1670 | ||
@@ -1850,6 +1907,8 @@ static int nfs4_get_sb(struct file_system_type *fs_type, | |||
1850 | }; | 1907 | }; |
1851 | int error; | 1908 | int error; |
1852 | 1909 | ||
1910 | security_init_mnt_opts(&data.lsm_opts); | ||
1911 | |||
1853 | /* Validate the mount data */ | 1912 | /* Validate the mount data */ |
1854 | error = nfs4_validate_mount_data(raw_data, &data, dev_name); | 1913 | error = nfs4_validate_mount_data(raw_data, &data, dev_name); |
1855 | if (error < 0) | 1914 | if (error < 0) |
@@ -1898,6 +1957,7 @@ out: | |||
1898 | kfree(data.client_address); | 1957 | kfree(data.client_address); |
1899 | kfree(data.nfs_server.export_path); | 1958 | kfree(data.nfs_server.export_path); |
1900 | kfree(data.nfs_server.hostname); | 1959 | kfree(data.nfs_server.hostname); |
1960 | security_free_mnt_opts(&data.lsm_opts); | ||
1901 | return error; | 1961 | return error; |
1902 | 1962 | ||
1903 | out_free: | 1963 | out_free: |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index f55c437124a2..80c61fdb2720 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -734,7 +734,7 @@ int nfs_updatepage(struct file *file, struct page *page, | |||
734 | */ | 734 | */ |
735 | if (nfs_write_pageuptodate(page, inode) && | 735 | if (nfs_write_pageuptodate(page, inode) && |
736 | inode->i_flock == NULL && | 736 | inode->i_flock == NULL && |
737 | !(file->f_mode & O_SYNC)) { | 737 | !(file->f_flags & O_SYNC)) { |
738 | count = max(count + offset, nfs_page_length(page)); | 738 | count = max(count + offset, nfs_page_length(page)); |
739 | offset = 0; | 739 | offset = 0; |
740 | } | 740 | } |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 1eb771d79cca..3e6b3f41ee1f 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -232,6 +232,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
232 | fhp->fh_dentry = dentry; | 232 | fhp->fh_dentry = dentry; |
233 | fhp->fh_export = exp; | 233 | fhp->fh_export = exp; |
234 | nfsd_nr_verified++; | 234 | nfsd_nr_verified++; |
235 | cache_get(&exp->h); | ||
235 | } else { | 236 | } else { |
236 | /* | 237 | /* |
237 | * just rechecking permissions | 238 | * just rechecking permissions |
@@ -241,6 +242,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
241 | dprintk("nfsd: fh_verify - just checking\n"); | 242 | dprintk("nfsd: fh_verify - just checking\n"); |
242 | dentry = fhp->fh_dentry; | 243 | dentry = fhp->fh_dentry; |
243 | exp = fhp->fh_export; | 244 | exp = fhp->fh_export; |
245 | cache_get(&exp->h); | ||
244 | /* | 246 | /* |
245 | * Set user creds for this exportpoint; necessary even | 247 | * Set user creds for this exportpoint; necessary even |
246 | * in the "just checking" case because this may be a | 248 | * in the "just checking" case because this may be a |
@@ -252,8 +254,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
252 | if (error) | 254 | if (error) |
253 | goto out; | 255 | goto out; |
254 | } | 256 | } |
255 | cache_get(&exp->h); | ||
256 | |||
257 | 257 | ||
258 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); | 258 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); |
259 | if (error) | 259 | if (error) |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 82243127eebf..90383ed61005 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -257,7 +257,7 @@ static int ocfs2_readpage_inline(struct inode *inode, struct page *page) | |||
257 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 257 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
258 | 258 | ||
259 | BUG_ON(!PageLocked(page)); | 259 | BUG_ON(!PageLocked(page)); |
260 | BUG_ON(!OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL); | 260 | BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)); |
261 | 261 | ||
262 | ret = ocfs2_read_block(osb, OCFS2_I(inode)->ip_blkno, &di_bh, | 262 | ret = ocfs2_read_block(osb, OCFS2_I(inode)->ip_blkno, &di_bh, |
263 | OCFS2_BH_CACHED, inode); | 263 | OCFS2_BH_CACHED, inode); |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index ee50c9610e7f..b8057c51b205 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -451,9 +451,9 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
451 | /* delay if we're withing a RECONNECT_DELAY of the | 451 | /* delay if we're withing a RECONNECT_DELAY of the |
452 | * last attempt */ | 452 | * last attempt */ |
453 | delay = (nn->nn_last_connect_attempt + | 453 | delay = (nn->nn_last_connect_attempt + |
454 | msecs_to_jiffies(o2net_reconnect_delay(sc->sc_node))) | 454 | msecs_to_jiffies(o2net_reconnect_delay(NULL))) |
455 | - jiffies; | 455 | - jiffies; |
456 | if (delay > msecs_to_jiffies(o2net_reconnect_delay(sc->sc_node))) | 456 | if (delay > msecs_to_jiffies(o2net_reconnect_delay(NULL))) |
457 | delay = 0; | 457 | delay = 0; |
458 | mlog(ML_CONN, "queueing conn attempt in %lu jiffies\n", delay); | 458 | mlog(ML_CONN, "queueing conn attempt in %lu jiffies\n", delay); |
459 | queue_delayed_work(o2net_wq, &nn->nn_connect_work, delay); | 459 | queue_delayed_work(o2net_wq, &nn->nn_connect_work, delay); |
@@ -1552,12 +1552,11 @@ static void o2net_connect_expired(struct work_struct *work) | |||
1552 | 1552 | ||
1553 | spin_lock(&nn->nn_lock); | 1553 | spin_lock(&nn->nn_lock); |
1554 | if (!nn->nn_sc_valid) { | 1554 | if (!nn->nn_sc_valid) { |
1555 | struct o2nm_node *node = nn->nn_sc->sc_node; | ||
1556 | mlog(ML_ERROR, "no connection established with node %u after " | 1555 | mlog(ML_ERROR, "no connection established with node %u after " |
1557 | "%u.%u seconds, giving up and returning errors.\n", | 1556 | "%u.%u seconds, giving up and returning errors.\n", |
1558 | o2net_num_from_nn(nn), | 1557 | o2net_num_from_nn(nn), |
1559 | o2net_idle_timeout(node) / 1000, | 1558 | o2net_idle_timeout(NULL) / 1000, |
1560 | o2net_idle_timeout(node) % 1000); | 1559 | o2net_idle_timeout(NULL) % 1000); |
1561 | 1560 | ||
1562 | o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); | 1561 | o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); |
1563 | } | 1562 | } |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index e280833ceb9a..8a1875848080 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -390,9 +390,8 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, | |||
390 | goto bail; | 390 | goto bail; |
391 | } | 391 | } |
392 | if (pde) | 392 | if (pde) |
393 | pde->rec_len = | 393 | le16_add_cpu(&pde->rec_len, |
394 | cpu_to_le16(le16_to_cpu(pde->rec_len) + | 394 | le16_to_cpu(de->rec_len)); |
395 | le16_to_cpu(de->rec_len)); | ||
396 | else | 395 | else |
397 | de->inode = 0; | 396 | de->inode = 0; |
398 | dir->i_version++; | 397 | dir->i_version++; |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 9843ee17ea27..dc8ea666efdb 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -176,6 +176,7 @@ struct dlm_mig_lockres_priv | |||
176 | { | 176 | { |
177 | struct dlm_lock_resource *lockres; | 177 | struct dlm_lock_resource *lockres; |
178 | u8 real_master; | 178 | u8 real_master; |
179 | u8 extra_ref; | ||
179 | }; | 180 | }; |
180 | 181 | ||
181 | struct dlm_assert_master_priv | 182 | struct dlm_assert_master_priv |
@@ -602,17 +603,19 @@ enum dlm_query_join_response_code { | |||
602 | JOIN_PROTOCOL_MISMATCH, | 603 | JOIN_PROTOCOL_MISMATCH, |
603 | }; | 604 | }; |
604 | 605 | ||
606 | struct dlm_query_join_packet { | ||
607 | u8 code; /* Response code. dlm_minor and fs_minor | ||
608 | are only valid if this is JOIN_OK */ | ||
609 | u8 dlm_minor; /* The minor version of the protocol the | ||
610 | dlm is speaking. */ | ||
611 | u8 fs_minor; /* The minor version of the protocol the | ||
612 | filesystem is speaking. */ | ||
613 | u8 reserved; | ||
614 | }; | ||
615 | |||
605 | union dlm_query_join_response { | 616 | union dlm_query_join_response { |
606 | u32 intval; | 617 | u32 intval; |
607 | struct { | 618 | struct dlm_query_join_packet packet; |
608 | u8 code; /* Response code. dlm_minor and fs_minor | ||
609 | are only valid if this is JOIN_OK */ | ||
610 | u8 dlm_minor; /* The minor version of the protocol the | ||
611 | dlm is speaking. */ | ||
612 | u8 fs_minor; /* The minor version of the protocol the | ||
613 | filesystem is speaking. */ | ||
614 | u8 reserved; | ||
615 | } packet; | ||
616 | }; | 619 | }; |
617 | 620 | ||
618 | struct dlm_lock_request | 621 | struct dlm_lock_request |
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index ecb4d997221e..75997b4deaf3 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c | |||
@@ -487,7 +487,7 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data, | |||
487 | "cookie=%u:%llu\n", | 487 | "cookie=%u:%llu\n", |
488 | dlm_get_lock_cookie_node(be64_to_cpu(cnv->cookie)), | 488 | dlm_get_lock_cookie_node(be64_to_cpu(cnv->cookie)), |
489 | dlm_get_lock_cookie_seq(be64_to_cpu(cnv->cookie))); | 489 | dlm_get_lock_cookie_seq(be64_to_cpu(cnv->cookie))); |
490 | __dlm_print_one_lock_resource(res); | 490 | dlm_print_one_lock_resource(res); |
491 | goto leave; | 491 | goto leave; |
492 | } | 492 | } |
493 | 493 | ||
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 638d2ebb892b..0879d86113e3 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -713,14 +713,46 @@ static int dlm_query_join_proto_check(char *proto_type, int node, | |||
713 | return rc; | 713 | return rc; |
714 | } | 714 | } |
715 | 715 | ||
716 | /* | ||
717 | * struct dlm_query_join_packet is made up of four one-byte fields. They | ||
718 | * are effectively in big-endian order already. However, little-endian | ||
719 | * machines swap them before putting the packet on the wire (because | ||
720 | * query_join's response is a status, and that status is treated as a u32 | ||
721 | * on the wire). Thus, a big-endian and little-endian machines will treat | ||
722 | * this structure differently. | ||
723 | * | ||
724 | * The solution is to have little-endian machines swap the structure when | ||
725 | * converting from the structure to the u32 representation. This will | ||
726 | * result in the structure having the correct format on the wire no matter | ||
727 | * the host endian format. | ||
728 | */ | ||
729 | static void dlm_query_join_packet_to_wire(struct dlm_query_join_packet *packet, | ||
730 | u32 *wire) | ||
731 | { | ||
732 | union dlm_query_join_response response; | ||
733 | |||
734 | response.packet = *packet; | ||
735 | *wire = cpu_to_be32(response.intval); | ||
736 | } | ||
737 | |||
738 | static void dlm_query_join_wire_to_packet(u32 wire, | ||
739 | struct dlm_query_join_packet *packet) | ||
740 | { | ||
741 | union dlm_query_join_response response; | ||
742 | |||
743 | response.intval = cpu_to_be32(wire); | ||
744 | *packet = response.packet; | ||
745 | } | ||
746 | |||
716 | static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, | 747 | static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, |
717 | void **ret_data) | 748 | void **ret_data) |
718 | { | 749 | { |
719 | struct dlm_query_join_request *query; | 750 | struct dlm_query_join_request *query; |
720 | union dlm_query_join_response response = { | 751 | struct dlm_query_join_packet packet = { |
721 | .packet.code = JOIN_DISALLOW, | 752 | .code = JOIN_DISALLOW, |
722 | }; | 753 | }; |
723 | struct dlm_ctxt *dlm = NULL; | 754 | struct dlm_ctxt *dlm = NULL; |
755 | u32 response; | ||
724 | u8 nodenum; | 756 | u8 nodenum; |
725 | 757 | ||
726 | query = (struct dlm_query_join_request *) msg->buf; | 758 | query = (struct dlm_query_join_request *) msg->buf; |
@@ -737,11 +769,11 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, | |||
737 | mlog(0, "node %u is not in our live map yet\n", | 769 | mlog(0, "node %u is not in our live map yet\n", |
738 | query->node_idx); | 770 | query->node_idx); |
739 | 771 | ||
740 | response.packet.code = JOIN_DISALLOW; | 772 | packet.code = JOIN_DISALLOW; |
741 | goto respond; | 773 | goto respond; |
742 | } | 774 | } |
743 | 775 | ||
744 | response.packet.code = JOIN_OK_NO_MAP; | 776 | packet.code = JOIN_OK_NO_MAP; |
745 | 777 | ||
746 | spin_lock(&dlm_domain_lock); | 778 | spin_lock(&dlm_domain_lock); |
747 | dlm = __dlm_lookup_domain_full(query->domain, query->name_len); | 779 | dlm = __dlm_lookup_domain_full(query->domain, query->name_len); |
@@ -760,7 +792,7 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, | |||
760 | mlog(0, "disallow join as node %u does not " | 792 | mlog(0, "disallow join as node %u does not " |
761 | "have node %u in its nodemap\n", | 793 | "have node %u in its nodemap\n", |
762 | query->node_idx, nodenum); | 794 | query->node_idx, nodenum); |
763 | response.packet.code = JOIN_DISALLOW; | 795 | packet.code = JOIN_DISALLOW; |
764 | goto unlock_respond; | 796 | goto unlock_respond; |
765 | } | 797 | } |
766 | } | 798 | } |
@@ -780,23 +812,23 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, | |||
780 | /*If this is a brand new context and we | 812 | /*If this is a brand new context and we |
781 | * haven't started our join process yet, then | 813 | * haven't started our join process yet, then |
782 | * the other node won the race. */ | 814 | * the other node won the race. */ |
783 | response.packet.code = JOIN_OK_NO_MAP; | 815 | packet.code = JOIN_OK_NO_MAP; |
784 | } else if (dlm->joining_node != DLM_LOCK_RES_OWNER_UNKNOWN) { | 816 | } else if (dlm->joining_node != DLM_LOCK_RES_OWNER_UNKNOWN) { |
785 | /* Disallow parallel joins. */ | 817 | /* Disallow parallel joins. */ |
786 | response.packet.code = JOIN_DISALLOW; | 818 | packet.code = JOIN_DISALLOW; |
787 | } else if (dlm->reco.state & DLM_RECO_STATE_ACTIVE) { | 819 | } else if (dlm->reco.state & DLM_RECO_STATE_ACTIVE) { |
788 | mlog(0, "node %u trying to join, but recovery " | 820 | mlog(0, "node %u trying to join, but recovery " |
789 | "is ongoing.\n", bit); | 821 | "is ongoing.\n", bit); |
790 | response.packet.code = JOIN_DISALLOW; | 822 | packet.code = JOIN_DISALLOW; |
791 | } else if (test_bit(bit, dlm->recovery_map)) { | 823 | } else if (test_bit(bit, dlm->recovery_map)) { |
792 | mlog(0, "node %u trying to join, but it " | 824 | mlog(0, "node %u trying to join, but it " |
793 | "still needs recovery.\n", bit); | 825 | "still needs recovery.\n", bit); |
794 | response.packet.code = JOIN_DISALLOW; | 826 | packet.code = JOIN_DISALLOW; |
795 | } else if (test_bit(bit, dlm->domain_map)) { | 827 | } else if (test_bit(bit, dlm->domain_map)) { |
796 | mlog(0, "node %u trying to join, but it " | 828 | mlog(0, "node %u trying to join, but it " |
797 | "is still in the domain! needs recovery?\n", | 829 | "is still in the domain! needs recovery?\n", |
798 | bit); | 830 | bit); |
799 | response.packet.code = JOIN_DISALLOW; | 831 | packet.code = JOIN_DISALLOW; |
800 | } else { | 832 | } else { |
801 | /* Alright we're fully a part of this domain | 833 | /* Alright we're fully a part of this domain |
802 | * so we keep some state as to who's joining | 834 | * so we keep some state as to who's joining |
@@ -807,19 +839,15 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data, | |||
807 | if (dlm_query_join_proto_check("DLM", bit, | 839 | if (dlm_query_join_proto_check("DLM", bit, |
808 | &dlm->dlm_locking_proto, | 840 | &dlm->dlm_locking_proto, |
809 | &query->dlm_proto)) { | 841 | &query->dlm_proto)) { |
810 | response.packet.code = | 842 | packet.code = JOIN_PROTOCOL_MISMATCH; |
811 | JOIN_PROTOCOL_MISMATCH; | ||
812 | } else if (dlm_query_join_proto_check("fs", bit, | 843 | } else if (dlm_query_join_proto_check("fs", bit, |
813 | &dlm->fs_locking_proto, | 844 | &dlm->fs_locking_proto, |
814 | &query->fs_proto)) { | 845 | &query->fs_proto)) { |
815 | response.packet.code = | 846 | packet.code = JOIN_PROTOCOL_MISMATCH; |
816 | JOIN_PROTOCOL_MISMATCH; | ||
817 | } else { | 847 | } else { |
818 | response.packet.dlm_minor = | 848 | packet.dlm_minor = query->dlm_proto.pv_minor; |
819 | query->dlm_proto.pv_minor; | 849 | packet.fs_minor = query->fs_proto.pv_minor; |
820 | response.packet.fs_minor = | 850 | packet.code = JOIN_OK; |
821 | query->fs_proto.pv_minor; | ||
822 | response.packet.code = JOIN_OK; | ||
823 | __dlm_set_joining_node(dlm, query->node_idx); | 851 | __dlm_set_joining_node(dlm, query->node_idx); |
824 | } | 852 | } |
825 | } | 853 | } |
@@ -830,9 +858,10 @@ unlock_respond: | |||
830 | spin_unlock(&dlm_domain_lock); | 858 | spin_unlock(&dlm_domain_lock); |
831 | 859 | ||
832 | respond: | 860 | respond: |
833 | mlog(0, "We respond with %u\n", response.packet.code); | 861 | mlog(0, "We respond with %u\n", packet.code); |
834 | 862 | ||
835 | return response.intval; | 863 | dlm_query_join_packet_to_wire(&packet, &response); |
864 | return response; | ||
836 | } | 865 | } |
837 | 866 | ||
838 | static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data, | 867 | static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data, |
@@ -937,7 +966,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm, | |||
937 | sizeof(unsigned long))) { | 966 | sizeof(unsigned long))) { |
938 | mlog(ML_ERROR, | 967 | mlog(ML_ERROR, |
939 | "map_size %u != BITS_TO_LONGS(O2NM_MAX_NODES) %u\n", | 968 | "map_size %u != BITS_TO_LONGS(O2NM_MAX_NODES) %u\n", |
940 | map_size, BITS_TO_LONGS(O2NM_MAX_NODES)); | 969 | map_size, (unsigned)BITS_TO_LONGS(O2NM_MAX_NODES)); |
941 | return -EINVAL; | 970 | return -EINVAL; |
942 | } | 971 | } |
943 | 972 | ||
@@ -968,7 +997,8 @@ static int dlm_request_join(struct dlm_ctxt *dlm, | |||
968 | { | 997 | { |
969 | int status; | 998 | int status; |
970 | struct dlm_query_join_request join_msg; | 999 | struct dlm_query_join_request join_msg; |
971 | union dlm_query_join_response join_resp; | 1000 | struct dlm_query_join_packet packet; |
1001 | u32 join_resp; | ||
972 | 1002 | ||
973 | mlog(0, "querying node %d\n", node); | 1003 | mlog(0, "querying node %d\n", node); |
974 | 1004 | ||
@@ -984,11 +1014,12 @@ static int dlm_request_join(struct dlm_ctxt *dlm, | |||
984 | 1014 | ||
985 | status = o2net_send_message(DLM_QUERY_JOIN_MSG, DLM_MOD_KEY, &join_msg, | 1015 | status = o2net_send_message(DLM_QUERY_JOIN_MSG, DLM_MOD_KEY, &join_msg, |
986 | sizeof(join_msg), node, | 1016 | sizeof(join_msg), node, |
987 | &join_resp.intval); | 1017 | &join_resp); |
988 | if (status < 0 && status != -ENOPROTOOPT) { | 1018 | if (status < 0 && status != -ENOPROTOOPT) { |
989 | mlog_errno(status); | 1019 | mlog_errno(status); |
990 | goto bail; | 1020 | goto bail; |
991 | } | 1021 | } |
1022 | dlm_query_join_wire_to_packet(join_resp, &packet); | ||
992 | 1023 | ||
993 | /* -ENOPROTOOPT from the net code means the other side isn't | 1024 | /* -ENOPROTOOPT from the net code means the other side isn't |
994 | listening for our message type -- that's fine, it means | 1025 | listening for our message type -- that's fine, it means |
@@ -997,10 +1028,10 @@ static int dlm_request_join(struct dlm_ctxt *dlm, | |||
997 | if (status == -ENOPROTOOPT) { | 1028 | if (status == -ENOPROTOOPT) { |
998 | status = 0; | 1029 | status = 0; |
999 | *response = JOIN_OK_NO_MAP; | 1030 | *response = JOIN_OK_NO_MAP; |
1000 | } else if (join_resp.packet.code == JOIN_DISALLOW || | 1031 | } else if (packet.code == JOIN_DISALLOW || |
1001 | join_resp.packet.code == JOIN_OK_NO_MAP) { | 1032 | packet.code == JOIN_OK_NO_MAP) { |
1002 | *response = join_resp.packet.code; | 1033 | *response = packet.code; |
1003 | } else if (join_resp.packet.code == JOIN_PROTOCOL_MISMATCH) { | 1034 | } else if (packet.code == JOIN_PROTOCOL_MISMATCH) { |
1004 | mlog(ML_NOTICE, | 1035 | mlog(ML_NOTICE, |
1005 | "This node requested DLM locking protocol %u.%u and " | 1036 | "This node requested DLM locking protocol %u.%u and " |
1006 | "filesystem locking protocol %u.%u. At least one of " | 1037 | "filesystem locking protocol %u.%u. At least one of " |
@@ -1012,14 +1043,12 @@ static int dlm_request_join(struct dlm_ctxt *dlm, | |||
1012 | dlm->fs_locking_proto.pv_minor, | 1043 | dlm->fs_locking_proto.pv_minor, |
1013 | node); | 1044 | node); |
1014 | status = -EPROTO; | 1045 | status = -EPROTO; |
1015 | *response = join_resp.packet.code; | 1046 | *response = packet.code; |
1016 | } else if (join_resp.packet.code == JOIN_OK) { | 1047 | } else if (packet.code == JOIN_OK) { |
1017 | *response = join_resp.packet.code; | 1048 | *response = packet.code; |
1018 | /* Use the same locking protocol as the remote node */ | 1049 | /* Use the same locking protocol as the remote node */ |
1019 | dlm->dlm_locking_proto.pv_minor = | 1050 | dlm->dlm_locking_proto.pv_minor = packet.dlm_minor; |
1020 | join_resp.packet.dlm_minor; | 1051 | dlm->fs_locking_proto.pv_minor = packet.fs_minor; |
1021 | dlm->fs_locking_proto.pv_minor = | ||
1022 | join_resp.packet.fs_minor; | ||
1023 | mlog(0, | 1052 | mlog(0, |
1024 | "Node %d responds JOIN_OK with DLM locking protocol " | 1053 | "Node %d responds JOIN_OK with DLM locking protocol " |
1025 | "%u.%u and fs locking protocol %u.%u\n", | 1054 | "%u.%u and fs locking protocol %u.%u\n", |
@@ -1031,11 +1060,11 @@ static int dlm_request_join(struct dlm_ctxt *dlm, | |||
1031 | } else { | 1060 | } else { |
1032 | status = -EINVAL; | 1061 | status = -EINVAL; |
1033 | mlog(ML_ERROR, "invalid response %d from node %u\n", | 1062 | mlog(ML_ERROR, "invalid response %d from node %u\n", |
1034 | join_resp.packet.code, node); | 1063 | packet.code, node); |
1035 | } | 1064 | } |
1036 | 1065 | ||
1037 | mlog(0, "status %d, node %d response is %d\n", status, node, | 1066 | mlog(0, "status %d, node %d response is %d\n", status, node, |
1038 | *response); | 1067 | *response); |
1039 | 1068 | ||
1040 | bail: | 1069 | bail: |
1041 | return status; | 1070 | return status; |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index a54d33d95ada..ea6b89577860 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -1663,7 +1663,12 @@ way_up_top: | |||
1663 | dlm_put_mle(tmpmle); | 1663 | dlm_put_mle(tmpmle); |
1664 | } | 1664 | } |
1665 | send_response: | 1665 | send_response: |
1666 | 1666 | /* | |
1667 | * __dlm_lookup_lockres() grabbed a reference to this lockres. | ||
1668 | * The reference is released by dlm_assert_master_worker() under | ||
1669 | * the call to dlm_dispatch_assert_master(). If | ||
1670 | * dlm_assert_master_worker() isn't called, we drop it here. | ||
1671 | */ | ||
1667 | if (dispatch_assert) { | 1672 | if (dispatch_assert) { |
1668 | if (response != DLM_MASTER_RESP_YES) | 1673 | if (response != DLM_MASTER_RESP_YES) |
1669 | mlog(ML_ERROR, "invalid response %d\n", response); | 1674 | mlog(ML_ERROR, "invalid response %d\n", response); |
@@ -1678,7 +1683,11 @@ send_response: | |||
1678 | if (ret < 0) { | 1683 | if (ret < 0) { |
1679 | mlog(ML_ERROR, "failed to dispatch assert master work\n"); | 1684 | mlog(ML_ERROR, "failed to dispatch assert master work\n"); |
1680 | response = DLM_MASTER_RESP_ERROR; | 1685 | response = DLM_MASTER_RESP_ERROR; |
1686 | dlm_lockres_put(res); | ||
1681 | } | 1687 | } |
1688 | } else { | ||
1689 | if (res) | ||
1690 | dlm_lockres_put(res); | ||
1682 | } | 1691 | } |
1683 | 1692 | ||
1684 | dlm_put(dlm); | 1693 | dlm_put(dlm); |
@@ -1695,9 +1704,9 @@ send_response: | |||
1695 | * can periodically run all locks owned by this node | 1704 | * can periodically run all locks owned by this node |
1696 | * and re-assert across the cluster... | 1705 | * and re-assert across the cluster... |
1697 | */ | 1706 | */ |
1698 | int dlm_do_assert_master(struct dlm_ctxt *dlm, | 1707 | static int dlm_do_assert_master(struct dlm_ctxt *dlm, |
1699 | struct dlm_lock_resource *res, | 1708 | struct dlm_lock_resource *res, |
1700 | void *nodemap, u32 flags) | 1709 | void *nodemap, u32 flags) |
1701 | { | 1710 | { |
1702 | struct dlm_assert_master assert; | 1711 | struct dlm_assert_master assert; |
1703 | int to, tmpret; | 1712 | int to, tmpret; |
@@ -2348,7 +2357,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
2348 | mlog(ML_ERROR, "%s:%.*s: node %u trying to drop ref " | 2357 | mlog(ML_ERROR, "%s:%.*s: node %u trying to drop ref " |
2349 | "but it is already dropped!\n", dlm->name, | 2358 | "but it is already dropped!\n", dlm->name, |
2350 | res->lockname.len, res->lockname.name, node); | 2359 | res->lockname.len, res->lockname.name, node); |
2351 | __dlm_print_one_lock_resource(res); | 2360 | dlm_print_one_lock_resource(res); |
2352 | } | 2361 | } |
2353 | ret = 0; | 2362 | ret = 0; |
2354 | goto done; | 2363 | goto done; |
@@ -2408,7 +2417,7 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) | |||
2408 | mlog(ML_ERROR, "%s:%.*s: node %u trying to drop ref " | 2417 | mlog(ML_ERROR, "%s:%.*s: node %u trying to drop ref " |
2409 | "but it is already dropped!\n", dlm->name, | 2418 | "but it is already dropped!\n", dlm->name, |
2410 | res->lockname.len, res->lockname.name, node); | 2419 | res->lockname.len, res->lockname.name, node); |
2411 | __dlm_print_one_lock_resource(res); | 2420 | dlm_print_one_lock_resource(res); |
2412 | } | 2421 | } |
2413 | 2422 | ||
2414 | dlm_lockres_put(res); | 2423 | dlm_lockres_put(res); |
@@ -2933,6 +2942,9 @@ static void dlm_remove_nonlocal_locks(struct dlm_ctxt *dlm, | |||
2933 | dlm_lockres_clear_refmap_bit(lock->ml.node, res); | 2942 | dlm_lockres_clear_refmap_bit(lock->ml.node, res); |
2934 | list_del_init(&lock->list); | 2943 | list_del_init(&lock->list); |
2935 | dlm_lock_put(lock); | 2944 | dlm_lock_put(lock); |
2945 | /* In a normal unlock, we would have added a | ||
2946 | * DLM_UNLOCK_FREE_LOCK action. Force it. */ | ||
2947 | dlm_lock_put(lock); | ||
2936 | } | 2948 | } |
2937 | } | 2949 | } |
2938 | queue++; | 2950 | queue++; |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 91f747b8a538..bcb9260c3735 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -519,9 +519,9 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
519 | return 0; | 519 | return 0; |
520 | 520 | ||
521 | master_here: | 521 | master_here: |
522 | mlog(0, "(%d) mastering recovery of %s:%u here(this=%u)!\n", | 522 | mlog(ML_NOTICE, "(%d) Node %u is the Recovery Master for the Dead Node " |
523 | task_pid_nr(dlm->dlm_reco_thread_task), | 523 | "%u for Domain %s\n", task_pid_nr(dlm->dlm_reco_thread_task), |
524 | dlm->name, dlm->reco.dead_node, dlm->node_num); | 524 | dlm->node_num, dlm->reco.dead_node, dlm->name); |
525 | 525 | ||
526 | status = dlm_remaster_locks(dlm, dlm->reco.dead_node); | 526 | status = dlm_remaster_locks(dlm, dlm->reco.dead_node); |
527 | if (status < 0) { | 527 | if (status < 0) { |
@@ -1191,7 +1191,7 @@ static int dlm_add_lock_to_array(struct dlm_lock *lock, | |||
1191 | (ml->type == LKM_EXMODE || | 1191 | (ml->type == LKM_EXMODE || |
1192 | memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN))) { | 1192 | memcmp(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN))) { |
1193 | mlog(ML_ERROR, "mismatched lvbs!\n"); | 1193 | mlog(ML_ERROR, "mismatched lvbs!\n"); |
1194 | __dlm_print_one_lock_resource(lock->lockres); | 1194 | dlm_print_one_lock_resource(lock->lockres); |
1195 | BUG(); | 1195 | BUG(); |
1196 | } | 1196 | } |
1197 | memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN); | 1197 | memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN); |
@@ -1327,6 +1327,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1327 | (struct dlm_migratable_lockres *)msg->buf; | 1327 | (struct dlm_migratable_lockres *)msg->buf; |
1328 | int ret = 0; | 1328 | int ret = 0; |
1329 | u8 real_master; | 1329 | u8 real_master; |
1330 | u8 extra_refs = 0; | ||
1330 | char *buf = NULL; | 1331 | char *buf = NULL; |
1331 | struct dlm_work_item *item = NULL; | 1332 | struct dlm_work_item *item = NULL; |
1332 | struct dlm_lock_resource *res = NULL; | 1333 | struct dlm_lock_resource *res = NULL; |
@@ -1404,16 +1405,28 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1404 | __dlm_insert_lockres(dlm, res); | 1405 | __dlm_insert_lockres(dlm, res); |
1405 | spin_unlock(&dlm->spinlock); | 1406 | spin_unlock(&dlm->spinlock); |
1406 | 1407 | ||
1408 | /* Add an extra ref for this lock-less lockres lest the | ||
1409 | * dlm_thread purges it before we get the chance to add | ||
1410 | * locks to it */ | ||
1411 | dlm_lockres_get(res); | ||
1412 | |||
1413 | /* There are three refs that need to be put. | ||
1414 | * 1. Taken above. | ||
1415 | * 2. kref_init in dlm_new_lockres()->dlm_init_lockres(). | ||
1416 | * 3. dlm_lookup_lockres() | ||
1417 | * The first one is handled at the end of this function. The | ||
1418 | * other two are handled in the worker thread after locks have | ||
1419 | * been attached. Yes, we don't wait for purge time to match | ||
1420 | * kref_init. The lockres will still have atleast one ref | ||
1421 | * added because it is in the hash __dlm_insert_lockres() */ | ||
1422 | extra_refs++; | ||
1423 | |||
1407 | /* now that the new lockres is inserted, | 1424 | /* now that the new lockres is inserted, |
1408 | * make it usable by other processes */ | 1425 | * make it usable by other processes */ |
1409 | spin_lock(&res->spinlock); | 1426 | spin_lock(&res->spinlock); |
1410 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; | 1427 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; |
1411 | spin_unlock(&res->spinlock); | 1428 | spin_unlock(&res->spinlock); |
1412 | wake_up(&res->wq); | 1429 | wake_up(&res->wq); |
1413 | |||
1414 | /* add an extra ref for just-allocated lockres | ||
1415 | * otherwise the lockres will be purged immediately */ | ||
1416 | dlm_lockres_get(res); | ||
1417 | } | 1430 | } |
1418 | 1431 | ||
1419 | /* at this point we have allocated everything we need, | 1432 | /* at this point we have allocated everything we need, |
@@ -1443,12 +1456,17 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1443 | dlm_init_work_item(dlm, item, dlm_mig_lockres_worker, buf); | 1456 | dlm_init_work_item(dlm, item, dlm_mig_lockres_worker, buf); |
1444 | item->u.ml.lockres = res; /* already have a ref */ | 1457 | item->u.ml.lockres = res; /* already have a ref */ |
1445 | item->u.ml.real_master = real_master; | 1458 | item->u.ml.real_master = real_master; |
1459 | item->u.ml.extra_ref = extra_refs; | ||
1446 | spin_lock(&dlm->work_lock); | 1460 | spin_lock(&dlm->work_lock); |
1447 | list_add_tail(&item->list, &dlm->work_list); | 1461 | list_add_tail(&item->list, &dlm->work_list); |
1448 | spin_unlock(&dlm->work_lock); | 1462 | spin_unlock(&dlm->work_lock); |
1449 | queue_work(dlm->dlm_worker, &dlm->dispatched_work); | 1463 | queue_work(dlm->dlm_worker, &dlm->dispatched_work); |
1450 | 1464 | ||
1451 | leave: | 1465 | leave: |
1466 | /* One extra ref taken needs to be put here */ | ||
1467 | if (extra_refs) | ||
1468 | dlm_lockres_put(res); | ||
1469 | |||
1452 | dlm_put(dlm); | 1470 | dlm_put(dlm); |
1453 | if (ret < 0) { | 1471 | if (ret < 0) { |
1454 | if (buf) | 1472 | if (buf) |
@@ -1464,17 +1482,19 @@ leave: | |||
1464 | 1482 | ||
1465 | static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data) | 1483 | static void dlm_mig_lockres_worker(struct dlm_work_item *item, void *data) |
1466 | { | 1484 | { |
1467 | struct dlm_ctxt *dlm = data; | 1485 | struct dlm_ctxt *dlm; |
1468 | struct dlm_migratable_lockres *mres; | 1486 | struct dlm_migratable_lockres *mres; |
1469 | int ret = 0; | 1487 | int ret = 0; |
1470 | struct dlm_lock_resource *res; | 1488 | struct dlm_lock_resource *res; |
1471 | u8 real_master; | 1489 | u8 real_master; |
1490 | u8 extra_ref; | ||
1472 | 1491 | ||
1473 | dlm = item->dlm; | 1492 | dlm = item->dlm; |
1474 | mres = (struct dlm_migratable_lockres *)data; | 1493 | mres = (struct dlm_migratable_lockres *)data; |
1475 | 1494 | ||
1476 | res = item->u.ml.lockres; | 1495 | res = item->u.ml.lockres; |
1477 | real_master = item->u.ml.real_master; | 1496 | real_master = item->u.ml.real_master; |
1497 | extra_ref = item->u.ml.extra_ref; | ||
1478 | 1498 | ||
1479 | if (real_master == DLM_LOCK_RES_OWNER_UNKNOWN) { | 1499 | if (real_master == DLM_LOCK_RES_OWNER_UNKNOWN) { |
1480 | /* this case is super-rare. only occurs if | 1500 | /* this case is super-rare. only occurs if |
@@ -1517,6 +1537,12 @@ again: | |||
1517 | } | 1537 | } |
1518 | 1538 | ||
1519 | leave: | 1539 | leave: |
1540 | /* See comment in dlm_mig_lockres_handler() */ | ||
1541 | if (res) { | ||
1542 | if (extra_ref) | ||
1543 | dlm_lockres_put(res); | ||
1544 | dlm_lockres_put(res); | ||
1545 | } | ||
1520 | kfree(data); | 1546 | kfree(data); |
1521 | mlog_exit(ret); | 1547 | mlog_exit(ret); |
1522 | } | 1548 | } |
@@ -1644,7 +1670,8 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1644 | /* retry!? */ | 1670 | /* retry!? */ |
1645 | BUG(); | 1671 | BUG(); |
1646 | } | 1672 | } |
1647 | } | 1673 | } else /* put.. incase we are not the master */ |
1674 | dlm_lockres_put(res); | ||
1648 | spin_unlock(&res->spinlock); | 1675 | spin_unlock(&res->spinlock); |
1649 | } | 1676 | } |
1650 | spin_unlock(&dlm->spinlock); | 1677 | spin_unlock(&dlm->spinlock); |
@@ -1921,6 +1948,7 @@ void dlm_move_lockres_to_recovery_list(struct dlm_ctxt *dlm, | |||
1921 | "Recovering res %s:%.*s, is already on recovery list!\n", | 1948 | "Recovering res %s:%.*s, is already on recovery list!\n", |
1922 | dlm->name, res->lockname.len, res->lockname.name); | 1949 | dlm->name, res->lockname.len, res->lockname.name); |
1923 | list_del_init(&res->recovering); | 1950 | list_del_init(&res->recovering); |
1951 | dlm_lockres_put(res); | ||
1924 | } | 1952 | } |
1925 | /* We need to hold a reference while on the recovery list */ | 1953 | /* We need to hold a reference while on the recovery list */ |
1926 | dlm_lockres_get(res); | 1954 | dlm_lockres_get(res); |
@@ -2130,11 +2158,16 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm, | |||
2130 | assert_spin_locked(&dlm->spinlock); | 2158 | assert_spin_locked(&dlm->spinlock); |
2131 | assert_spin_locked(&res->spinlock); | 2159 | assert_spin_locked(&res->spinlock); |
2132 | 2160 | ||
2161 | /* We do two dlm_lock_put(). One for removing from list and the other is | ||
2162 | * to force the DLM_UNLOCK_FREE_LOCK action so as to free the locks */ | ||
2163 | |||
2133 | /* TODO: check pending_asts, pending_basts here */ | 2164 | /* TODO: check pending_asts, pending_basts here */ |
2134 | list_for_each_entry_safe(lock, next, &res->granted, list) { | 2165 | list_for_each_entry_safe(lock, next, &res->granted, list) { |
2135 | if (lock->ml.node == dead_node) { | 2166 | if (lock->ml.node == dead_node) { |
2136 | list_del_init(&lock->list); | 2167 | list_del_init(&lock->list); |
2137 | dlm_lock_put(lock); | 2168 | dlm_lock_put(lock); |
2169 | /* Can't schedule DLM_UNLOCK_FREE_LOCK - do manually */ | ||
2170 | dlm_lock_put(lock); | ||
2138 | freed++; | 2171 | freed++; |
2139 | } | 2172 | } |
2140 | } | 2173 | } |
@@ -2142,6 +2175,8 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm, | |||
2142 | if (lock->ml.node == dead_node) { | 2175 | if (lock->ml.node == dead_node) { |
2143 | list_del_init(&lock->list); | 2176 | list_del_init(&lock->list); |
2144 | dlm_lock_put(lock); | 2177 | dlm_lock_put(lock); |
2178 | /* Can't schedule DLM_UNLOCK_FREE_LOCK - do manually */ | ||
2179 | dlm_lock_put(lock); | ||
2145 | freed++; | 2180 | freed++; |
2146 | } | 2181 | } |
2147 | } | 2182 | } |
@@ -2149,6 +2184,8 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm, | |||
2149 | if (lock->ml.node == dead_node) { | 2184 | if (lock->ml.node == dead_node) { |
2150 | list_del_init(&lock->list); | 2185 | list_del_init(&lock->list); |
2151 | dlm_lock_put(lock); | 2186 | dlm_lock_put(lock); |
2187 | /* Can't schedule DLM_UNLOCK_FREE_LOCK - do manually */ | ||
2188 | dlm_lock_put(lock); | ||
2152 | freed++; | 2189 | freed++; |
2153 | } | 2190 | } |
2154 | } | 2191 | } |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index cebd089f8955..4060bb328bc8 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -176,12 +176,14 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
176 | res->lockname.name, master); | 176 | res->lockname.name, master); |
177 | 177 | ||
178 | if (!master) { | 178 | if (!master) { |
179 | /* drop spinlock... retake below */ | ||
180 | spin_unlock(&dlm->spinlock); | ||
181 | |||
179 | spin_lock(&res->spinlock); | 182 | spin_lock(&res->spinlock); |
180 | /* This ensures that clear refmap is sent after the set */ | 183 | /* This ensures that clear refmap is sent after the set */ |
181 | __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG); | 184 | __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG); |
182 | spin_unlock(&res->spinlock); | 185 | spin_unlock(&res->spinlock); |
183 | /* drop spinlock to do messaging, retake below */ | 186 | |
184 | spin_unlock(&dlm->spinlock); | ||
185 | /* clear our bit from the master's refmap, ignore errors */ | 187 | /* clear our bit from the master's refmap, ignore errors */ |
186 | ret = dlm_drop_lockres_ref(dlm, res); | 188 | ret = dlm_drop_lockres_ref(dlm, res); |
187 | if (ret < 0) { | 189 | if (ret < 0) { |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 351130c9b734..1f1873bf41fb 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -2409,7 +2409,7 @@ static int ocfs2_dlm_seq_show(struct seq_file *m, void *v) | |||
2409 | return 0; | 2409 | return 0; |
2410 | } | 2410 | } |
2411 | 2411 | ||
2412 | static struct seq_operations ocfs2_dlm_seq_ops = { | 2412 | static const struct seq_operations ocfs2_dlm_seq_ops = { |
2413 | .start = ocfs2_dlm_seq_start, | 2413 | .start = ocfs2_dlm_seq_start, |
2414 | .stop = ocfs2_dlm_seq_stop, | 2414 | .stop = ocfs2_dlm_seq_stop, |
2415 | .next = ocfs2_dlm_seq_next, | 2415 | .next = ocfs2_dlm_seq_next, |
@@ -3042,7 +3042,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, | |||
3042 | inode = ocfs2_lock_res_inode(lockres); | 3042 | inode = ocfs2_lock_res_inode(lockres); |
3043 | mapping = inode->i_mapping; | 3043 | mapping = inode->i_mapping; |
3044 | 3044 | ||
3045 | if (S_ISREG(inode->i_mode)) | 3045 | if (!S_ISREG(inode->i_mode)) |
3046 | goto out; | 3046 | goto out; |
3047 | 3047 | ||
3048 | /* | 3048 | /* |
@@ -3219,8 +3219,8 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres, | |||
3219 | return UNBLOCK_CONTINUE_POST; | 3219 | return UNBLOCK_CONTINUE_POST; |
3220 | } | 3220 | } |
3221 | 3221 | ||
3222 | void ocfs2_process_blocked_lock(struct ocfs2_super *osb, | 3222 | static void ocfs2_process_blocked_lock(struct ocfs2_super *osb, |
3223 | struct ocfs2_lock_res *lockres) | 3223 | struct ocfs2_lock_res *lockres) |
3224 | { | 3224 | { |
3225 | int status; | 3225 | int status; |
3226 | struct ocfs2_unblock_ctl ctl = {0, 0,}; | 3226 | struct ocfs2_unblock_ctl ctl = {0, 0,}; |
@@ -3356,7 +3356,7 @@ static int ocfs2_downconvert_thread_should_wake(struct ocfs2_super *osb) | |||
3356 | return should_wake; | 3356 | return should_wake; |
3357 | } | 3357 | } |
3358 | 3358 | ||
3359 | int ocfs2_downconvert_thread(void *arg) | 3359 | static int ocfs2_downconvert_thread(void *arg) |
3360 | { | 3360 | { |
3361 | int status = 0; | 3361 | int status = 0; |
3362 | struct ocfs2_super *osb = arg; | 3362 | struct ocfs2_super *osb = arg; |
diff --git a/fs/ocfs2/dlmglue.h b/fs/ocfs2/dlmglue.h index 1d5b0699d0a9..e3cf902404b4 100644 --- a/fs/ocfs2/dlmglue.h +++ b/fs/ocfs2/dlmglue.h | |||
@@ -109,8 +109,6 @@ void ocfs2_simple_drop_lockres(struct ocfs2_super *osb, | |||
109 | struct ocfs2_lock_res *lockres); | 109 | struct ocfs2_lock_res *lockres); |
110 | 110 | ||
111 | /* for the downconvert thread */ | 111 | /* for the downconvert thread */ |
112 | void ocfs2_process_blocked_lock(struct ocfs2_super *osb, | ||
113 | struct ocfs2_lock_res *lockres); | ||
114 | void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb); | 112 | void ocfs2_wake_downconvert_thread(struct ocfs2_super *osb); |
115 | 113 | ||
116 | struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void); | 114 | struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void); |
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c index c0efd9489fe8..0758daf64da0 100644 --- a/fs/ocfs2/heartbeat.c +++ b/fs/ocfs2/heartbeat.c | |||
@@ -49,10 +49,15 @@ static inline void __ocfs2_node_map_set_bit(struct ocfs2_node_map *map, | |||
49 | static inline void __ocfs2_node_map_clear_bit(struct ocfs2_node_map *map, | 49 | static inline void __ocfs2_node_map_clear_bit(struct ocfs2_node_map *map, |
50 | int bit); | 50 | int bit); |
51 | static inline int __ocfs2_node_map_is_empty(struct ocfs2_node_map *map); | 51 | static inline int __ocfs2_node_map_is_empty(struct ocfs2_node_map *map); |
52 | static void __ocfs2_node_map_dup(struct ocfs2_node_map *target, | 52 | |
53 | struct ocfs2_node_map *from); | 53 | /* special case -1 for now |
54 | static void __ocfs2_node_map_set(struct ocfs2_node_map *target, | 54 | * TODO: should *really* make sure the calling func never passes -1!! */ |
55 | struct ocfs2_node_map *from); | 55 | static void ocfs2_node_map_init(struct ocfs2_node_map *map) |
56 | { | ||
57 | map->num_nodes = OCFS2_NODE_MAP_MAX_NODES; | ||
58 | memset(map->map, 0, BITS_TO_LONGS(OCFS2_NODE_MAP_MAX_NODES) * | ||
59 | sizeof(unsigned long)); | ||
60 | } | ||
56 | 61 | ||
57 | void ocfs2_init_node_maps(struct ocfs2_super *osb) | 62 | void ocfs2_init_node_maps(struct ocfs2_super *osb) |
58 | { | 63 | { |
@@ -136,15 +141,6 @@ void ocfs2_stop_heartbeat(struct ocfs2_super *osb) | |||
136 | mlog_errno(ret); | 141 | mlog_errno(ret); |
137 | } | 142 | } |
138 | 143 | ||
139 | /* special case -1 for now | ||
140 | * TODO: should *really* make sure the calling func never passes -1!! */ | ||
141 | void ocfs2_node_map_init(struct ocfs2_node_map *map) | ||
142 | { | ||
143 | map->num_nodes = OCFS2_NODE_MAP_MAX_NODES; | ||
144 | memset(map->map, 0, BITS_TO_LONGS(OCFS2_NODE_MAP_MAX_NODES) * | ||
145 | sizeof(unsigned long)); | ||
146 | } | ||
147 | |||
148 | static inline void __ocfs2_node_map_set_bit(struct ocfs2_node_map *map, | 144 | static inline void __ocfs2_node_map_set_bit(struct ocfs2_node_map *map, |
149 | int bit) | 145 | int bit) |
150 | { | 146 | { |
@@ -216,6 +212,8 @@ int ocfs2_node_map_is_empty(struct ocfs2_super *osb, | |||
216 | return ret; | 212 | return ret; |
217 | } | 213 | } |
218 | 214 | ||
215 | #if 0 | ||
216 | |||
219 | static void __ocfs2_node_map_dup(struct ocfs2_node_map *target, | 217 | static void __ocfs2_node_map_dup(struct ocfs2_node_map *target, |
220 | struct ocfs2_node_map *from) | 218 | struct ocfs2_node_map *from) |
221 | { | 219 | { |
@@ -254,6 +252,8 @@ static void __ocfs2_node_map_set(struct ocfs2_node_map *target, | |||
254 | target->map[i] = from->map[i]; | 252 | target->map[i] = from->map[i]; |
255 | } | 253 | } |
256 | 254 | ||
255 | #endif /* 0 */ | ||
256 | |||
257 | /* Returns whether the recovery bit was actually set - it may not be | 257 | /* Returns whether the recovery bit was actually set - it may not be |
258 | * if a node is still marked as needing recovery */ | 258 | * if a node is still marked as needing recovery */ |
259 | int ocfs2_recovery_map_set(struct ocfs2_super *osb, | 259 | int ocfs2_recovery_map_set(struct ocfs2_super *osb, |
diff --git a/fs/ocfs2/heartbeat.h b/fs/ocfs2/heartbeat.h index 56859211888a..eac63aed7611 100644 --- a/fs/ocfs2/heartbeat.h +++ b/fs/ocfs2/heartbeat.h | |||
@@ -33,7 +33,6 @@ void ocfs2_stop_heartbeat(struct ocfs2_super *osb); | |||
33 | 33 | ||
34 | /* node map functions - used to keep track of mounted and in-recovery | 34 | /* node map functions - used to keep track of mounted and in-recovery |
35 | * nodes. */ | 35 | * nodes. */ |
36 | void ocfs2_node_map_init(struct ocfs2_node_map *map); | ||
37 | int ocfs2_node_map_is_empty(struct ocfs2_super *osb, | 36 | int ocfs2_node_map_is_empty(struct ocfs2_super *osb, |
38 | struct ocfs2_node_map *map); | 37 | struct ocfs2_node_map *map); |
39 | void ocfs2_node_map_set_bit(struct ocfs2_super *osb, | 38 | void ocfs2_node_map_set_bit(struct ocfs2_super *osb, |
@@ -57,9 +56,5 @@ int ocfs2_recovery_map_set(struct ocfs2_super *osb, | |||
57 | int num); | 56 | int num); |
58 | void ocfs2_recovery_map_clear(struct ocfs2_super *osb, | 57 | void ocfs2_recovery_map_clear(struct ocfs2_super *osb, |
59 | int num); | 58 | int num); |
60 | /* returns 1 if bit is the only bit set in target, 0 otherwise */ | ||
61 | int ocfs2_node_map_is_only(struct ocfs2_super *osb, | ||
62 | struct ocfs2_node_map *target, | ||
63 | int bit); | ||
64 | 59 | ||
65 | #endif /* OCFS2_HEARTBEAT_H */ | 60 | #endif /* OCFS2_HEARTBEAT_H */ |
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index add1ffdc5c6c..ab83fd562429 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -120,9 +120,6 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb) | |||
120 | 120 | ||
121 | mlog_entry_void(); | 121 | mlog_entry_void(); |
122 | 122 | ||
123 | if (ocfs2_mount_local(osb)) | ||
124 | goto bail; | ||
125 | |||
126 | if (osb->local_alloc_size == 0) | 123 | if (osb->local_alloc_size == 0) |
127 | goto bail; | 124 | goto bail; |
128 | 125 | ||
@@ -588,8 +585,7 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, | |||
588 | while(bits_wanted--) | 585 | while(bits_wanted--) |
589 | ocfs2_set_bit(start++, bitmap); | 586 | ocfs2_set_bit(start++, bitmap); |
590 | 587 | ||
591 | alloc->id1.bitmap1.i_used = cpu_to_le32(*num_bits + | 588 | le32_add_cpu(&alloc->id1.bitmap1.i_used, *num_bits); |
592 | le32_to_cpu(alloc->id1.bitmap1.i_used)); | ||
593 | 589 | ||
594 | status = ocfs2_journal_dirty(handle, osb->local_alloc_bh); | 590 | status = ocfs2_journal_dirty(handle, osb->local_alloc_bh); |
595 | if (status < 0) { | 591 | if (status < 0) { |
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c index 37835ffcb039..8166968e9015 100644 --- a/fs/ocfs2/resize.c +++ b/fs/ocfs2/resize.c | |||
@@ -597,7 +597,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) | |||
597 | memset(cr, 0, sizeof(struct ocfs2_chain_rec)); | 597 | memset(cr, 0, sizeof(struct ocfs2_chain_rec)); |
598 | } | 598 | } |
599 | 599 | ||
600 | cr->c_blkno = le64_to_cpu(input->group); | 600 | cr->c_blkno = cpu_to_le64(input->group); |
601 | le32_add_cpu(&cr->c_total, input->clusters * cl_bpc); | 601 | le32_add_cpu(&cr->c_total, input->clusters * cl_bpc); |
602 | le32_add_cpu(&cr->c_free, input->frees * cl_bpc); | 602 | le32_add_cpu(&cr->c_free, input->frees * cl_bpc); |
603 | 603 | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 3217774d269f..9a4da0aae02e 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -314,9 +314,12 @@ static int proc_pid_schedstat(struct task_struct *task, char *buffer) | |||
314 | static int lstats_show_proc(struct seq_file *m, void *v) | 314 | static int lstats_show_proc(struct seq_file *m, void *v) |
315 | { | 315 | { |
316 | int i; | 316 | int i; |
317 | struct task_struct *task = m->private; | 317 | struct inode *inode = m->private; |
318 | seq_puts(m, "Latency Top version : v0.1\n"); | 318 | struct task_struct *task = get_proc_task(inode); |
319 | 319 | ||
320 | if (!task) | ||
321 | return -ESRCH; | ||
322 | seq_puts(m, "Latency Top version : v0.1\n"); | ||
320 | for (i = 0; i < 32; i++) { | 323 | for (i = 0; i < 32; i++) { |
321 | if (task->latency_record[i].backtrace[0]) { | 324 | if (task->latency_record[i].backtrace[0]) { |
322 | int q; | 325 | int q; |
@@ -341,32 +344,24 @@ static int lstats_show_proc(struct seq_file *m, void *v) | |||
341 | } | 344 | } |
342 | 345 | ||
343 | } | 346 | } |
347 | put_task_struct(task); | ||
344 | return 0; | 348 | return 0; |
345 | } | 349 | } |
346 | 350 | ||
347 | static int lstats_open(struct inode *inode, struct file *file) | 351 | static int lstats_open(struct inode *inode, struct file *file) |
348 | { | 352 | { |
349 | int ret; | 353 | return single_open(file, lstats_show_proc, inode); |
350 | struct seq_file *m; | ||
351 | struct task_struct *task = get_proc_task(inode); | ||
352 | |||
353 | ret = single_open(file, lstats_show_proc, NULL); | ||
354 | if (!ret) { | ||
355 | m = file->private_data; | ||
356 | m->private = task; | ||
357 | } | ||
358 | return ret; | ||
359 | } | 354 | } |
360 | 355 | ||
361 | static ssize_t lstats_write(struct file *file, const char __user *buf, | 356 | static ssize_t lstats_write(struct file *file, const char __user *buf, |
362 | size_t count, loff_t *offs) | 357 | size_t count, loff_t *offs) |
363 | { | 358 | { |
364 | struct seq_file *m; | 359 | struct task_struct *task = get_proc_task(file->f_dentry->d_inode); |
365 | struct task_struct *task; | ||
366 | 360 | ||
367 | m = file->private_data; | 361 | if (!task) |
368 | task = m->private; | 362 | return -ESRCH; |
369 | clear_all_latency_tracing(task); | 363 | clear_all_latency_tracing(task); |
364 | put_task_struct(task); | ||
370 | 365 | ||
371 | return count; | 366 | return count; |
372 | } | 367 | } |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 468805d40e2b..2d563979cb02 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
33 | #include <linux/swap.h> | 33 | #include <linux/swap.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/genhd.h> | ||
35 | #include <linux/smp.h> | 36 | #include <linux/smp.h> |
36 | #include <linux/signal.h> | 37 | #include <linux/signal.h> |
37 | #include <linux/module.h> | 38 | #include <linux/module.h> |
@@ -377,7 +378,6 @@ static int stram_read_proc(char *page, char **start, off_t off, | |||
377 | #endif | 378 | #endif |
378 | 379 | ||
379 | #ifdef CONFIG_BLOCK | 380 | #ifdef CONFIG_BLOCK |
380 | extern const struct seq_operations partitions_op; | ||
381 | static int partitions_open(struct inode *inode, struct file *file) | 381 | static int partitions_open(struct inode *inode, struct file *file) |
382 | { | 382 | { |
383 | return seq_open(file, &partitions_op); | 383 | return seq_open(file, &partitions_op); |
@@ -389,7 +389,6 @@ static const struct file_operations proc_partitions_operations = { | |||
389 | .release = seq_release, | 389 | .release = seq_release, |
390 | }; | 390 | }; |
391 | 391 | ||
392 | extern const struct seq_operations diskstats_op; | ||
393 | static int diskstats_open(struct inode *inode, struct file *file) | 392 | static int diskstats_open(struct inode *inode, struct file *file) |
394 | { | 393 | { |
395 | return seq_open(file, &diskstats_op); | 394 | return seq_open(file, &diskstats_op); |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 6dc0334815f7..4206454734e0 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -640,17 +640,17 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
640 | 640 | ||
641 | ret = -EACCES; | 641 | ret = -EACCES; |
642 | if (!ptrace_may_attach(task)) | 642 | if (!ptrace_may_attach(task)) |
643 | goto out; | 643 | goto out_task; |
644 | 644 | ||
645 | ret = -EINVAL; | 645 | ret = -EINVAL; |
646 | /* file position must be aligned */ | 646 | /* file position must be aligned */ |
647 | if (*ppos % PM_ENTRY_BYTES) | 647 | if (*ppos % PM_ENTRY_BYTES) |
648 | goto out; | 648 | goto out_task; |
649 | 649 | ||
650 | ret = 0; | 650 | ret = 0; |
651 | mm = get_task_mm(task); | 651 | mm = get_task_mm(task); |
652 | if (!mm) | 652 | if (!mm) |
653 | goto out; | 653 | goto out_task; |
654 | 654 | ||
655 | ret = -ENOMEM; | 655 | ret = -ENOMEM; |
656 | uaddr = (unsigned long)buf & PAGE_MASK; | 656 | uaddr = (unsigned long)buf & PAGE_MASK; |
@@ -658,7 +658,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
658 | pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE; | 658 | pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE; |
659 | pages = kmalloc(pagecount * sizeof(struct page *), GFP_KERNEL); | 659 | pages = kmalloc(pagecount * sizeof(struct page *), GFP_KERNEL); |
660 | if (!pages) | 660 | if (!pages) |
661 | goto out_task; | 661 | goto out_mm; |
662 | 662 | ||
663 | down_read(¤t->mm->mmap_sem); | 663 | down_read(¤t->mm->mmap_sem); |
664 | ret = get_user_pages(current, current->mm, uaddr, pagecount, | 664 | ret = get_user_pages(current, current->mm, uaddr, pagecount, |
@@ -668,6 +668,12 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
668 | if (ret < 0) | 668 | if (ret < 0) |
669 | goto out_free; | 669 | goto out_free; |
670 | 670 | ||
671 | if (ret != pagecount) { | ||
672 | pagecount = ret; | ||
673 | ret = -EFAULT; | ||
674 | goto out_pages; | ||
675 | } | ||
676 | |||
671 | pm.out = buf; | 677 | pm.out = buf; |
672 | pm.end = buf + count; | 678 | pm.end = buf + count; |
673 | 679 | ||
@@ -699,15 +705,17 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
699 | ret = pm.out - buf; | 705 | ret = pm.out - buf; |
700 | } | 706 | } |
701 | 707 | ||
708 | out_pages: | ||
702 | for (; pagecount; pagecount--) { | 709 | for (; pagecount; pagecount--) { |
703 | page = pages[pagecount-1]; | 710 | page = pages[pagecount-1]; |
704 | if (!PageReserved(page)) | 711 | if (!PageReserved(page)) |
705 | SetPageDirty(page); | 712 | SetPageDirty(page); |
706 | page_cache_release(page); | 713 | page_cache_release(page); |
707 | } | 714 | } |
708 | mmput(mm); | ||
709 | out_free: | 715 | out_free: |
710 | kfree(pages); | 716 | kfree(pages); |
717 | out_mm: | ||
718 | mmput(mm); | ||
711 | out_task: | 719 | out_task: |
712 | put_task_struct(task); | 720 | put_task_struct(task); |
713 | out: | 721 | out: |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 6841452e0dea..393cc22c1717 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -2031,7 +2031,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2031 | return -EXDEV; | 2031 | return -EXDEV; |
2032 | } | 2032 | } |
2033 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ | 2033 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ |
2034 | if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) { | 2034 | if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) { |
2035 | reiserfs_warning(sb, | 2035 | reiserfs_warning(sb, |
2036 | "reiserfs: Quota file must have tail packing disabled."); | 2036 | "reiserfs: Quota file must have tail packing disabled."); |
2037 | path_put(&nd.path); | 2037 | path_put(&nd.path); |
diff --git a/fs/splice.c b/fs/splice.c index 9b559ee711a8..0670c915cd35 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1669,6 +1669,13 @@ static int link_pipe(struct pipe_inode_info *ipipe, | |||
1669 | i++; | 1669 | i++; |
1670 | } while (len); | 1670 | } while (len); |
1671 | 1671 | ||
1672 | /* | ||
1673 | * return EAGAIN if we have the potential of some data in the | ||
1674 | * future, otherwise just return 0 | ||
1675 | */ | ||
1676 | if (!ret && ipipe->waiting_writers && (flags & SPLICE_F_NONBLOCK)) | ||
1677 | ret = -EAGAIN; | ||
1678 | |||
1672 | inode_double_unlock(ipipe->inode, opipe->inode); | 1679 | inode_double_unlock(ipipe->inode, opipe->inode); |
1673 | 1680 | ||
1674 | /* | 1681 | /* |
@@ -1709,11 +1716,8 @@ static long do_tee(struct file *in, struct file *out, size_t len, | |||
1709 | ret = link_ipipe_prep(ipipe, flags); | 1716 | ret = link_ipipe_prep(ipipe, flags); |
1710 | if (!ret) { | 1717 | if (!ret) { |
1711 | ret = link_opipe_prep(opipe, flags); | 1718 | ret = link_opipe_prep(opipe, flags); |
1712 | if (!ret) { | 1719 | if (!ret) |
1713 | ret = link_pipe(ipipe, opipe, len, flags); | 1720 | ret = link_pipe(ipipe, opipe, len, flags); |
1714 | if (!ret && (flags & SPLICE_F_NONBLOCK)) | ||
1715 | ret = -EAGAIN; | ||
1716 | } | ||
1717 | } | 1721 | } |
1718 | } | 1722 | } |
1719 | 1723 | ||
diff --git a/fs/super.c b/fs/super.c index 88811f60c8de..010446d8c40a 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -870,12 +870,12 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void | |||
870 | if (!mnt) | 870 | if (!mnt) |
871 | goto out; | 871 | goto out; |
872 | 872 | ||
873 | if (data) { | 873 | if (data && !(type->fs_flags & FS_BINARY_MOUNTDATA)) { |
874 | secdata = alloc_secdata(); | 874 | secdata = alloc_secdata(); |
875 | if (!secdata) | 875 | if (!secdata) |
876 | goto out_mnt; | 876 | goto out_mnt; |
877 | 877 | ||
878 | error = security_sb_copy_data(type, data, secdata); | 878 | error = security_sb_copy_data(data, secdata); |
879 | if (error) | 879 | if (error) |
880 | goto out_free_secdata; | 880 | goto out_free_secdata; |
881 | } | 881 | } |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 21dfc9da235e..8831d9518790 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -171,7 +171,7 @@ xfs_parseargs( | |||
171 | char *this_char, *value, *eov; | 171 | char *this_char, *value, *eov; |
172 | int dsunit, dswidth, vol_dsunit, vol_dswidth; | 172 | int dsunit, dswidth, vol_dsunit, vol_dswidth; |
173 | int iosize; | 173 | int iosize; |
174 | int ikeep = 0; | 174 | int dmapi_implies_ikeep = 1; |
175 | 175 | ||
176 | args->flags |= XFSMNT_BARRIER; | 176 | args->flags |= XFSMNT_BARRIER; |
177 | args->flags2 |= XFSMNT2_COMPAT_IOSIZE; | 177 | args->flags2 |= XFSMNT2_COMPAT_IOSIZE; |
@@ -302,10 +302,10 @@ xfs_parseargs( | |||
302 | } else if (!strcmp(this_char, MNTOPT_NOBARRIER)) { | 302 | } else if (!strcmp(this_char, MNTOPT_NOBARRIER)) { |
303 | args->flags &= ~XFSMNT_BARRIER; | 303 | args->flags &= ~XFSMNT_BARRIER; |
304 | } else if (!strcmp(this_char, MNTOPT_IKEEP)) { | 304 | } else if (!strcmp(this_char, MNTOPT_IKEEP)) { |
305 | ikeep = 1; | 305 | args->flags |= XFSMNT_IKEEP; |
306 | args->flags &= ~XFSMNT_IDELETE; | ||
307 | } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) { | 306 | } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) { |
308 | args->flags |= XFSMNT_IDELETE; | 307 | dmapi_implies_ikeep = 0; |
308 | args->flags &= ~XFSMNT_IKEEP; | ||
309 | } else if (!strcmp(this_char, MNTOPT_LARGEIO)) { | 309 | } else if (!strcmp(this_char, MNTOPT_LARGEIO)) { |
310 | args->flags2 &= ~XFSMNT2_COMPAT_IOSIZE; | 310 | args->flags2 &= ~XFSMNT2_COMPAT_IOSIZE; |
311 | } else if (!strcmp(this_char, MNTOPT_NOLARGEIO)) { | 311 | } else if (!strcmp(this_char, MNTOPT_NOLARGEIO)) { |
@@ -410,8 +410,8 @@ xfs_parseargs( | |||
410 | * Note that if "ikeep" or "noikeep" mount options are | 410 | * Note that if "ikeep" or "noikeep" mount options are |
411 | * supplied, then they are honored. | 411 | * supplied, then they are honored. |
412 | */ | 412 | */ |
413 | if (!(args->flags & XFSMNT_DMAPI) && !ikeep) | 413 | if ((args->flags & XFSMNT_DMAPI) && dmapi_implies_ikeep) |
414 | args->flags |= XFSMNT_IDELETE; | 414 | args->flags |= XFSMNT_IKEEP; |
415 | 415 | ||
416 | if ((args->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { | 416 | if ((args->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) { |
417 | if (dsunit) { | 417 | if (dsunit) { |
@@ -446,6 +446,7 @@ xfs_showargs( | |||
446 | { | 446 | { |
447 | static struct proc_xfs_info xfs_info_set[] = { | 447 | static struct proc_xfs_info xfs_info_set[] = { |
448 | /* the few simple ones we can get from the mount struct */ | 448 | /* the few simple ones we can get from the mount struct */ |
449 | { XFS_MOUNT_IKEEP, "," MNTOPT_IKEEP }, | ||
449 | { XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC }, | 450 | { XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC }, |
450 | { XFS_MOUNT_INO64, "," MNTOPT_INO64 }, | 451 | { XFS_MOUNT_INO64, "," MNTOPT_INO64 }, |
451 | { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN }, | 452 | { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN }, |
@@ -461,7 +462,6 @@ xfs_showargs( | |||
461 | }; | 462 | }; |
462 | static struct proc_xfs_info xfs_info_unset[] = { | 463 | static struct proc_xfs_info xfs_info_unset[] = { |
463 | /* the few simple ones we can get from the mount struct */ | 464 | /* the few simple ones we can get from the mount struct */ |
464 | { XFS_MOUNT_IDELETE, "," MNTOPT_IKEEP }, | ||
465 | { XFS_MOUNT_COMPAT_IOSIZE, "," MNTOPT_LARGEIO }, | 465 | { XFS_MOUNT_COMPAT_IOSIZE, "," MNTOPT_LARGEIO }, |
466 | { XFS_MOUNT_BARRIER, "," MNTOPT_NOBARRIER }, | 466 | { XFS_MOUNT_BARRIER, "," MNTOPT_NOBARRIER }, |
467 | { XFS_MOUNT_SMALL_INUMS, "," MNTOPT_64BITINODE }, | 467 | { XFS_MOUNT_SMALL_INUMS, "," MNTOPT_64BITINODE }, |
diff --git a/fs/xfs/xfs_bit.c b/fs/xfs/xfs_bit.c index 48228848f5ae..fab0b6d5a41b 100644 --- a/fs/xfs/xfs_bit.c +++ b/fs/xfs/xfs_bit.c | |||
@@ -25,6 +25,109 @@ | |||
25 | * XFS bit manipulation routines, used in non-realtime code. | 25 | * XFS bit manipulation routines, used in non-realtime code. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef HAVE_ARCH_HIGHBIT | ||
29 | /* | ||
30 | * Index of high bit number in byte, -1 for none set, 0..7 otherwise. | ||
31 | */ | ||
32 | static const char xfs_highbit[256] = { | ||
33 | -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */ | ||
34 | 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */ | ||
35 | 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */ | ||
36 | 4, 4, 4, 4, 4, 4, 4, 4, /* 18 .. 1f */ | ||
37 | 5, 5, 5, 5, 5, 5, 5, 5, /* 20 .. 27 */ | ||
38 | 5, 5, 5, 5, 5, 5, 5, 5, /* 28 .. 2f */ | ||
39 | 5, 5, 5, 5, 5, 5, 5, 5, /* 30 .. 37 */ | ||
40 | 5, 5, 5, 5, 5, 5, 5, 5, /* 38 .. 3f */ | ||
41 | 6, 6, 6, 6, 6, 6, 6, 6, /* 40 .. 47 */ | ||
42 | 6, 6, 6, 6, 6, 6, 6, 6, /* 48 .. 4f */ | ||
43 | 6, 6, 6, 6, 6, 6, 6, 6, /* 50 .. 57 */ | ||
44 | 6, 6, 6, 6, 6, 6, 6, 6, /* 58 .. 5f */ | ||
45 | 6, 6, 6, 6, 6, 6, 6, 6, /* 60 .. 67 */ | ||
46 | 6, 6, 6, 6, 6, 6, 6, 6, /* 68 .. 6f */ | ||
47 | 6, 6, 6, 6, 6, 6, 6, 6, /* 70 .. 77 */ | ||
48 | 6, 6, 6, 6, 6, 6, 6, 6, /* 78 .. 7f */ | ||
49 | 7, 7, 7, 7, 7, 7, 7, 7, /* 80 .. 87 */ | ||
50 | 7, 7, 7, 7, 7, 7, 7, 7, /* 88 .. 8f */ | ||
51 | 7, 7, 7, 7, 7, 7, 7, 7, /* 90 .. 97 */ | ||
52 | 7, 7, 7, 7, 7, 7, 7, 7, /* 98 .. 9f */ | ||
53 | 7, 7, 7, 7, 7, 7, 7, 7, /* a0 .. a7 */ | ||
54 | 7, 7, 7, 7, 7, 7, 7, 7, /* a8 .. af */ | ||
55 | 7, 7, 7, 7, 7, 7, 7, 7, /* b0 .. b7 */ | ||
56 | 7, 7, 7, 7, 7, 7, 7, 7, /* b8 .. bf */ | ||
57 | 7, 7, 7, 7, 7, 7, 7, 7, /* c0 .. c7 */ | ||
58 | 7, 7, 7, 7, 7, 7, 7, 7, /* c8 .. cf */ | ||
59 | 7, 7, 7, 7, 7, 7, 7, 7, /* d0 .. d7 */ | ||
60 | 7, 7, 7, 7, 7, 7, 7, 7, /* d8 .. df */ | ||
61 | 7, 7, 7, 7, 7, 7, 7, 7, /* e0 .. e7 */ | ||
62 | 7, 7, 7, 7, 7, 7, 7, 7, /* e8 .. ef */ | ||
63 | 7, 7, 7, 7, 7, 7, 7, 7, /* f0 .. f7 */ | ||
64 | 7, 7, 7, 7, 7, 7, 7, 7, /* f8 .. ff */ | ||
65 | }; | ||
66 | #endif | ||
67 | |||
68 | /* | ||
69 | * xfs_highbit32: get high bit set out of 32-bit argument, -1 if none set. | ||
70 | */ | ||
71 | inline int | ||
72 | xfs_highbit32( | ||
73 | __uint32_t v) | ||
74 | { | ||
75 | #ifdef HAVE_ARCH_HIGHBIT | ||
76 | return highbit32(v); | ||
77 | #else | ||
78 | int i; | ||
79 | |||
80 | if (v & 0xffff0000) | ||
81 | if (v & 0xff000000) | ||
82 | i = 24; | ||
83 | else | ||
84 | i = 16; | ||
85 | else if (v & 0x0000ffff) | ||
86 | if (v & 0x0000ff00) | ||
87 | i = 8; | ||
88 | else | ||
89 | i = 0; | ||
90 | else | ||
91 | return -1; | ||
92 | return i + xfs_highbit[(v >> i) & 0xff]; | ||
93 | #endif | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * xfs_lowbit64: get low bit set out of 64-bit argument, -1 if none set. | ||
98 | */ | ||
99 | int | ||
100 | xfs_lowbit64( | ||
101 | __uint64_t v) | ||
102 | { | ||
103 | __uint32_t w = (__uint32_t)v; | ||
104 | int n = 0; | ||
105 | |||
106 | if (w) { /* lower bits */ | ||
107 | n = ffs(w); | ||
108 | } else { /* upper bits */ | ||
109 | w = (__uint32_t)(v >> 32); | ||
110 | if (w && (n = ffs(w))) | ||
111 | n += 32; | ||
112 | } | ||
113 | return n - 1; | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * xfs_highbit64: get high bit set out of 64-bit argument, -1 if none set. | ||
118 | */ | ||
119 | int | ||
120 | xfs_highbit64( | ||
121 | __uint64_t v) | ||
122 | { | ||
123 | __uint32_t h = (__uint32_t)(v >> 32); | ||
124 | |||
125 | if (h) | ||
126 | return xfs_highbit32(h) + 32; | ||
127 | return xfs_highbit32((__uint32_t)v); | ||
128 | } | ||
129 | |||
130 | |||
28 | /* | 131 | /* |
29 | * Return whether bitmap is empty. | 132 | * Return whether bitmap is empty. |
30 | * Size is number of words in the bitmap, which is padded to word boundary | 133 | * Size is number of words in the bitmap, which is padded to word boundary |
diff --git a/fs/xfs/xfs_bit.h b/fs/xfs/xfs_bit.h index 325a007dec91..082641a9782c 100644 --- a/fs/xfs/xfs_bit.h +++ b/fs/xfs/xfs_bit.h | |||
@@ -47,30 +47,13 @@ static inline __uint64_t xfs_mask64lo(int n) | |||
47 | } | 47 | } |
48 | 48 | ||
49 | /* Get high bit set out of 32-bit argument, -1 if none set */ | 49 | /* Get high bit set out of 32-bit argument, -1 if none set */ |
50 | static inline int xfs_highbit32(__uint32_t v) | 50 | extern int xfs_highbit32(__uint32_t v); |
51 | { | ||
52 | return fls(v) - 1; | ||
53 | } | ||
54 | |||
55 | /* Get high bit set out of 64-bit argument, -1 if none set */ | ||
56 | static inline int xfs_highbit64(__uint64_t v) | ||
57 | { | ||
58 | return fls64(v) - 1; | ||
59 | } | ||
60 | |||
61 | /* Get low bit set out of 32-bit argument, -1 if none set */ | ||
62 | static inline int xfs_lowbit32(__uint32_t v) | ||
63 | { | ||
64 | __uint32_t t = v; | ||
65 | return (t) ? find_first_bit((unsigned long *)&t, 32) : -1; | ||
66 | } | ||
67 | 51 | ||
68 | /* Get low bit set out of 64-bit argument, -1 if none set */ | 52 | /* Get low bit set out of 64-bit argument, -1 if none set */ |
69 | static inline int xfs_lowbit64(__uint64_t v) | 53 | extern int xfs_lowbit64(__uint64_t v); |
70 | { | 54 | |
71 | __uint64_t t = v; | 55 | /* Get high bit set out of 64-bit argument, -1 if none set */ |
72 | return (t) ? find_first_bit((unsigned long *)&t, 64) : -1; | 56 | extern int xfs_highbit64(__uint64_t); |
73 | } | ||
74 | 57 | ||
75 | /* Return whether bitmap is empty (1 == empty) */ | 58 | /* Return whether bitmap is empty (1 == empty) */ |
76 | extern int xfs_bitmap_empty(uint *map, uint size); | 59 | extern int xfs_bitmap_empty(uint *map, uint size); |
diff --git a/fs/xfs/xfs_clnt.h b/fs/xfs/xfs_clnt.h index d16c1b971074..d5d1e60ee224 100644 --- a/fs/xfs/xfs_clnt.h +++ b/fs/xfs/xfs_clnt.h | |||
@@ -86,7 +86,7 @@ struct xfs_mount_args { | |||
86 | #define XFSMNT_NOUUID 0x01000000 /* Ignore fs uuid */ | 86 | #define XFSMNT_NOUUID 0x01000000 /* Ignore fs uuid */ |
87 | #define XFSMNT_DMAPI 0x02000000 /* enable dmapi/xdsm */ | 87 | #define XFSMNT_DMAPI 0x02000000 /* enable dmapi/xdsm */ |
88 | #define XFSMNT_BARRIER 0x04000000 /* use write barriers */ | 88 | #define XFSMNT_BARRIER 0x04000000 /* use write barriers */ |
89 | #define XFSMNT_IDELETE 0x08000000 /* inode cluster delete */ | 89 | #define XFSMNT_IKEEP 0x08000000 /* inode cluster delete */ |
90 | #define XFSMNT_SWALLOC 0x10000000 /* turn on stripe width | 90 | #define XFSMNT_SWALLOC 0x10000000 /* turn on stripe width |
91 | * allocation */ | 91 | * allocation */ |
92 | #define XFSMNT_DIRSYNC 0x40000000 /* sync creat,link,unlink,rename | 92 | #define XFSMNT_DIRSYNC 0x40000000 /* sync creat,link,unlink,rename |
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index c5836b951d0c..db9d5fa600af 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -1053,7 +1053,7 @@ xfs_difree( | |||
1053 | /* | 1053 | /* |
1054 | * When an inode cluster is free, it becomes eligible for removal | 1054 | * When an inode cluster is free, it becomes eligible for removal |
1055 | */ | 1055 | */ |
1056 | if ((mp->m_flags & XFS_MOUNT_IDELETE) && | 1056 | if (!(mp->m_flags & XFS_MOUNT_IKEEP) && |
1057 | (rec.ir_freecount == XFS_IALLOC_INODES(mp))) { | 1057 | (rec.ir_freecount == XFS_IALLOC_INODES(mp))) { |
1058 | 1058 | ||
1059 | *delete = 1; | 1059 | *delete = 1; |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index f01b07687faf..8e09b71f4104 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -235,6 +235,7 @@ finish_inode: | |||
235 | */ | 235 | */ |
236 | new_icl = kmem_zone_alloc(xfs_icluster_zone, KM_SLEEP); | 236 | new_icl = kmem_zone_alloc(xfs_icluster_zone, KM_SLEEP); |
237 | if (radix_tree_preload(GFP_KERNEL)) { | 237 | if (radix_tree_preload(GFP_KERNEL)) { |
238 | xfs_idestroy(ip); | ||
238 | delay(1); | 239 | delay(1); |
239 | goto again; | 240 | goto again; |
240 | } | 241 | } |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index f7c620ec6e69..1d8a4728d847 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -366,7 +366,7 @@ typedef struct xfs_mount { | |||
366 | #define XFS_MOUNT_SMALL_INUMS (1ULL << 15) /* users wants 32bit inodes */ | 366 | #define XFS_MOUNT_SMALL_INUMS (1ULL << 15) /* users wants 32bit inodes */ |
367 | #define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */ | 367 | #define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */ |
368 | #define XFS_MOUNT_BARRIER (1ULL << 17) | 368 | #define XFS_MOUNT_BARRIER (1ULL << 17) |
369 | #define XFS_MOUNT_IDELETE (1ULL << 18) /* delete empty inode clusters*/ | 369 | #define XFS_MOUNT_IKEEP (1ULL << 18) /* keep empty inode clusters*/ |
370 | #define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width | 370 | #define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width |
371 | * allocation */ | 371 | * allocation */ |
372 | #define XFS_MOUNT_RDONLY (1ULL << 20) /* read-only fs */ | 372 | #define XFS_MOUNT_RDONLY (1ULL << 20) /* read-only fs */ |
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index ca83ddf72af4..47082c01872d 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -73,6 +73,18 @@ STATIC int xfs_rtmodify_summary(xfs_mount_t *, xfs_trans_t *, int, | |||
73 | */ | 73 | */ |
74 | 74 | ||
75 | /* | 75 | /* |
76 | * xfs_lowbit32: get low bit set out of 32-bit argument, -1 if none set. | ||
77 | */ | ||
78 | STATIC int | ||
79 | xfs_lowbit32( | ||
80 | __uint32_t v) | ||
81 | { | ||
82 | if (v) | ||
83 | return ffs(v) - 1; | ||
84 | return -1; | ||
85 | } | ||
86 | |||
87 | /* | ||
76 | * Allocate space to the bitmap or summary file, and zero it, for growfs. | 88 | * Allocate space to the bitmap or summary file, and zero it, for growfs. |
77 | */ | 89 | */ |
78 | STATIC int /* error */ | 90 | STATIC int /* error */ |
@@ -432,7 +444,6 @@ xfs_rtallocate_extent_near( | |||
432 | } | 444 | } |
433 | bbno = XFS_BITTOBLOCK(mp, bno); | 445 | bbno = XFS_BITTOBLOCK(mp, bno); |
434 | i = 0; | 446 | i = 0; |
435 | ASSERT(minlen != 0); | ||
436 | log2len = xfs_highbit32(minlen); | 447 | log2len = xfs_highbit32(minlen); |
437 | /* | 448 | /* |
438 | * Loop over all bitmap blocks (bbno + i is current block). | 449 | * Loop over all bitmap blocks (bbno + i is current block). |
@@ -601,8 +612,6 @@ xfs_rtallocate_extent_size( | |||
601 | xfs_suminfo_t sum; /* summary information for extents */ | 612 | xfs_suminfo_t sum; /* summary information for extents */ |
602 | 613 | ||
603 | ASSERT(minlen % prod == 0 && maxlen % prod == 0); | 614 | ASSERT(minlen % prod == 0 && maxlen % prod == 0); |
604 | ASSERT(maxlen != 0); | ||
605 | |||
606 | /* | 615 | /* |
607 | * Loop over all the levels starting with maxlen. | 616 | * Loop over all the levels starting with maxlen. |
608 | * At each level, look at all the bitmap blocks, to see if there | 617 | * At each level, look at all the bitmap blocks, to see if there |
@@ -660,9 +669,6 @@ xfs_rtallocate_extent_size( | |||
660 | *rtblock = NULLRTBLOCK; | 669 | *rtblock = NULLRTBLOCK; |
661 | return 0; | 670 | return 0; |
662 | } | 671 | } |
663 | ASSERT(minlen != 0); | ||
664 | ASSERT(maxlen != 0); | ||
665 | |||
666 | /* | 672 | /* |
667 | * Loop over sizes, from maxlen down to minlen. | 673 | * Loop over sizes, from maxlen down to minlen. |
668 | * This time, when we do the allocations, allow smaller ones | 674 | * This time, when we do the allocations, allow smaller ones |
@@ -1948,7 +1954,6 @@ xfs_growfs_rt( | |||
1948 | nsbp->sb_blocksize * nsbp->sb_rextsize); | 1954 | nsbp->sb_blocksize * nsbp->sb_rextsize); |
1949 | nsbp->sb_rextents = nsbp->sb_rblocks; | 1955 | nsbp->sb_rextents = nsbp->sb_rblocks; |
1950 | do_div(nsbp->sb_rextents, nsbp->sb_rextsize); | 1956 | do_div(nsbp->sb_rextents, nsbp->sb_rextsize); |
1951 | ASSERT(nsbp->sb_rextents != 0); | ||
1952 | nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents); | 1957 | nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents); |
1953 | nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1; | 1958 | nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1; |
1954 | nrsumsize = | 1959 | nrsumsize = |
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 4d6330eddc8d..76d470d8a1e6 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c | |||
@@ -261,16 +261,19 @@ xfsaild_push( | |||
261 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); | 261 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); |
262 | } | 262 | } |
263 | 263 | ||
264 | /* | 264 | if (!count) { |
265 | * We reached the target so wait a bit longer for I/O to complete and | 265 | /* We're past our target or empty, so idle */ |
266 | * remove pushed items from the AIL before we start the next scan from | 266 | tout = 1000; |
267 | * the start of the AIL. | 267 | } else if (XFS_LSN_CMP(lsn, target) >= 0) { |
268 | */ | 268 | /* |
269 | if ((XFS_LSN_CMP(lsn, target) >= 0)) { | 269 | * We reached the target so wait a bit longer for I/O to |
270 | * complete and remove pushed items from the AIL before we | ||
271 | * start the next scan from the start of the AIL. | ||
272 | */ | ||
270 | tout += 20; | 273 | tout += 20; |
271 | last_pushed_lsn = 0; | 274 | last_pushed_lsn = 0; |
272 | } else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) || | 275 | } else if ((restarts > XFS_TRANS_PUSH_AIL_RESTARTS) || |
273 | (count && ((stuck * 100) / count > 90))) { | 276 | ((stuck * 100) / count > 90)) { |
274 | /* | 277 | /* |
275 | * Either there is a lot of contention on the AIL or we | 278 | * Either there is a lot of contention on the AIL or we |
276 | * are stuck due to operations in progress. "Stuck" in this | 279 | * are stuck due to operations in progress. "Stuck" in this |
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index 413587f02155..7321304a69cc 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -281,8 +281,8 @@ xfs_start_flags( | |||
281 | mp->m_readio_log = mp->m_writeio_log = ap->iosizelog; | 281 | mp->m_readio_log = mp->m_writeio_log = ap->iosizelog; |
282 | } | 282 | } |
283 | 283 | ||
284 | if (ap->flags & XFSMNT_IDELETE) | 284 | if (ap->flags & XFSMNT_IKEEP) |
285 | mp->m_flags |= XFS_MOUNT_IDELETE; | 285 | mp->m_flags |= XFS_MOUNT_IKEEP; |
286 | if (ap->flags & XFSMNT_DIRSYNC) | 286 | if (ap->flags & XFSMNT_DIRSYNC) |
287 | mp->m_flags |= XFS_MOUNT_DIRSYNC; | 287 | mp->m_flags |= XFS_MOUNT_DIRSYNC; |
288 | if (ap->flags & XFSMNT_ATTR2) | 288 | if (ap->flags & XFSMNT_ATTR2) |