]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount: add new LazyUnmount= setting for mount units, mapping to umount(8)'s "-l"...
authorbrulon <barron@lexmark.com>
Fri, 26 Aug 2016 15:57:22 +0000 (11:57 -0400)
committerLennart Poettering <lennart@poettering.net>
Fri, 26 Aug 2016 15:57:22 +0000 (17:57 +0200)
man/systemd.mount.xml
src/core/dbus-mount.c
src/core/load-fragment-gperf.gperf.m4
src/core/mount.c
src/core/mount.h

index a38165f9b90f654b841aa12aa804329a53df31b7..fa17f22dc3a0fcb7d2351dfabafce0cf8f6d645a 100644 (file)
         off.</para></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><varname>LazyUnmount=</varname></term>
+
+        <listitem><para>Takes a boolean argument. If true, detach the
+        filesystem from the filesystem hierarchy at time of the unmount
+        operation, and clean up all references to the filesystem as
+        soon as they are not busy anymore.
+        This corresponds with
+        <citerefentry project='man-pages'><refentrytitle>umount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
+        <parameter>-l</parameter> switch. Defaults to
+        off.</para></listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><varname>DirectoryMode=</varname></term>
         <listitem><para>Directories of mount points (and any parent
index 3c6bda40739a500757c01e1f2f00e87eaf85081f..4421f26bc1f489102b348504a06daeefa4454dfe 100644 (file)
@@ -116,6 +116,7 @@ const sd_bus_vtable bus_mount_vtable[] = {
         SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(Mount, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
         SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Mount, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("SloppyOptions", "b", bus_property_get_bool, offsetof(Mount, sloppy_options), SD_BUS_VTABLE_PROPERTY_CONST),
+        SD_BUS_PROPERTY("LazyUnmount", "b", bus_property_get_bool, offsetof(Mount, lazy_unmount), SD_BUS_VTABLE_PROPERTY_CONST),
         SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Mount, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
         SD_BUS_PROPERTY("UID", "u", NULL, offsetof(Unit, ref_uid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
         SD_BUS_PROPERTY("GID", "u", NULL, offsetof(Unit, ref_gid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
index 05fe0df7e3a9841c4a26ef6d4a365406d0541957..420d32dbd70f916904a1abd31b8030d9d82a8265 100644 (file)
@@ -355,6 +355,7 @@ Mount.Type,                      config_parse_string,                0,
 Mount.TimeoutSec,                config_parse_sec,                   0,                             offsetof(Mount, timeout_usec)
 Mount.DirectoryMode,             config_parse_mode,                  0,                             offsetof(Mount, directory_mode)
 Mount.SloppyOptions,             config_parse_bool,                  0,                             offsetof(Mount, sloppy_options)
+Mount.LazyUnmount,               config_parse_bool,                  0,                             offsetof(Mount, lazy_unmount)
 EXEC_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
 CGROUP_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
 KILL_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
index f2ac8d171f56d04fb1ec594948411c8d23116047..2c2a54edbbcf50878cb2aee9285426e6b67ad737 100644 (file)
@@ -677,7 +677,8 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) {
                 "%sOptions: %s\n"
                 "%sFrom /proc/self/mountinfo: %s\n"
                 "%sFrom fragment: %s\n"
-                "%sDirectoryMode: %04o\n",
+                "%sDirectoryMode: %04o\n"
+                "%sLazyUnmount: %s\n",
                 prefix, mount_state_to_string(m->state),
                 prefix, mount_result_to_string(m->result),
                 prefix, m->where,
@@ -686,7 +687,8 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) {
                 prefix, p ? strna(p->options) : "n/a",
                 prefix, yes_no(m->from_proc_self_mountinfo),
                 prefix, yes_no(m->from_fragment),
-                prefix, m->directory_mode);
+                prefix, m->directory_mode,
+                prefix, yes_no(m->lazy_unmount));
 
         if (m->control_pid > 0)
                 fprintf(f,
@@ -846,6 +848,8 @@ static void mount_enter_unmounting(Mount *m) {
         m->control_command = m->exec_command + MOUNT_EXEC_UNMOUNT;
 
         r = exec_command_set(m->control_command, UMOUNT_PATH, m->where, NULL);
+        if (r >= 0 && m->lazy_unmount)
+                r = exec_command_append(m->control_command, "-l", NULL);
         if (r < 0)
                 goto fail;
 
index ac27b518cc67c13989904975b624699a7445996f..c4a2bff100225e75b12edb25e1a9ebeb2a4aedec 100644 (file)
@@ -71,6 +71,8 @@ struct Mount {
 
         bool sloppy_options;
 
+        bool lazy_unmount;
+
         MountResult result;
         MountResult reload_result;