diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 21 | ||||
-rw-r--r-- | kernel/cpuset.c | 19 | ||||
-rw-r--r-- | kernel/kallsyms.c | 17 | ||||
-rw-r--r-- | kernel/sys_ni.c | 2 | ||||
-rw-r--r-- | kernel/trace/ftrace.c | 113 | ||||
-rw-r--r-- | kernel/trace/ring_buffer.c | 1 | ||||
-rw-r--r-- | kernel/trace/trace.c | 1 |
7 files changed, 99 insertions, 75 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 358e77564e6f..fe00b3b983a8 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2039,10 +2039,13 @@ int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry) | |||
2039 | struct cgroup *cgrp; | 2039 | struct cgroup *cgrp; |
2040 | struct cgroup_iter it; | 2040 | struct cgroup_iter it; |
2041 | struct task_struct *tsk; | 2041 | struct task_struct *tsk; |
2042 | |||
2042 | /* | 2043 | /* |
2043 | * Validate dentry by checking the superblock operations | 2044 | * Validate dentry by checking the superblock operations, |
2045 | * and make sure it's a directory. | ||
2044 | */ | 2046 | */ |
2045 | if (dentry->d_sb->s_op != &cgroup_ops) | 2047 | if (dentry->d_sb->s_op != &cgroup_ops || |
2048 | !S_ISDIR(dentry->d_inode->i_mode)) | ||
2046 | goto err; | 2049 | goto err; |
2047 | 2050 | ||
2048 | ret = 0; | 2051 | ret = 0; |
@@ -2472,10 +2475,7 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry) | |||
2472 | mutex_unlock(&cgroup_mutex); | 2475 | mutex_unlock(&cgroup_mutex); |
2473 | return -EBUSY; | 2476 | return -EBUSY; |
2474 | } | 2477 | } |
2475 | 2478 | mutex_unlock(&cgroup_mutex); | |
2476 | parent = cgrp->parent; | ||
2477 | root = cgrp->root; | ||
2478 | sb = root->sb; | ||
2479 | 2479 | ||
2480 | /* | 2480 | /* |
2481 | * Call pre_destroy handlers of subsys. Notify subsystems | 2481 | * Call pre_destroy handlers of subsys. Notify subsystems |
@@ -2483,7 +2483,14 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry) | |||
2483 | */ | 2483 | */ |
2484 | cgroup_call_pre_destroy(cgrp); | 2484 | cgroup_call_pre_destroy(cgrp); |
2485 | 2485 | ||
2486 | if (cgroup_has_css_refs(cgrp)) { | 2486 | mutex_lock(&cgroup_mutex); |
2487 | parent = cgrp->parent; | ||
2488 | root = cgrp->root; | ||
2489 | sb = root->sb; | ||
2490 | |||
2491 | if (atomic_read(&cgrp->count) | ||
2492 | || !list_empty(&cgrp->children) | ||
2493 | || cgroup_has_css_refs(cgrp)) { | ||
2487 | mutex_unlock(&cgroup_mutex); | 2494 | mutex_unlock(&cgroup_mutex); |
2488 | return -EBUSY; | 2495 | return -EBUSY; |
2489 | } | 2496 | } |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 81fc6791a296..da7ff6137f37 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/list.h> | 36 | #include <linux/list.h> |
37 | #include <linux/mempolicy.h> | 37 | #include <linux/mempolicy.h> |
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/memory.h> | ||
39 | #include <linux/module.h> | 40 | #include <linux/module.h> |
40 | #include <linux/mount.h> | 41 | #include <linux/mount.h> |
41 | #include <linux/namei.h> | 42 | #include <linux/namei.h> |
@@ -2015,12 +2016,23 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb, | |||
2015 | * Call this routine anytime after node_states[N_HIGH_MEMORY] changes. | 2016 | * Call this routine anytime after node_states[N_HIGH_MEMORY] changes. |
2016 | * See also the previous routine cpuset_track_online_cpus(). | 2017 | * See also the previous routine cpuset_track_online_cpus(). |
2017 | */ | 2018 | */ |
2018 | void cpuset_track_online_nodes(void) | 2019 | static int cpuset_track_online_nodes(struct notifier_block *self, |
2020 | unsigned long action, void *arg) | ||
2019 | { | 2021 | { |
2020 | cgroup_lock(); | 2022 | cgroup_lock(); |
2021 | top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; | 2023 | switch (action) { |
2022 | scan_for_empty_cpusets(&top_cpuset); | 2024 | case MEM_ONLINE: |
2025 | top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; | ||
2026 | break; | ||
2027 | case MEM_OFFLINE: | ||
2028 | top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; | ||
2029 | scan_for_empty_cpusets(&top_cpuset); | ||
2030 | break; | ||
2031 | default: | ||
2032 | break; | ||
2033 | } | ||
2023 | cgroup_unlock(); | 2034 | cgroup_unlock(); |
2035 | return NOTIFY_OK; | ||
2024 | } | 2036 | } |
2025 | #endif | 2037 | #endif |
2026 | 2038 | ||
@@ -2036,6 +2048,7 @@ void __init cpuset_init_smp(void) | |||
2036 | top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; | 2048 | top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; |
2037 | 2049 | ||
2038 | hotcpu_notifier(cpuset_track_online_cpus, 0); | 2050 | hotcpu_notifier(cpuset_track_online_cpus, 0); |
2051 | hotplug_memory_notifier(cpuset_track_online_nodes, 10); | ||
2039 | } | 2052 | } |
2040 | 2053 | ||
2041 | /** | 2054 | /** |
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 5072cf1685a2..7b8b0f21a5b1 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
@@ -304,17 +304,24 @@ int sprint_symbol(char *buffer, unsigned long address) | |||
304 | char *modname; | 304 | char *modname; |
305 | const char *name; | 305 | const char *name; |
306 | unsigned long offset, size; | 306 | unsigned long offset, size; |
307 | char namebuf[KSYM_NAME_LEN]; | 307 | int len; |
308 | 308 | ||
309 | name = kallsyms_lookup(address, &size, &offset, &modname, namebuf); | 309 | name = kallsyms_lookup(address, &size, &offset, &modname, buffer); |
310 | if (!name) | 310 | if (!name) |
311 | return sprintf(buffer, "0x%lx", address); | 311 | return sprintf(buffer, "0x%lx", address); |
312 | 312 | ||
313 | if (name != buffer) | ||
314 | strcpy(buffer, name); | ||
315 | len = strlen(buffer); | ||
316 | buffer += len; | ||
317 | |||
313 | if (modname) | 318 | if (modname) |
314 | return sprintf(buffer, "%s+%#lx/%#lx [%s]", name, offset, | 319 | len += sprintf(buffer, "+%#lx/%#lx [%s]", |
315 | size, modname); | 320 | offset, size, modname); |
316 | else | 321 | else |
317 | return sprintf(buffer, "%s+%#lx/%#lx", name, offset, size); | 322 | len += sprintf(buffer, "+%#lx/%#lx", offset, size); |
323 | |||
324 | return len; | ||
318 | } | 325 | } |
319 | 326 | ||
320 | /* Look up a kernel symbol and print it to the kernel messages. */ | 327 | /* Look up a kernel symbol and print it to the kernel messages. */ |
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index a77b27b11b04..e14a23281707 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c | |||
@@ -31,7 +31,7 @@ cond_syscall(sys_socketpair); | |||
31 | cond_syscall(sys_bind); | 31 | cond_syscall(sys_bind); |
32 | cond_syscall(sys_listen); | 32 | cond_syscall(sys_listen); |
33 | cond_syscall(sys_accept); | 33 | cond_syscall(sys_accept); |
34 | cond_syscall(sys_paccept); | 34 | cond_syscall(sys_accept4); |
35 | cond_syscall(sys_connect); | 35 | cond_syscall(sys_connect); |
36 | cond_syscall(sys_getsockname); | 36 | cond_syscall(sys_getsockname); |
37 | cond_syscall(sys_getpeername); | 37 | cond_syscall(sys_getpeername); |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index e60205722d0c..78db083390f0 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -326,96 +326,89 @@ ftrace_record_ip(unsigned long ip) | |||
326 | 326 | ||
327 | static int | 327 | static int |
328 | __ftrace_replace_code(struct dyn_ftrace *rec, | 328 | __ftrace_replace_code(struct dyn_ftrace *rec, |
329 | unsigned char *old, unsigned char *new, int enable) | 329 | unsigned char *nop, int enable) |
330 | { | 330 | { |
331 | unsigned long ip, fl; | 331 | unsigned long ip, fl; |
332 | unsigned char *call, *old, *new; | ||
332 | 333 | ||
333 | ip = rec->ip; | 334 | ip = rec->ip; |
334 | 335 | ||
335 | if (ftrace_filtered && enable) { | 336 | /* |
337 | * If this record is not to be traced and | ||
338 | * it is not enabled then do nothing. | ||
339 | * | ||
340 | * If this record is not to be traced and | ||
341 | * it is enabled then disabled it. | ||
342 | * | ||
343 | */ | ||
344 | if (rec->flags & FTRACE_FL_NOTRACE) { | ||
345 | if (rec->flags & FTRACE_FL_ENABLED) | ||
346 | rec->flags &= ~FTRACE_FL_ENABLED; | ||
347 | else | ||
348 | return 0; | ||
349 | |||
350 | } else if (ftrace_filtered && enable) { | ||
336 | /* | 351 | /* |
337 | * If filtering is on: | 352 | * Filtering is on: |
338 | * | ||
339 | * If this record is set to be filtered and | ||
340 | * is enabled then do nothing. | ||
341 | * | ||
342 | * If this record is set to be filtered and | ||
343 | * it is not enabled, enable it. | ||
344 | * | ||
345 | * If this record is not set to be filtered | ||
346 | * and it is not enabled do nothing. | ||
347 | * | ||
348 | * If this record is set not to trace then | ||
349 | * do nothing. | ||
350 | * | ||
351 | * If this record is set not to trace and | ||
352 | * it is enabled then disable it. | ||
353 | * | ||
354 | * If this record is not set to be filtered and | ||
355 | * it is enabled, disable it. | ||
356 | */ | 353 | */ |
357 | 354 | ||
358 | fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE | | 355 | fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_ENABLED); |
359 | FTRACE_FL_ENABLED); | ||
360 | 356 | ||
361 | if ((fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED)) || | 357 | /* Record is filtered and enabled, do nothing */ |
362 | (fl == (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE)) || | 358 | if (fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED)) |
363 | !fl || (fl == FTRACE_FL_NOTRACE)) | ||
364 | return 0; | 359 | return 0; |
365 | 360 | ||
366 | /* | 361 | /* Record is not filtered and is not enabled do nothing */ |
367 | * If it is enabled disable it, | 362 | if (!fl) |
368 | * otherwise enable it! | 363 | return 0; |
369 | */ | 364 | |
370 | if (fl & FTRACE_FL_ENABLED) { | 365 | /* Record is not filtered but enabled, disable it */ |
371 | /* swap new and old */ | 366 | if (fl == FTRACE_FL_ENABLED) |
372 | new = old; | ||
373 | old = ftrace_call_replace(ip, FTRACE_ADDR); | ||
374 | rec->flags &= ~FTRACE_FL_ENABLED; | 367 | rec->flags &= ~FTRACE_FL_ENABLED; |
375 | } else { | 368 | else |
376 | new = ftrace_call_replace(ip, FTRACE_ADDR); | 369 | /* Otherwise record is filtered but not enabled, enable it */ |
377 | rec->flags |= FTRACE_FL_ENABLED; | 370 | rec->flags |= FTRACE_FL_ENABLED; |
378 | } | ||
379 | } else { | 371 | } else { |
372 | /* Disable or not filtered */ | ||
380 | 373 | ||
381 | if (enable) { | 374 | if (enable) { |
382 | /* | 375 | /* if record is enabled, do nothing */ |
383 | * If this record is set not to trace and is | ||
384 | * not enabled, do nothing. | ||
385 | */ | ||
386 | fl = rec->flags & (FTRACE_FL_NOTRACE | FTRACE_FL_ENABLED); | ||
387 | if (fl == FTRACE_FL_NOTRACE) | ||
388 | return 0; | ||
389 | |||
390 | new = ftrace_call_replace(ip, FTRACE_ADDR); | ||
391 | } else | ||
392 | old = ftrace_call_replace(ip, FTRACE_ADDR); | ||
393 | |||
394 | if (enable) { | ||
395 | if (rec->flags & FTRACE_FL_ENABLED) | 376 | if (rec->flags & FTRACE_FL_ENABLED) |
396 | return 0; | 377 | return 0; |
378 | |||
397 | rec->flags |= FTRACE_FL_ENABLED; | 379 | rec->flags |= FTRACE_FL_ENABLED; |
380 | |||
398 | } else { | 381 | } else { |
382 | |||
383 | /* if record is not enabled do nothing */ | ||
399 | if (!(rec->flags & FTRACE_FL_ENABLED)) | 384 | if (!(rec->flags & FTRACE_FL_ENABLED)) |
400 | return 0; | 385 | return 0; |
386 | |||
401 | rec->flags &= ~FTRACE_FL_ENABLED; | 387 | rec->flags &= ~FTRACE_FL_ENABLED; |
402 | } | 388 | } |
403 | } | 389 | } |
404 | 390 | ||
391 | call = ftrace_call_replace(ip, FTRACE_ADDR); | ||
392 | |||
393 | if (rec->flags & FTRACE_FL_ENABLED) { | ||
394 | old = nop; | ||
395 | new = call; | ||
396 | } else { | ||
397 | old = call; | ||
398 | new = nop; | ||
399 | } | ||
400 | |||
405 | return ftrace_modify_code(ip, old, new); | 401 | return ftrace_modify_code(ip, old, new); |
406 | } | 402 | } |
407 | 403 | ||
408 | static void ftrace_replace_code(int enable) | 404 | static void ftrace_replace_code(int enable) |
409 | { | 405 | { |
410 | int i, failed; | 406 | int i, failed; |
411 | unsigned char *new = NULL, *old = NULL; | 407 | unsigned char *nop = NULL; |
412 | struct dyn_ftrace *rec; | 408 | struct dyn_ftrace *rec; |
413 | struct ftrace_page *pg; | 409 | struct ftrace_page *pg; |
414 | 410 | ||
415 | if (enable) | 411 | nop = ftrace_nop_replace(); |
416 | old = ftrace_nop_replace(); | ||
417 | else | ||
418 | new = ftrace_nop_replace(); | ||
419 | 412 | ||
420 | for (pg = ftrace_pages_start; pg; pg = pg->next) { | 413 | for (pg = ftrace_pages_start; pg; pg = pg->next) { |
421 | for (i = 0; i < pg->index; i++) { | 414 | for (i = 0; i < pg->index; i++) { |
@@ -433,7 +426,7 @@ static void ftrace_replace_code(int enable) | |||
433 | unfreeze_record(rec); | 426 | unfreeze_record(rec); |
434 | } | 427 | } |
435 | 428 | ||
436 | failed = __ftrace_replace_code(rec, old, new, enable); | 429 | failed = __ftrace_replace_code(rec, nop, enable); |
437 | if (failed && (rec->flags & FTRACE_FL_CONVERTED)) { | 430 | if (failed && (rec->flags & FTRACE_FL_CONVERTED)) { |
438 | rec->flags |= FTRACE_FL_FAILED; | 431 | rec->flags |= FTRACE_FL_FAILED; |
439 | if ((system_state == SYSTEM_BOOTING) || | 432 | if ((system_state == SYSTEM_BOOTING) || |
@@ -534,8 +527,7 @@ static void ftrace_startup(void) | |||
534 | 527 | ||
535 | mutex_lock(&ftrace_start_lock); | 528 | mutex_lock(&ftrace_start_lock); |
536 | ftrace_start++; | 529 | ftrace_start++; |
537 | if (ftrace_start == 1) | 530 | command |= FTRACE_ENABLE_CALLS; |
538 | command |= FTRACE_ENABLE_CALLS; | ||
539 | 531 | ||
540 | if (saved_ftrace_func != ftrace_trace_function) { | 532 | if (saved_ftrace_func != ftrace_trace_function) { |
541 | saved_ftrace_func = ftrace_trace_function; | 533 | saved_ftrace_func = ftrace_trace_function; |
@@ -734,6 +726,9 @@ t_next(struct seq_file *m, void *v, loff_t *pos) | |||
734 | ((iter->flags & FTRACE_ITER_FAILURES) && | 726 | ((iter->flags & FTRACE_ITER_FAILURES) && |
735 | !(rec->flags & FTRACE_FL_FAILED)) || | 727 | !(rec->flags & FTRACE_FL_FAILED)) || |
736 | 728 | ||
729 | ((iter->flags & FTRACE_ITER_FILTER) && | ||
730 | !(rec->flags & FTRACE_FL_FILTER)) || | ||
731 | |||
737 | ((iter->flags & FTRACE_ITER_NOTRACE) && | 732 | ((iter->flags & FTRACE_ITER_NOTRACE) && |
738 | !(rec->flags & FTRACE_FL_NOTRACE))) { | 733 | !(rec->flags & FTRACE_FL_NOTRACE))) { |
739 | rec = NULL; | 734 | rec = NULL; |
@@ -1186,7 +1181,7 @@ ftrace_regex_release(struct inode *inode, struct file *file, int enable) | |||
1186 | 1181 | ||
1187 | mutex_lock(&ftrace_sysctl_lock); | 1182 | mutex_lock(&ftrace_sysctl_lock); |
1188 | mutex_lock(&ftrace_start_lock); | 1183 | mutex_lock(&ftrace_start_lock); |
1189 | if (iter->filtered && ftrace_start && ftrace_enabled) | 1184 | if (ftrace_start && ftrace_enabled) |
1190 | ftrace_run_update_code(FTRACE_ENABLE_CALLS); | 1185 | ftrace_run_update_code(FTRACE_ENABLE_CALLS); |
1191 | mutex_unlock(&ftrace_start_lock); | 1186 | mutex_unlock(&ftrace_start_lock); |
1192 | mutex_unlock(&ftrace_sysctl_lock); | 1187 | mutex_unlock(&ftrace_sysctl_lock); |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 036456cbb4f7..f780e9552f91 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -617,6 +617,7 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size) | |||
617 | list_del_init(&page->list); | 617 | list_del_init(&page->list); |
618 | free_buffer_page(page); | 618 | free_buffer_page(page); |
619 | } | 619 | } |
620 | mutex_unlock(&buffer->mutex); | ||
620 | return -ENOMEM; | 621 | return -ENOMEM; |
621 | } | 622 | } |
622 | 623 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 697eda36b86a..d86e3252f300 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1936,6 +1936,7 @@ __tracing_open(struct inode *inode, struct file *file, int *ret) | |||
1936 | ring_buffer_read_finish(iter->buffer_iter[cpu]); | 1936 | ring_buffer_read_finish(iter->buffer_iter[cpu]); |
1937 | } | 1937 | } |
1938 | mutex_unlock(&trace_types_lock); | 1938 | mutex_unlock(&trace_types_lock); |
1939 | kfree(iter); | ||
1939 | 1940 | ||
1940 | return ERR_PTR(-ENOMEM); | 1941 | return ERR_PTR(-ENOMEM); |
1941 | } | 1942 | } |