[systemd-devel] Failure to remount / ro (Was: Re: [PATCH 2/4] Adding unmount functions to be used in shutdown)
Michael Biebl
mbiebl at gmail.com
Sun Oct 24 07:41:46 PDT 2010
Together with fidencio I tracked down the bug which caused / *not* to
be remounted ro on shutdown.
The relevant code is in src/umount.c
2010/10/7 <fidencio at profusion.mobi>:
> +int umount_all(void) {
> + int r;
> + LIST_HEAD(MountPoint, mp_list_head);
> +
> + LIST_HEAD_INIT(MountPoint, mp_list_head);
> +
> + r = mount_points_list_get(&mp_list_head);
> + if (r < 0)
> + goto end;
> +
> + r = mount_points_list_umount(&mp_list_head);
> + if (r <= 0)
> + goto end;
r is the number of mount points which failed to be unmounted.
We always skip / in mount_points_list_umount though,
I.e. if there is no failed unmount attempt, we will never try to remount / ro.
Maybe we should just call mount_points_list_remount_read_only unconditionally.
or increment the failed counter in mount_points_list_umount if we skip "/"
+static int mount_points_list_umount(MountPoint **mount_point_list_head) {
+ MountPoint *mp, *mp_next;
+ int failed = 0;
+
+ LIST_FOREACH_SAFE(mount_point, mp, mp_next, *mount_point_list_head) {
+ if (streq(mp->path, "/"))
+ continue;
^ add failed++ to make sure / is remounted-ro?
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
More information about the systemd-devel
mailing list