diff options
| author | Richard Guy Briggs <rgb@redhat.com> | 2013-01-24 13:15:11 -0500 |
|---|---|---|
| committer | Eric Paris <eparis@redhat.com> | 2013-04-08 16:19:17 -0400 |
| commit | 3320c5133dd83df58b8fbc529b5419e02ca16fe6 (patch) | |
| tree | caeea9a779ec727ff23ba4f4bf15559654ed4d10 /kernel | |
| parent | b551d1d98197b7dd58fc3ead8d4d01830c09567d (diff) | |
audit: flatten kauditd_thread wait queue code
The wait queue control code in kauditd_thread() was nested deeper than
necessary. The function has been flattened for better legibility.
Signed-off-by: Richard Guy Briggs <rbriggs@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/audit.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 4bf486c3e9e8..1531efbd11e2 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
| @@ -458,10 +458,11 @@ static void flush_hold_queue(void) | |||
| 458 | 458 | ||
| 459 | static int kauditd_thread(void *dummy) | 459 | static int kauditd_thread(void *dummy) |
| 460 | { | 460 | { |
| 461 | struct sk_buff *skb; | ||
| 462 | |||
| 463 | set_freezable(); | 461 | set_freezable(); |
| 464 | while (!kthread_should_stop()) { | 462 | while (!kthread_should_stop()) { |
| 463 | struct sk_buff *skb; | ||
| 464 | DECLARE_WAITQUEUE(wait, current); | ||
| 465 | |||
| 465 | flush_hold_queue(); | 466 | flush_hold_queue(); |
| 466 | 467 | ||
| 467 | skb = skb_dequeue(&audit_skb_queue); | 468 | skb = skb_dequeue(&audit_skb_queue); |
| @@ -471,19 +472,18 @@ static int kauditd_thread(void *dummy) | |||
| 471 | kauditd_send_skb(skb); | 472 | kauditd_send_skb(skb); |
| 472 | else | 473 | else |
| 473 | audit_printk_skb(skb); | 474 | audit_printk_skb(skb); |
| 474 | } else { | 475 | continue; |
| 475 | DECLARE_WAITQUEUE(wait, current); | 476 | } |
| 476 | set_current_state(TASK_INTERRUPTIBLE); | 477 | set_current_state(TASK_INTERRUPTIBLE); |
| 477 | add_wait_queue(&kauditd_wait, &wait); | 478 | add_wait_queue(&kauditd_wait, &wait); |
| 478 | |||
| 479 | if (!skb_queue_len(&audit_skb_queue)) { | ||
| 480 | try_to_freeze(); | ||
| 481 | schedule(); | ||
| 482 | } | ||
| 483 | 479 | ||
| 484 | __set_current_state(TASK_RUNNING); | 480 | if (!skb_queue_len(&audit_skb_queue)) { |
| 485 | remove_wait_queue(&kauditd_wait, &wait); | 481 | try_to_freeze(); |
| 482 | schedule(); | ||
| 486 | } | 483 | } |
| 484 | |||
| 485 | __set_current_state(TASK_RUNNING); | ||
| 486 | remove_wait_queue(&kauditd_wait, &wait); | ||
| 487 | } | 487 | } |
| 488 | return 0; | 488 | return 0; |
| 489 | } | 489 | } |
