LIST_FOREACH_SAFE(mount_point, m, n, *head) {
log_info("Deactivating swap %s.", m->path);
- if (swapoff(m->path) == 0) {
- *changed = true;
- mount_point_free(head, m);
- } else {
+ if (swapoff(m->path) < 0) {
log_warning_errno(errno, "Could not deactivate swap %s: %m", m->path);
n_failed++;
+ continue;
}
+
+ *changed = true;
+ mount_point_free(head, m);
}
return n_failed;
log_info("Detaching loopback %s.", m->path);
r = delete_loopback(m->path);
- if (r >= 0) {
- if (r > 0)
- *changed = true;
-
- mount_point_free(head, m);
- } else {
- log_full_errno(umount_log_level, errno, "Could not detach loopback %s: %m", m->path);
+ if (r < 0) {
+ log_full_errno(umount_log_level, r, "Could not detach loopback %s: %m", m->path);
n_failed++;
+ continue;
}
+ if (r > 0)
+ *changed = true;
+
+ mount_point_free(head, m);
}
return n_failed;
continue;
}
- log_info("Detaching DM %u:%u.", major(m->devnum), minor(m->devnum));
+ log_info("Detaching DM %s (%u:%u).", m->path, major(m->devnum), minor(m->devnum));
r = delete_dm(m->devnum);
- if (r >= 0) {
- *changed = true;
- mount_point_free(head, m);
- } else {
- log_full_errno(umount_log_level, errno, "Could not detach DM %s: %m", m->path);
+ if (r < 0) {
+ log_full_errno(umount_log_level, r, "Could not detach DM %s: %m", m->path);
n_failed++;
+ continue;
}
+
+ *changed = true;
+ mount_point_free(head, m);
}
return n_failed;
}
static int umount_all_once(bool *changed, int umount_log_level) {
- int r;
_cleanup_(mount_points_list_free) LIST_HEAD(MountPoint, mp_list_head);
+ int r;
assert(changed);