tag -1 + patch
thanks

On Thu, Jan 23, 2014 at 09:33:52AM +0000, Sam Morris wrote:
> On Wed, Jan 22, 2014 at 10:45:58PM +0100, Zbigniew Jędrzejewski-Szmek wrote:
> > On Wed, Jan 22, 2014 at 11:59:27AM +0000, Sam Morris wrote:
> > > $ systemctl show home.mount
> > >   Id=home.mount
> > >   Names=home.mount
> > >   Requires=-.mount
> > >   Wants=network-online.target
> > >   Conflicts=umount.target
> > >   Before=local-fs.target umount.target remote-fs.target
> > This is wrong. The dependency for local-fs.target should not be there.
> > It'll cause the fs to be kept around until after the network is gone.
> 
> Here's the full home.mount from the generator:
> 
>       [Unit]
>       SourcePath=/etc/fstab
>       DefaultDependencies=no
>       After=remote-fs-pre.target
>       After=network.target
>       After=network-online.target
>       Wants=network-online.target
>       Conflicts=umount.target
>       Before=umount.target
>       Before=remote-fs.target
> 
>       [Mount]
>       What=gaia:/home
>       Where=/home
>       Type=nfs
>       FsckPassNo=0
>       Options=rw,nosuid,nodev,nfsvers=3,hard,sloppy
> 
> Not sure where Before=local-fs.target comes from.

I rebuilt with the attached patch and it does the trick. I think it's
also the fix applied to fix
<https://bugzilla.redhat.com/show_bug.cgi?id=999061>.

Cheers,

-- 
Sam Morris <https://robots.org.uk/>
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078
commit 77009452cfd25208509b14ea985e81fdf9f7d40e
Author: Zbigniew Jędrzejewski-Szmek <zbys...@in.waw.pl>
Date:   Thu Oct 3 22:15:08 2013 -0400

    systemd: order remote mounts from mountinfo before remote-fs.target
    
    Usually the network is stopped before filesystems are umounted.
    Ordering network filesystems before remote-fs.target means that their
    unmounting will be performed earlier, and can terminate sucessfully.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=70002

diff --git a/src/core/mount.c b/src/core/mount.c
index 3d46557..93bfa99 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1440,6 +1440,9 @@ static int mount_add_one(
 
         u = manager_get_unit(m, e);
         if (!u) {
+                const char* const target =
+                        fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
+
                 delete = true;
 
                 u = unit_new(m, sizeof(Mount));
@@ -1466,7 +1469,7 @@ static int mount_add_one(
                         goto fail;
                 }
 
-                r = unit_add_dependency_by_name(u, UNIT_BEFORE, SPECIAL_LOCAL_FS_TARGET, NULL, true);
+                r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
                 if (r < 0)
                         goto fail;
 

Reply via email to