Messages in this thread | | | Date | Mon, 15 Sep 2014 18:39:35 +0200 | From | Oleg Nesterov <> | 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.
| |