提交 3320c513 编写于 作者: R Richard Guy Briggs 提交者: Eric Paris

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: NRichard Guy Briggs <rbriggs@redhat.com>
Signed-off-by: NEric Paris <eparis@redhat.com>
上级 b551d1d9
...@@ -458,10 +458,11 @@ static void flush_hold_queue(void) ...@@ -458,10 +458,11 @@ static void flush_hold_queue(void)
static int kauditd_thread(void *dummy) static int kauditd_thread(void *dummy)
{ {
struct sk_buff *skb;
set_freezable(); set_freezable();
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
struct sk_buff *skb;
DECLARE_WAITQUEUE(wait, current);
flush_hold_queue(); flush_hold_queue();
skb = skb_dequeue(&audit_skb_queue); skb = skb_dequeue(&audit_skb_queue);
...@@ -471,19 +472,18 @@ static int kauditd_thread(void *dummy) ...@@ -471,19 +472,18 @@ static int kauditd_thread(void *dummy)
kauditd_send_skb(skb); kauditd_send_skb(skb);
else else
audit_printk_skb(skb); audit_printk_skb(skb);
} else { continue;
DECLARE_WAITQUEUE(wait, current); }
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&kauditd_wait, &wait); add_wait_queue(&kauditd_wait, &wait);
if (!skb_queue_len(&audit_skb_queue)) {
try_to_freeze();
schedule();
}
__set_current_state(TASK_RUNNING); if (!skb_queue_len(&audit_skb_queue)) {
remove_wait_queue(&kauditd_wait, &wait); try_to_freeze();
schedule();
} }
__set_current_state(TASK_RUNNING);
remove_wait_queue(&kauditd_wait, &wait);
} }
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册