Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
On Sb, 09 ian 21, 10:24:44, Michael Biebl wrote: > Am 09.01.21 um 09:46 schrieb Andrei POPESCU: > > > If my understanding of systemd.unit(5) is correct this works as expected > > when using the PartOf= directive: zfs-share is stopped or restarted > > together with nfs-service, but not started. > > Right, PartOf= works as documented. > > >PartOf= > >Configures dependencies similar to Requires=, but limited to > >stopping and restarting of units. When systemd stops or restarts > >the units listed here, the action is propagated to this unit. > > Note > >that this is a one-way dependency — changes to this unit do not > >affect the listed units. > > > Can you elaborate why zfs-share.service uses > PartOf=nfs-kernel-server.service ? As far as I understand ZFS needs NFS to be up and running before being able share any of its file systems via NFS. Since I'm new to ZFS myself and my experience with NFS is also limited I'll let the package Maintainer elaborate on that. Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser signature.asc Description: PGP signature
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
PPS: code links below Trent W. Buck wrote: > Michael Biebl wrote: > > I never used ZFS, so I basically have zero knowledge how it is supposed to > > work. > > Here is a rough summary, I hope this helps! > > * USUALLY that is all you need. >ZFS calls mount/umount/exportfs/... automatically when appropriate, >so the running system matches the ZFS properties. linux nfs hooks: https://github.com/openzfs/zfs/blob/master/lib/libshare/os/linux/nfs.c > * You can call "zfs unshare" to manually stop NFS/SMB shares configured via > ZFS properties. > * You can call "zfs share" to manually start NFS/SMB shares configured via > ZFS properties. zfs share entrypoint: https://github.com/openzfs/zfs/blob/master/cmd/zfs/zfs_main.c#L235 NFS-related manpages: https://github.com/openzfs/zfs/blob/master/man/man8/zfs-share.8 https://github.com/openzfs/zfs/blob/master/man/man8/zfsprops.8#L1582 overview manpages: https://github.com/openzfs/zfs/blob/master/man/man8/zfsconcepts.8 https://github.com/openzfs/zfs/blob/master/man/man8/zpoolconcepts.8 NOTE: in zfs 0.8, there were 2 great big manpages. in zfs 2.0, there are lots of little manpages.
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
Michael Biebl wrote: > I never used ZFS, so I basically have zero knowledge how it is supposed to > work. Here is a rough summary, I hope this helps! ZFS glossary: * a "vdev" is an underlying physical disks/partitions (e.g. /dev/sda) * a "pool" is made of 1 or more vdevs (e.g. "morpheus") * a "dataset" is a logical volume/filesystem inside the pool (e.g. "morpheus/home/alice") * a "zvol" or "volume" is a dataset that stores blocks (used for e.g. VMs) * a "zfs" or "filesystem" is a dataset that stores files * a "property" is a key/value pair associated with a dataset (e.g. "compression=lz4"). NFS integration background: * ZFS properties can (optionally) replace /etc/fstab, /etc/exports, /etc/smb.conf. * If you do zfs set mountpoint=/home morpheus/home zfs set sharenfs=on morpheus/home that is roughly like morpheus/home /home zfs defaults # in fstab /home *(rw) # in exports * USUALLY that is all you need. ZFS calls mount/umount/exportfs/... automatically when appropriate, so the running system matches the ZFS properties. * You can call "zfs unshare" to manually stop NFS/SMB shares configured via ZFS properties. * You can call "zfs share" to manually start NFS/SMB shares configured via ZFS properties. Postscript: * Properties are recursive, so if you have ZFS datasets like morpheus/home morpheus/home/alice morpheus/home/bob If you "zfs set sharenfs=on morpheus/home", alice & bob are implicitly also shared. For NFS, this means things Just Work without needing no_subtree_check or a lot of repetition in /etc/exports. * The sharenfs= property can be more complicated than "on". The notation follows Solaris, not Linux. For example, zfs set sharenfs=sec=sys,ro,rw=example.com,rw=example.net,all_squash morpheus/home means something like /home *(ro,sec=sys,all_squash) /home example.com(rw,sec=sys,all_squash) /home example.net(rw,sec=sys,all_squash)
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
On Sb, 09 ian 21, 11:25:34, Andrei POPESCU wrote: > On Jo, 26 nov 20, 14:06:15, Trent W. Buck wrote: > > > > 1. I zfs set sharenfs (not /etc/exports), because > > it makes config management a little easier (exports(5) lacks a > > "drop-in" dir). > > BTW, /etc/exports.d/ is supported for quite some time, see e.g. #676604. > > Unfortunately it seems that configuring any exports there (e.g. non-ZFS > filesystems) disables all ZFS "native" exports. This appears to be fixed as well by adding WantedBy=nfs-server.service in zfs-share.service Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser signature.asc Description: PGP signature
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
On Jo, 26 nov 20, 14:06:15, Trent W. Buck wrote: > > 1. I zfs set sharenfs (not /etc/exports), because > it makes config management a little easier (exports(5) lacks a "drop-in" > dir). BTW, /etc/exports.d/ is supported for quite some time, see e.g. #676604. Unfortunately it seems that configuring any exports there (e.g. non-ZFS filesystems) disables all ZFS "native" exports. Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser signature.asc Description: PGP signature
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
Am 09.01.21 um 09:46 schrieb Andrei POPESCU: If my understanding of systemd.unit(5) is correct this works as expected when using the PartOf= directive: zfs-share is stopped or restarted together with nfs-service, but not started. Right, PartOf= works as documented. PartOf= Configures dependencies similar to Requires=, but limited to stopping and restarting of units. When systemd stops or restarts the units listed here, the action is propagated to this unit. Note that this is a one-way dependency — changes to this unit do not affect the listed units. Can you elaborate why zfs-share.service uses PartOf=nfs-kernel-server.service ? I never used ZFS, so I basically have zero knowledge how it is supposed to work. Regards, Michael OpenPGP_signature Description: OpenPGP digital signature
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
[really Cc'ing needrestart maintainers, sorry for duplicates] On Jo, 26 nov 20, 14:06:15, Trent W. Buck wrote: > Package: zfsutils-linux > Version: 0.8.4-1~bpo10+1 > Severity: minor > > I'm not sure who is 'at fault' here, or where the fix belongs. > > The problem I ran into was this: > > 1. I zfs set sharenfs (not /etc/exports), because > it makes config management a little easier (exports(5) lacks a "drop-in" > dir). > > 2. During an apt update, needrestart asks to restart NFS. > > 3. I tell needrestart "sure, go ahead". > > 4. All my NFS exports are gone! > > I can reproduce the symptoms with stop+start, but not restart: > > root@odin:~# exportfs -s > /srv/old-disks > goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) > root@odin:~# systemctl restart nfs-kernel-server > root@odin:~# exportfs -s > /srv/old-disks > goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) > root@odin:~# systemctl stop nfs-kernel-server > root@odin:~# systemctl start nfs-kernel-server > root@odin:~# exportfs -s > [UH OH, PROBLEM!] > root@odin:~# zfs share -a > root@odin:~# exportfs -s > /srv/old-disks > goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) I can reproduce this as well. > Can ZFS hook NFS, or vice-versa, so this problem flow stops happening? > This has already bitten me twice! :-( If my understanding of systemd.unit(5) is correct this works as expected when using the PartOf= directive: zfs-share is stopped or restarted together with nfs-service, but not started. Maybe the needrestart Maintainers have a better idea what is going on here? (adding to Cc: and attaching zfs-share.service for their convenience) Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser [Unit] Description=ZFS file system shares Documentation=man:zfs(8) After=nfs-server.service nfs-kernel-server.service After=smb.service Before=rpc-statd-notify.service Wants=zfs-mount.service After=zfs-mount.service PartOf=nfs-server.service nfs-kernel-server.service PartOf=smb.service [Service] Type=oneshot RemainAfterExit=yes ExecStartPre=-/bin/rm -f /etc/dfs/sharetab ExecStart=/sbin/zfs share -a [Install] WantedBy=zfs.target signature.asc Description: PGP signature
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
On Jo, 26 nov 20, 14:06:15, Trent W. Buck wrote: > Package: zfsutils-linux > Version: 0.8.4-1~bpo10+1 > Severity: minor > > I'm not sure who is 'at fault' here, or where the fix belongs. > > The problem I ran into was this: > > 1. I zfs set sharenfs (not /etc/exports), because > it makes config management a little easier (exports(5) lacks a "drop-in" > dir). > > 2. During an apt update, needrestart asks to restart NFS. > > 3. I tell needrestart "sure, go ahead". > > 4. All my NFS exports are gone! > > I can reproduce the symptoms with stop+start, but not restart: > > root@odin:~# exportfs -s > /srv/old-disks > goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) > root@odin:~# systemctl restart nfs-kernel-server > root@odin:~# exportfs -s > /srv/old-disks > goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) > root@odin:~# systemctl stop nfs-kernel-server > root@odin:~# systemctl start nfs-kernel-server > root@odin:~# exportfs -s > [UH OH, PROBLEM!] > root@odin:~# zfs share -a > root@odin:~# exportfs -s > /srv/old-disks > goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) I can reproduce this as well. > Can ZFS hook NFS, or vice-versa, so this problem flow stops happening? > This has already bitten me twice! :-( If my understanding of systemd.unit(5) is correct this works as expected when using the PartOf= directive: zfs-share is stopped or restarted together with nfs-service, but not started. Maybe the needrestart Maintainers have a better idea what is going on here? (adding to Cc: and attaching zfs-share.service for their convenience) Kind regards, Andrei -- http://wiki.debian.org/FAQsFromDebianUser [Unit] Description=ZFS file system shares Documentation=man:zfs(8) After=nfs-server.service nfs-kernel-server.service After=smb.service Before=rpc-statd-notify.service Wants=zfs-mount.service After=zfs-mount.service PartOf=nfs-server.service nfs-kernel-server.service PartOf=smb.service [Service] Type=oneshot RemainAfterExit=yes ExecStartPre=-/bin/rm -f /etc/dfs/sharetab ExecStart=/sbin/zfs share -a [Install] WantedBy=zfs.target signature.asc Description: PGP signature
Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start
Package: zfsutils-linux Version: 0.8.4-1~bpo10+1 Severity: minor I'm not sure who is 'at fault' here, or where the fix belongs. The problem I ran into was this: 1. I zfs set sharenfs (not /etc/exports), because it makes config management a little easier (exports(5) lacks a "drop-in" dir). 2. During an apt update, needrestart asks to restart NFS. 3. I tell needrestart "sure, go ahead". 4. All my NFS exports are gone! I can reproduce the symptoms with stop+start, but not restart: root@odin:~# exportfs -s /srv/old-disks goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) root@odin:~# systemctl restart nfs-kernel-server root@odin:~# exportfs -s /srv/old-disks goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) root@odin:~# systemctl stop nfs-kernel-server root@odin:~# systemctl start nfs-kernel-server root@odin:~# exportfs -s [UH OH, PROBLEM!] root@odin:~# zfs share -a root@odin:~# exportfs -s /srv/old-disks goll.lan(ro,async,wdelay,root_squash,no_subtree_check,mountpoint,sec=sys,ro,secure,root_squash,no_all_squash) Can ZFS hook NFS, or vice-versa, so this problem flow stops happening? This has already bitten me twice! :-(