Re: [PATCH 1/1] init: fix race between rootfs mount and firmware loading

From: Oleg Nesterov
Date: Mon Sep 15 2014 - 12:42:26 EST


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/