[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140915163935.GB22768@redhat.com>
Date: Mon, 15 Sep 2014 18:39:35 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Roman Pen <r.peniaev@...il.com>
Cc: Ming Lei <ming.lei@...onical.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists