Re: [systemd-devel] [RFC 4/4] add remote-fs dependencies if needed after change

2014-11-21 Thread Chris Leech
On Sun, Nov 09, 2014 at 08:32:05AM +0300, Andrei Borzenkov wrote:
 В Thu,  6 Nov 2014 21:11:03 -0800
 Chris Leech cle...@redhat.com пишет:
 
  This is an attempt to add it the remote-fs dependencies to a mount unit
  if the options change, like when the utab options are picked up after
  mountinfo has already been processed.  It just adds the remote-fs
  dependencies, leaving the local-fs ones in place.
  
  With this change I always get mount units with proper remote-fs
  dependencies when mounted with the _netdev option.
  
  It it not working for -o remount,_netdev.  But that looks like a
  libmount issue in that the ROOT field is not being set in utab on a
  remount, so if the initial mount did not require a utab entry then
  remount options never get merge in properly in mnt_table_parse_mtab
  ---
   src/core/mount.c | 13 +
   1 file changed, 13 insertions(+)
  
  diff --git a/src/core/mount.c b/src/core/mount.c
  index 7d77021..092a720 100644
  --- a/src/core/mount.c
  +++ b/src/core/mount.c
  @@ -1436,6 +1436,19 @@ static int mount_add_one(
   }
   }
   
  +if (m-running_as == SYSTEMD_SYSTEM) {
  +const char* target;
  +
  +target = mount_needs_network(options, fstype) ?  
  SPECIAL_REMOTE_FS_TARGET : NULL;
  +/* _netdev option may have shown up late, or on a
  + * remount. Add remote-fs dependencies, even though
  + * local-fs ones may already be there */
  +if (target) {
  +unit_add_dependency_by_name(u, 
  UNIT_BEFORE, target, NULL, true);
  +load_extras = true;
  +}
  +}
 
 Should not it also add After on network.target to ensure it is
 unmounted before network is down on shutdown? May be simply calling
 mount_add_default_dependencies() would be appropriate here.

Setting load_extras to true causes mount_add_extras to be called further
down in this function, which calls mount_add_default_dependencies.

So in testing I did see the After get added as well.  But if there's a
better way to clean up the mount unit adding code I'm all for it.

- Chris

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [RFC 4/4] add remote-fs dependencies if needed after change

2014-11-19 Thread Karel Zak
On Thu, Nov 06, 2014 at 09:11:03PM -0800, Chris Leech wrote:
 It it not working for -o remount,_netdev.  But that looks like a
 libmount issue in that the ROOT field is not being set in utab on a
 remount, so if the initial mount did not require a utab entry then
 remount options never get merge in properly in mnt_table_parse_mtab

 Fixed in util-linux git tree. Thanks.

Karel

-- 
 Karel Zak  k...@redhat.com
 http://karelzak.blogspot.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [RFC 4/4] add remote-fs dependencies if needed after change

2014-11-08 Thread Andrei Borzenkov
В Thu,  6 Nov 2014 21:11:03 -0800
Chris Leech cle...@redhat.com пишет:

 This is an attempt to add it the remote-fs dependencies to a mount unit
 if the options change, like when the utab options are picked up after
 mountinfo has already been processed.  It just adds the remote-fs
 dependencies, leaving the local-fs ones in place.
 
 With this change I always get mount units with proper remote-fs
 dependencies when mounted with the _netdev option.
 
 It it not working for -o remount,_netdev.  But that looks like a
 libmount issue in that the ROOT field is not being set in utab on a
 remount, so if the initial mount did not require a utab entry then
 remount options never get merge in properly in mnt_table_parse_mtab
 ---
  src/core/mount.c | 13 +
  1 file changed, 13 insertions(+)
 
 diff --git a/src/core/mount.c b/src/core/mount.c
 index 7d77021..092a720 100644
 --- a/src/core/mount.c
 +++ b/src/core/mount.c
 @@ -1436,6 +1436,19 @@ static int mount_add_one(
  }
  }
  
 +if (m-running_as == SYSTEMD_SYSTEM) {
 +const char* target;
 +
 +target = mount_needs_network(options, fstype) ?  
 SPECIAL_REMOTE_FS_TARGET : NULL;
 +/* _netdev option may have shown up late, or on a
 + * remount. Add remote-fs dependencies, even though
 + * local-fs ones may already be there */
 +if (target) {
 +unit_add_dependency_by_name(u, UNIT_BEFORE, 
 target, NULL, true);

Should not it also add After on network.target to ensure it is
unmounted before network is down on shutdown? May be simply calling
mount_add_default_dependencies() would be appropriate here.

 +load_extras = true;
 +}
 +}
 +
  if (u-load_state == UNIT_NOT_FOUND) {
  u-load_state = UNIT_LOADED;
  u-load_error = 0;

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [RFC 4/4] add remote-fs dependencies if needed after change

2014-11-06 Thread Chris Leech
This is an attempt to add it the remote-fs dependencies to a mount unit
if the options change, like when the utab options are picked up after
mountinfo has already been processed.  It just adds the remote-fs
dependencies, leaving the local-fs ones in place.

With this change I always get mount units with proper remote-fs
dependencies when mounted with the _netdev option.

It it not working for -o remount,_netdev.  But that looks like a
libmount issue in that the ROOT field is not being set in utab on a
remount, so if the initial mount did not require a utab entry then
remount options never get merge in properly in mnt_table_parse_mtab
---
 src/core/mount.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/src/core/mount.c b/src/core/mount.c
index 7d77021..092a720 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1436,6 +1436,19 @@ static int mount_add_one(
 }
 }
 
+if (m-running_as == SYSTEMD_SYSTEM) {
+const char* target;
+
+target = mount_needs_network(options, fstype) ?  
SPECIAL_REMOTE_FS_TARGET : NULL;
+/* _netdev option may have shown up late, or on a
+ * remount. Add remote-fs dependencies, even though
+ * local-fs ones may already be there */
+if (target) {
+unit_add_dependency_by_name(u, UNIT_BEFORE, 
target, NULL, true);
+load_extras = true;
+}
+}
+
 if (u-load_state == UNIT_NOT_FOUND) {
 u-load_state = UNIT_LOADED;
 u-load_error = 0;
-- 
1.9.3

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel