[MOUNT_REMOUNTING_SIGKILL] = UNIT_ACTIVE_RELOADING,
[MOUNT_UNMOUNTING_SIGTERM] = UNIT_DEACTIVATING,
[MOUNT_UNMOUNTING_SIGKILL] = UNIT_DEACTIVATING,
- [MOUNT_MAINTAINANCE] = UNIT_INACTIVE,
+ [MOUNT_MAINTENANCE] = UNIT_INACTIVE,
};
static void mount_init(Unit *u) {
state == MOUNT_REMOUNTING_SIGKILL ||
state == MOUNT_UNMOUNTING_SIGTERM ||
state == MOUNT_UNMOUNTING_SIGKILL ||
- state == MOUNT_MAINTAINANCE)
+ state == MOUNT_MAINTENANCE)
mount_notify_automount(m, -ENODEV);
if (state != old_state)
if (!success)
m->failure = true;
- mount_set_state(m, m->failure ? MOUNT_MAINTAINANCE : MOUNT_DEAD);
+ mount_set_state(m, m->failure ? MOUNT_MAINTENANCE : MOUNT_DEAD);
}
static void mount_enter_mounted(Mount *m, bool success) {
m->state == MOUNT_MOUNTING_SIGKILL)
return 0;
- assert(m->state == MOUNT_DEAD || m->state == MOUNT_MAINTAINANCE);
+ assert(m->state == MOUNT_DEAD || m->state == MOUNT_MAINTENANCE);
m->failure = false;
mount_enter_mounting(m);
unit_serialize_item(u, f, "failure", yes_no(m->failure));
if (m->control_pid > 0)
- unit_serialize_item_format(u, f, "control-pid", "%u", (unsigned) m->control_pid);
+ unit_serialize_item_format(u, f, "control-pid", "%lu", (unsigned long) m->control_pid);
if (m->control_command_id >= 0)
unit_serialize_item(u, f, "control-command", mount_exec_command_to_string(m->control_command_id));
m->failure = b || m->failure;
} else if (streq(key, "control-pid")) {
- unsigned pid;
+ pid_t pid;
- if ((r = safe_atou(value, &pid)) < 0 || pid <= 0)
+ if ((r = parse_pid(value, &pid)) < 0)
log_debug("Failed to parse control-pid value %s", value);
else
- m->control_pid = (pid_t) pid;
+ m->control_pid = pid;
} else if (streq(key, "control-command")) {
MountExecCommand id;
assert(m);
assert(pid >= 0);
- success = is_clean_exit(code, status);
- m->failure = m->failure || !success;
+ if (pid != m->control_pid)
+ return;
- assert(m->control_pid == pid);
m->control_pid = 0;
+ success = is_clean_exit(code, status);
+ m->failure = m->failure || !success;
+
if (m->control_command) {
exec_status_fill(&m->control_command->exec_status, pid, code, status);
m->control_command = NULL;
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
int r;
- char *device, *path, *options, *fstype, *d, *p;
+ char *device, *path, *options, *options2, *fstype, *d, *p, *o;
assert(m);
for (;;) {
int k;
- device = path = options = fstype = d = p = NULL;
+ device = path = options = options2 = fstype = d = p = o = NULL;
if ((k = fscanf(m->proc_self_mountinfo,
"%*s " /* (1) mount id */
"- " /* (8) seperator */
"%ms " /* (9) file system type */
"%ms" /* (10) mount source */
+ "%ms" /* (11) mount options 2 */
"%*[^\n]", /* some rubbish at the end */
&path,
&options,
&fstype,
- &device)) != 4) {
+ &device,
+ &options2)) != 5) {
if (k == EOF)
break;
goto finish;
}
+ if (asprintf(&o, "%s,%s", options, options2) < 0) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
if (!(d = cunescape(device)) ||
!(p = cunescape(path))) {
r = -ENOMEM;
goto finish;
}
- if ((r = mount_add_one(m, d, p, options, fstype, true, set_flags)) < 0)
+ if ((r = mount_add_one(m, d, p, o, fstype, true, set_flags)) < 0)
goto finish;
free(device);
free(path);
free(options);
+ free(options2);
free(fstype);
free(d);
free(p);
+ free(o);
}
r = 0;
free(device);
free(path);
free(options);
+ free(options2);
free(fstype);
free(d);
free(p);
+ free(o);
return r;
}
switch (mount->state) {
case MOUNT_DEAD:
- case MOUNT_MAINTAINANCE:
+ case MOUNT_MAINTENANCE:
mount_enter_mounted(mount, true);
break;
[MOUNT_REMOUNTING_SIGKILL] = "remounting-sigkill",
[MOUNT_UNMOUNTING_SIGTERM] = "unmounting-sigterm",
[MOUNT_UNMOUNTING_SIGKILL] = "unmounting-sigkill",
- [MOUNT_MAINTAINANCE] = "maintainance"
+ [MOUNT_MAINTENANCE] = "maintenance"
};
DEFINE_STRING_TABLE_LOOKUP(mount_state, MountState);