Commit 0ff0e95e authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Greg Kroah-Hartman

devtmpfs: factor out setup part of devtmpfsd()

Factor out the setup part of devtmpfsd() to make it a bit easier to
see that we always call setup_done() exactly once (provided of course
the kthread is succesfully created).
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Link: https://lore.kernel.org/r/20200115184154.3492-3-linux@rasmusvillemoes.dkSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c9d6b287
...@@ -388,7 +388,7 @@ static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid, ...@@ -388,7 +388,7 @@ static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid,
return handle_remove(name, dev); return handle_remove(name, dev);
} }
static int devtmpfsd(void *p) static int devtmpfs_setup(void *p)
{ {
int err; int err;
...@@ -400,7 +400,18 @@ static int devtmpfsd(void *p) ...@@ -400,7 +400,18 @@ static int devtmpfsd(void *p)
goto out; goto out;
ksys_chdir("/.."); /* will traverse into overmounted root */ ksys_chdir("/.."); /* will traverse into overmounted root */
ksys_chroot("."); ksys_chroot(".");
out:
*(int *)p = err;
complete(&setup_done); complete(&setup_done);
return err;
}
static int devtmpfsd(void *p)
{
int err = devtmpfs_setup(p);
if (err)
return err;
while (1) { while (1) {
spin_lock(&req_lock); spin_lock(&req_lock);
while (requests) { while (requests) {
...@@ -421,10 +432,6 @@ static int devtmpfsd(void *p) ...@@ -421,10 +432,6 @@ static int devtmpfsd(void *p)
schedule(); schedule();
} }
return 0; return 0;
out:
*(int *)p = err;
complete(&setup_done);
return err;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment