Created
February 20, 2017 18:56
-
-
Save hnyman/884e04124bda05474a26c9e050f315aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/block.c | |
+++ b/block.c | |
@@ -782,6 +782,8 @@ static int exec_mount(const char *source | |
int err, status, pfds[2]; | |
char errmsg[128], cmd[sizeof("/sbin/mount.XXXXXXXXXXXXXXXX\0")]; | |
+ ULOG_ERR("exec_mount starts\n"); | |
+ | |
snprintf(cmd, sizeof(cmd), "/sbin/mount.%s", fstype); | |
if (stat(cmd, &s) < 0 || !S_ISREG(s.st_mode) || !(s.st_mode & S_IXUSR)) { | |
@@ -797,14 +799,18 @@ static int exec_mount(const char *source | |
pid = vfork(); | |
+ ULOG_ERR("exec_mount vfork\n"); | |
+ | |
switch (pid) { | |
case -1: | |
+ ULOG_ERR("exec_mount vfork -1\n"); | |
close(pfds[0]); | |
close(pfds[1]); | |
return -1; | |
case 0: | |
+ ULOG_ERR("exec_mount vfork 0 starts\n"); | |
to_devnull(STDIN_FILENO); | |
to_devnull(STDOUT_FILENO); | |
@@ -817,9 +823,11 @@ static int exec_mount(const char *source | |
else | |
execl(cmd, cmd, source, target, NULL); | |
+ ULOG_ERR("exec_mount vfork 0 ends\n"); | |
return -1; | |
default: | |
+ ULOG_ERR("exec_mount vfork default starts\n"); | |
close(pfds[1]); | |
mount_fd = fdopen(pfds[0], "r"); | |
@@ -829,7 +837,9 @@ static int exec_mount(const char *source | |
fclose(mount_fd); | |
+ ULOG_ERR("exec_mount vfork default waitpid starts\n"); | |
err = waitpid(pid, &status, 0); | |
+ ULOG_ERR("exec_mount vfork default waitpid ends\n"); | |
if (err != -1) { | |
if (status != 0) { | |
@@ -841,6 +851,7 @@ static int exec_mount(const char *source | |
err = 0; | |
} | |
} | |
+ ULOG_ERR("exec_mount vfork default ends\n"); | |
break; | |
} | |
@@ -855,6 +866,7 @@ static int handle_mount(const char *sour | |
size_t mount_opts_len; | |
char *mount_opts = NULL, *ptr; | |
+ ULOG_ERR("handle_mount starts\n"); | |
err = mount(source, target, fstype, m ? m->flags : 0, | |
(m && m->options) ? m->options : ""); | |
@@ -892,6 +904,7 @@ static int handle_mount(const char *sour | |
mount_opts[mount_opts_len - 1] = 0; | |
} | |
+ ULOG_ERR("handle_mount call exec_mount\n"); | |
/* ... and now finally invoke the external mount program */ | |
err = exec_mount(source, target, fstype, mount_opts); | |
} | |
@@ -909,6 +922,7 @@ static int mount_device(struct probe_inf | |
return -1; | |
device = basename(pr->dev); | |
+ ULOG_ERR("mount_device for %s\n", device); | |
if (!strcmp(pr->type, "swap")) { | |
if (hotplug && !auto_swap) | |
@@ -919,10 +933,10 @@ static int mount_device(struct probe_inf | |
return 0; | |
} | |
- | |
if (hotplug && !auto_mount) | |
return -1; | |
+ ULOG_ERR("mount_device for %s auto_mount test\n", device); | |
mp = find_mount_point(pr->dev); | |
if (mp) { | |
ULOG_ERR("%s is already mounted on %s\n", pr->dev, mp); | |
@@ -930,6 +944,7 @@ static int mount_device(struct probe_inf | |
return -1; | |
} | |
+ ULOG_ERR("mount_device for %s extroot test\n", device); | |
m = find_block(pr->uuid, pr->label, device, NULL); | |
if (m && m->extroot) | |
return -1; | |
@@ -944,10 +959,12 @@ static int mount_device(struct probe_inf | |
target = _target; | |
} | |
mkdir_p(target); | |
+ ULOG_ERR("mount_device for %s created mountpoint\n", device); | |
if (check_fs) | |
check_filesystem(pr); | |
+ ULOG_ERR("mount_device for %s call handle_mount\n", device); | |
err = handle_mount(pr->dev, target, pr->type, m); | |
if (err) | |
ULOG_ERR("mounting %s (%s) as %s failed (%d) - %s\n", | |
@@ -957,6 +974,7 @@ static int mount_device(struct probe_inf | |
return err; | |
} | |
+ ULOG_ERR("mount_device for %s check anon_mount\n", device); | |
if (anon_mount) { | |
char target[32]; | |
int err = 0; | |
@@ -967,6 +985,7 @@ static int mount_device(struct probe_inf | |
if (check_fs) | |
check_filesystem(pr); | |
+ ULOG_ERR("mount_device for %s try anon_mount\n", device); | |
err = handle_mount(pr->dev, target, pr->type, NULL); | |
if (err) | |
ULOG_ERR("mounting %s (%s) as %s failed (%d) - %s\n", | |
@@ -976,6 +995,7 @@ static int mount_device(struct probe_inf | |
return err; | |
} | |
+ ULOG_ERR("mount_device for %s return from mount\n", device); | |
return 0; | |
} | |
@@ -1419,13 +1439,16 @@ static int main_mount(int argc, char **a | |
{ | |
struct probe_info *pr; | |
+ ULOG_ERR("config_load starts\n"); | |
if (config_load(NULL)) | |
return -1; | |
- | |
+ ULOG_ERR("cache_load starts\n"); | |
cache_load(1); | |
+ ULOG_ERR("list_for_each_entry starts\n"); | |
list_for_each_entry(pr, &devices, list) | |
mount_device(pr, 0); | |
+ ULOG_ERR("handle_swapfiles starts\n"); | |
handle_swapfiles(true); | |
return 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment