lkml.org 
[lkml]   [2014]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] init: fix race between rootfs mount and firmware loading
On 09/15, Roman Pen wrote:
>
> +static DECLARE_COMPLETION(rootfs_mounted);
> +
> +void wait_for_rootfs(void)
> +{
> + /* Avoid waiting for ourselves */
> + if (is_global_init(current))
> + pr_warn("it is not a good idea to wait for rootfs mount from init task\n");
> + else
> + wait_for_completion(&rootfs_mounted);
> +}
> +
> +static inline void wake_up_rootfs_waiters(void)
> +{
> + complete(&rootfs_mounted);
> +}

Probably you need complete_all() ?

Otherwise wait_for_rootfs() can return only once, the next call will block
forever. And perhaps it would be better to use another primitive, even if
UINT_MAX/2 should be enough.

Oleg.



\
 
 \ /
  Last update: 2014-09-15 19:21    [W:0.127 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site