[systemd-devel] [PATCH 1/2] Adding unmount functions to be used in shutdown

Gustavo Sverzut Barbieri barbieri at profusion.mobi
Tue Oct 5 22:13:38 PDT 2010


On Wed, Oct 6, 2010 at 2:05 AM, Gustavo Sverzut Barbieri
<barbieri at profusion.mobi> wrote:
> From: Fabiano Fidencio <fidencio at profusion.mobi>
>
> This functions will:
>    - umount all mount points that aren't API
>    - remount read-only all mount points that can't be umounted
>    - umount all swap devices.
>    - detach all loopback devices
...
> +        ioctl(fd, LOOP_CLR_FD, 0);
> +        r = errno;
> +        close_nointr(fd);
> +
> +        if (r == ENXIO) /* not bound, so no error */
> +                r = 0;
> +        errno = r;
> +        return -errno;

this version handles ENXIO, issued by kernel whenever the loop was not
bound, thus we avoid looping through all devices until maximum retries
are reached, speeding up the shutdown.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbieri at gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202


More information about the systemd-devel mailing list