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

2010-10-07 Thread Karel Zak
On Thu, Oct 07, 2010 at 07:08:03PM +0200, Lennart Poettering wrote: > Or in other words: Gustavo's and Fidencio's code is just about enough to > avoid unclean file systems. If everything went correctly during normal > operation the usual ordered .mount units will aready have called > /bin/umount fo

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

2010-10-07 Thread Lennart Poettering
On Wed, 06.10.10 15:43, Karel Zak (k...@redhat.com) wrote: > > On Wed, Oct 06, 2010 at 03:01:02PM +0200, Lennart Poettering wrote: > > > > +if (streq(mp->path, "/")) > > > > +continue; > > > > + > > > > +/* Trying to umount. Forcing to umoun

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

2010-10-06 Thread Gustavo Sverzut Barbieri
From: Fabiano Fidencio 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 TODO: - umount dms Mountpoints are being read from /proc/self/mountinfo.

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

2010-10-06 Thread Gustavo Sverzut Barbieri
On Wed, Oct 6, 2010 at 10:40 AM, Gustavo Sverzut Barbieri wrote: >>> +        ioctl(fd, LOOP_CLR_FD, 0); >>> +        r = errno; >>> +        close_nointr(fd); >>> + >>> +        if (r == ENXIO) /* not bound, so no error */ >>> +                r = 0; >>> +        errno = r; >>> +        return -e

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

2010-10-06 Thread Karel Zak
On Wed, Oct 06, 2010 at 03:01:02PM +0200, Lennart Poettering wrote: > > > +if (streq(mp->path, "/")) > > > +continue; > > > + > > > +/* Trying to umount. Forcing to umount if busy (only for > > > NFS mounts) */ > > > +if (umou

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

2010-10-06 Thread Gustavo Sverzut Barbieri
On Wed, Oct 6, 2010 at 10:09 AM, Lennart Poettering wrote: > On Wed, 06.10.10 02:05, Gustavo Sverzut Barbieri (barbi...@profusion.mobi) > wrote: > >> +#define LOOP_CLR_FD     0x4C01 > > Is there any particular reason you define this here? To me it appears > that linux/loop.h is perfectly fit to b

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

2010-10-06 Thread Kay Sievers
On Wed, Oct 6, 2010 at 15:09, Lennart Poettering wrote: > On Wed, 06.10.10 02:05, Gustavo Sverzut Barbieri (barbi...@profusion.mobi) > wrote: > >> +#define LOOP_CLR_FD     0x4C01 > > Is there any particular reason you define this here? To me it appears > that linux/loop.h is perfectly fit to be i

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

2010-10-06 Thread Lennart Poettering
On Wed, 06.10.10 02:05, Gustavo Sverzut Barbieri (barbi...@profusion.mobi) wrote: > +#define LOOP_CLR_FD 0x4C01 Is there any particular reason you define this here? To me it appears that linux/loop.h is perfectly fit to be included here. > + > +if ((dir = opendir("/sys/class/block")

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

2010-10-06 Thread Lennart Poettering
On Wed, 06.10.10 14:17, Karel Zak (k...@redhat.com) wrote: > > +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)

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

2010-10-06 Thread Kay Sievers
On Wed, Oct 6, 2010 at 14:17, Karel Zak wrote: >> +        if ((dir = opendir("/sys/class/block")) == NULL) >> +                return -errno; >> + >> +        while ((d = readdir(dir))) { >> +                MountPoint *lb; >> +                char buf[PATH_MAX]; >> +                char *loop; >

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

2010-10-06 Thread Karel Zak
On Wed, Oct 06, 2010 at 02:05:43AM -0300, Gustavo Sverzut Barbieri wrote: > +static int swap_list_get(MountPoint **swap_list_head) { > +FILE *proc_swaps; > +unsigned int i; > +int r; > + > +if (!(proc_swaps = fopen("/proc/swaps", "re"))) > +return -er

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

2010-10-05 Thread Gustavo Sverzut Barbieri
On Wed, Oct 6, 2010 at 2:05 AM, Gustavo Sverzut Barbieri wrote: > From: Fabiano Fidencio > > 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 ...

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

2010-10-05 Thread Gustavo Sverzut Barbieri
From: Fabiano Fidencio 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 TODO: - umount dms Mountpoints are being read from /proc/self/mountinfo.

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

2010-10-05 Thread Gustavo Sverzut Barbieri
From: Fabiano Fidencio 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 TODO: - umount dms Mountpoints are being read from /proc/self/mountinfo.

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

2010-09-28 Thread Lennart Poettering
On Mon, 27.09.10 18:34, Fabiano Fidencio (fiden...@profusion.mobi) wrote: > + > +static void mount_points_list_free(MountPoint **mp_list_head) { > +MountPoint *mp, *mp_next; > +LIST_FOREACH_SAFE(mount_point, mp, mp_next, *mp_list_head) > +mount_point_remove_and_free

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

2010-09-27 Thread Fabiano Fidencio
This functions will unmount all filesystem that aren't api (and those which fail will be remounted read-only). Filesystems are being read from /proc/self/mountinfo. --- Makefile.am |1 + src/umount.c | 184 ++ src/umount.h | 27 ++

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

2010-09-27 Thread fidencio
From: Fabiano Fidencio This functions will unmount all filesystem that aren't api (and those which fail will be remounted read-only). Filesystems are being read from /proc/self/mountinfo. --- Makefile.am |1 + src/umount.c | 183 ++ s