diff --git a/debian/zfsutils-linux.install b/debian/zfsutils-linux.install index 319d1c09c5fb..b59f416f31ef 100644 --- a/debian/zfsutils-linux.install +++ b/debian/zfsutils-linux.install @@ -1,6 +1,7 @@ ../tree/zfsutils-linux/* / lib/systemd/system/zfs-mount.service lib/systemd/system/zfs-share.service +lib/systemd/system/zfs-share-cleanup.service lib/systemd/system/zfs-import-scan.service lib/systemd/system/zfs-import-cache.service lib/systemd/system/zfs.target diff --git a/debian/zfsutils-linux.postinst b/debian/zfsutils-linux.postinst index 673a2ba6e004..6079b9a04ab5 100644 --- a/debian/zfsutils-linux.postinst +++ b/debian/zfsutils-linux.postinst @@ -11,6 +11,7 @@ configure) systemctl enable zfs-import.target systemctl enable zfs-mount.service systemctl enable zfs-share.service + systemctl enable zfs-share-cleanup.service systemctl enable zfs-volume-wait.service systemctl enable zfs-volumes.target systemctl enable zfs.target diff --git a/debian/zfsutils-linux.prerm b/debian/zfsutils-linux.prerm index a7e4469c2513..a8b9c4cf5735 100644 --- a/debian/zfsutils-linux.prerm +++ b/debian/zfsutils-linux.prerm @@ -7,6 +7,7 @@ upgrade | remove) systemctl disable zfs-import.target systemctl disable zfs-mount.service systemctl disable zfs-share.service + systemctl disable zfs-share-cleanup.service systemctl disable zfs-volume-wait.service systemctl disable zfs-volumes.target systemctl disable zfs.target diff --git a/etc/systemd/system/50-zfs.preset.in b/etc/systemd/system/50-zfs.preset.in index 51ffb0f41736..b819574d36f5 100644 --- a/etc/systemd/system/50-zfs.preset.in +++ b/etc/systemd/system/50-zfs.preset.in @@ -4,6 +4,7 @@ disable zfs-import-scan.service enable zfs-import.target enable zfs-mount.service enable zfs-share.service +enable zfs-share-cleanup.service enable zfs-zed.service enable zfs-volume-wait.service enable zfs-volumes.target diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am index 9249f15eb455..68f465cd9bf4 100644 --- a/etc/systemd/system/Makefile.am +++ b/etc/systemd/system/Makefile.am @@ -7,6 +7,7 @@ systemdunit_DATA = \ zfs-import-scan.service \ zfs-mount.service \ zfs-share.service \ + zfs-share-cleanup.service \ zfs-volume-wait.service \ zfs-import.target \ zfs-volumes.target \ @@ -18,6 +19,7 @@ EXTRA_DIST = \ $(top_srcdir)/etc/systemd/system/zfs-import-scan.service.in \ $(top_srcdir)/etc/systemd/system/zfs-mount.service.in \ $(top_srcdir)/etc/systemd/system/zfs-share.service.in \ + $(top_srcdir)/etc/systemd/system/zfs-share-cleanup.service.in \ $(top_srcdir)/etc/systemd/system/zfs-import.target.in \ $(top_srcdir)/etc/systemd/system/zfs-volume-wait.service.in \ $(top_srcdir)/etc/systemd/system/zfs-volumes.target.in \ diff --git a/etc/systemd/system/zfs-share-cleanup.service.in b/etc/systemd/system/zfs-share-cleanup.service.in new file mode 100644 index 000000000000..8a9b6e66afa0 --- /dev/null +++ b/etc/systemd/system/zfs-share-cleanup.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=ZFS file system shares cleanup +After=nfs-server.service +PartOf=nfs-server.service nfs-kernel-server.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=-/bin/rm -f /etc/exports.d/zfs.exports + +[Install] +WantedBy=zfs.target diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index a74d066bbae1..36f0a376ddf2 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -322,7 +322,7 @@ image which is ZFS aware. %if 0%{?_systemd} %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable-sysvinit - %define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target zfs-import.target zfs-volume-wait.service zfs-volumes.target + %define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-share-cleanup.service zfs-zed.service zfs.target zfs-import.target zfs-volume-wait.service zfs-volumes.target %else %define systemd --enable-sysvinit --disable-systemd %endif @@ -370,6 +370,7 @@ if [ -x /sbin/chkconfig ]; then /sbin/chkconfig --add zfs-import /sbin/chkconfig --add zfs-mount /sbin/chkconfig --add zfs-share + /sbin/chkconfig --add zfs-share-cleanup /sbin/chkconfig --add zfs-zed fi %endif @@ -399,7 +400,7 @@ fi if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then /sbin/chkconfig --del zfs-import /sbin/chkconfig --del zfs-mount - /sbin/chkconfig --del zfs-share + /sbin/chkconfig --del zfs-share-cleanup /sbin/chkconfig --del zfs-zed fi %endif