diff options
-rw-r--r-- | init/do_mounts.c | 3 | ||||
-rw-r--r-- | init/do_mounts.h | 9 | ||||
-rw-r--r-- | init/initramfs.c | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c index 279ad28bf4fb..3c5fd993bc7e 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -208,6 +208,9 @@ retry: goto out; case -EACCES: case -EINVAL: +#ifdef CONFIG_BLOCK + init_flush_fput(); +#endif continue; } /* diff --git a/init/do_mounts.h b/init/do_mounts.h index 15e372b00ce7..6069ea3eb80d 100644 --- a/init/do_mounts.h +++ b/init/do_mounts.h @@ -9,6 +9,8 @@ #include <linux/major.h> #include <linux/root_dev.h> #include <linux/init_syscalls.h> +#include <linux/task_work.h> +#include <linux/file.h> void mount_root_generic(char *name, char *pretty_name, int flags); void mount_root(char *root_device_name); @@ -41,3 +43,10 @@ static inline bool initrd_load(char *root_device_name) } #endif + +/* Ensure that async file closing finished to prevent spurious errors. */ +static inline void init_flush_fput(void) +{ + flush_delayed_fput(); + task_work_run(); +} diff --git a/init/initramfs.c b/init/initramfs.c index 76deb48c38cb..6554f28fa2da 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -16,9 +16,10 @@ #include <linux/mm.h> #include <linux/namei.h> #include <linux/init_syscalls.h> -#include <linux/task_work.h> #include <linux/umh.h> +#include "do_mounts.h" + static __initdata bool csum_present; static __initdata u32 io_csum; @@ -736,8 +737,7 @@ done: initrd_start = 0; initrd_end = 0; - flush_delayed_fput(); - task_work_run(); + init_flush_fput(); } static ASYNC_DOMAIN_EXCLUSIVE(initramfs_domain); |