diff options
author | Richard Guy Briggs <rgb@redhat.com> | 2013-01-24 19:15:11 +0100 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-04-08 22:19:17 +0200 |
commit | 3320c5133dd83df58b8fbc529b5419e02ca16fe6 (patch) | |
tree | caeea9a779ec727ff23ba4f4bf15559654ed4d10 /kernel/audit.c | |
parent | audit: refactor hold queue flush (diff) | |
download | linux-3320c5133dd83df58b8fbc529b5419e02ca16fe6.tar.xz linux-3320c5133dd83df58b8fbc529b5419e02ca16fe6.zip |
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/audit.c')
-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) static int kauditd_thread(void *dummy) { - struct sk_buff *skb; - set_freezable(); while (!kthread_should_stop()) { + struct sk_buff *skb; + DECLARE_WAITQUEUE(wait, current); + flush_hold_queue(); skb = skb_dequeue(&audit_skb_queue); @@ -471,19 +472,18 @@ static int kauditd_thread(void *dummy) kauditd_send_skb(skb); else audit_printk_skb(skb); - } else { - DECLARE_WAITQUEUE(wait, current); - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(&kauditd_wait, &wait); - - if (!skb_queue_len(&audit_skb_queue)) { - try_to_freeze(); - schedule(); - } + continue; + } + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&kauditd_wait, &wait); - __set_current_state(TASK_RUNNING); - remove_wait_queue(&kauditd_wait, &wait); + if (!skb_queue_len(&audit_skb_queue)) { + try_to_freeze(); + schedule(); } + + __set_current_state(TASK_RUNNING); + remove_wait_queue(&kauditd_wait, &wait); } return 0; } |