lkml.org 
[lkml]   [2013]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -mm 1/1] audit: cleanup audit_log_start/wait_for_auditd mess
On Mon, 3 Jun 2013 22:46:20 +0200 Oleg Nesterov <oleg@redhat.com> wrote:

> audit_log_start() tries to obfusticate the code/logic and
> reimplements wait_event_timeout() in a very confusing way.
>
> Just change wait_for_auditd() to use wait_event_timeout()
> and return bool.
>
> Also remove the unnecessary "ab = NULL" initialization.

I would prefer that this be nicely tested - for a cosmetic thing I
don't think it's worth the risk as-is.

> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1051,20 +1051,19 @@ static inline void audit_get_stamp(struct audit_context *ctx,
> }
>
> /*
> - * Wait for auditd to drain the queue a little
> + * Wait for auditd to drain audit_skb_queue if it is full
> */
> -static void wait_for_auditd(unsigned long sleep_time)
> +static bool wait_for_auditd(gfp_t gfp_mask)
> {
> - DECLARE_WAITQUEUE(wait, current);
> - set_current_state(TASK_UNINTERRUPTIBLE);
> - add_wait_queue(&audit_backlog_wait, &wait);
> -
> - if (audit_backlog_limit &&
> - skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
> - schedule_timeout(sleep_time);
> -
> - __set_current_state(TASK_RUNNING);
> - remove_wait_queue(&audit_backlog_wait, &wait);
> + /* Atomic callers use can 5 more entries over the limit */

"can use"

> + if (!(gfp_mask & __GFP_WAIT))
> + return skb_queue_len(&audit_skb_queue) <=
> + audit_backlog_limit + 5;
> +
> + return wait_event_timeout(audit_backlog_wait,
> + !audit_backlog_limit ||
> + skb_queue_len(&audit_skb_queue) <= audit_backlog_limit,
> + audit_backlog_wait_time);
> }
>
> ...
>


\
 
 \ /
  Last update: 2013-06-07 00:21    [W:0.068 / U:4.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site