Skip to content

Commit

Permalink
audit: flatten kauditd_thread wait queue code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Richard Guy Briggs authored and Eric Paris committed Apr 8, 2013
1 parent b551d1d commit 3320c51
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit 3320c51

Please sign in to comment.