package/libnfsidmap: new package
PATCH 1/2 package/libnfsidmap: new package
From: Konstantin Porotchkin <[email protected]>
Reqired for NFSv4 support.
Taken from git at github.com:openstack/manila-test-image.git /patches/nfs-utils-enable-nfsv4.patch
--- package/Config.in | 1 + package/libnfsidmap/Config.in | 7 +++++++ package/libnfsidmap/libnfsidmap.mk | 13 +++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 package/libnfsidmap/Config.in create mode 100644 package/libnfsidmap/libnfsidmap.mk
package/Config.in +1 -0
@@ -1533,6 +1533,7 @@ menu "Networking" source "package/libnetfilter_log/Config.in" source "package/libnetfilter_queue/Config.in" source "package/libnfnetlink/Config.in" + source "package/libnfsidmap/Config.in" source "package/libnftnl/Config.in" source "package/libnice/Config.in" source "package/libnl/Config.in"
package/libnfsidmap/Config.in new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_LIBNFSIDMAP + bool "libnfsidmap" + help + Library used by the NFSv4 server to do userid mapping. + + http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap +
package/libnfsidmap/libnfsidmap.mk new file +13 -0
@@ -0,0 +1,13 @@ +# +# libnfsidmap +# + +LIBNFSIDMAP_VERSION = 0.25 +LIBNFSIDMAP_SITE = http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap +LIBNFSIDMAP_SOURCE = libnfsidmap-$(LIBNFSIDMAP_VERSION).tar.gz +LIBNFSIDMAP_INSTALL_STAGING = YES +LIBNFSIDMAP_LICENSE = BSD-like +LIBNFSIDMAP_LICENSE_FILES = COPYING + +$(eval $(autotools-package)) +$(eval $(host-autotools-package))
Signature · 1 line
2.17.1
PATCH 2/2 package/nfs-utils: enable support of NFSv4
From: Konstantin Porotchkin <[email protected]>
Taken from git at github.com:openstack/manila-test-image.git /patches/nfs-utils-enable-nfsv4.patch
--- package/nfs-utils/Config.in | 10 ++++++++++ package/nfs-utils/S60nfs | 27 +++++++++++++++++++++++---- package/nfs-utils/etc-idmapd.conf | 9 +++++++++ package/nfs-utils/nfs-utils.mk | 19 ++++++++++++++++--- 4 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 package/nfs-utils/etc-idmapd.conf
package/nfs-utils/Config.in +10 -0
@@ -30,4 +30,14 @@ config BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD help NFS remote quota server +config BR2_PACKAGE_NFS_UTILS_NFS4 + bool "NFSv4 support" + select BR2_PACKAGE_LIBEVENT + select BR2_PACKAGE_LIBNFSIDMAP + help + Enable support for NFSv4. + +comment "nfs-utils requires a toolchain with RPC and LARGEFILE support" + depends on !BR2_INET_RPC || !BR2_LARGEFILE + endif
package/nfs-utils/S60nfs +23 -4
@@ -3,6 +3,8 @@ # nfs This shell script takes care of starting and stopping # the NFS services. Stolen from RedHat FC5. +ENABLEv4=yes + mkdir -p /var/lock/subsys mkdir -p /run/nfs/sm mkdir -p /run/nfs/sm.bak
@@ -15,13 +17,26 @@ if [ -f "${CFG_FILE}" ]; then . "${CFG_FILE}" fi +if [ $ENABLEv4 == "yes" ]; then + pipefs_dir="`sed -n 's/^ *Pipefs-Directory *= *//p' /etc/idmapd.conf`" +fi start() { # Start daemons. + if [ $ENABLEv4 == "yes" ]; then + printf "Starting NFS idmapd: " + [ -d /var/lib/nfs/v4recovery ] || mkdir -p /var/lib/nfs/v4recovery + [ -d "$pipefs_dir" ] || mkdir -p "$pipefs_dir" + if ! ( grep -q "on $pipefs_dir type rpc_pipefs" /proc/mounts ); then + mount -t rpc_pipefs sunrpc "$pipefs_dir" + fi + rpc.idmapd + echo "done" + fi + printf "Starting NFS statd: " rpc.statd [ $? = 0 ] && echo "OK" || echo "FAIL" - touch /var/lock/subsys/nfslock printf "Starting NFS services: " /usr/sbin/exportfs -r
@@ -34,11 +49,17 @@ start() { printf "Starting NFS mountd: " rpc.mountd [ $? = 0 ] && echo "OK" || echo "FAIL" - touch /var/lock/subsys/nfs } stop() { # Stop daemons. + if [ $ENABLEv4 == "yes" ]; then + printf "Shutting down NFS idmapd: " + killall -q rpc.idmapd + umount "$pipefs_dir" + echo "done" + fi + printf "Shutting down NFS mountd: " killall -q rpc.mountd 2>/dev/null [ $? = 0 ] && echo "OK" || echo "FAIL"
@@ -56,7 +77,6 @@ stop() { [ $? = 0 ] && echo "OK" || echo "FAIL" rm -f /var/lock/subsys/nfs rm -f /var/run/rpc.statd.pid - rm -f /var/lock/subsys/nfslock } # See how we were called.
@@ -73,7 +93,6 @@ case "$1" in ;; reload) /usr/sbin/exportfs -r - touch /var/lock/subsys/nfs ;; *) echo "Usage: $0 {start|stop|restart|reload}"
package/nfs-utils/etc-idmapd.conf new file +9 -0
@@ -0,0 +1,9 @@ +[General] +Verbosity = 0 +Pipefs-Directory = /var/lib/nfs/rpc_pipefs +Domain = localdomain + +[Mapping] +Nobody-User = nobody +Nobody-Group = nogroup +
package/nfs-utils/nfs-utils.mk +16 -3
@@ -15,15 +15,19 @@ NFS_UTILS_DEPENDENCIES = host-pkgconf NFS_UTILS_CONF_ENV = knfsd_cv_bsd_signals=no NFS_UTILS_CONF_OPTS = \ - --disable-nfsv4 \ - --disable-nfsv41 \ --disable-gss \ --disable-uuid \ - --disable-ipv6 \ --without-tcp-wrappers \ --with-statedir=/run/nfs \ --with-rpcgen=internal +ifeq ($(BR2_PACKAGE_LIBNFSIDMAP),y) +NFS_UTILS_DEPENDENCIES += libevent libnfsidmap lvm2 sqlite +NFS_UTILS_CONF_OPTS += --enable-nfsv4 --enable-nfsv41 +else +NFS_UTILS_CONF_OPTS += --disable-nfsv4 --disable-nfsv41 +endif + HOST_NFS_UTILS_CONF_OPTS = \ --disable-nfsv4 \ --disable-nfsv41 \
@@ -62,7 +66,16 @@ define NFS_UTILS_INSTALL_FIXUP $(INSTALL) -D -m 644 \ $(@D)/utils/mount/nfsmount.conf $(TARGET_DIR)/etc/nfsmount.conf endef + +define NFS_UTILS_INSTALL_IDMAPD_CONF + $(INSTALL) -m 0644 package/nfs-utils/etc-idmapd.conf \ + $(TARGET_DIR)/etc/idmapd.conf +endef + NFS_UTILS_POST_INSTALL_TARGET_HOOKS += NFS_UTILS_INSTALL_FIXUP +ifeq ($(BR2_PACKAGE_NFS_UTILS_NFS4),y) + NFS_UTILS_POST_INSTALL_TARGET_HOOKS += NFS_UTILS_INSTALL_IDMAPD_CONF +endif ifeq ($(BR2_INIT_SYSTEMD),y) NFS_UTILS_CONF_OPTS += --with-systemd=/usr/lib/systemd/system
Signature · 1 line
2.17.1
PATCH 2/2 package/nfs-utils: enable support of NFSv4
Hello Kostya,
Thanks for this work, very useful to have this.
Quoted 4 lines · On Wed, 6 Feb 2019 18:06:01 +0200 <[email protected]> wrote:
From: Konstantin Porotchkin <[email protected]>
Taken from git at github.com:openstack/manila-test-image.git /patches/nfs-utils-enable-nfsv4.patch
Nice, I didn't know Openstack was using Buildroot for some stuff.
Quoted 7 lines
package/nfs-utils/Config.in +0
-0@@ -30,4 +30,14 @@ config BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD help NFS remote quota server
package/nfs-utils/Config.in config BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD · line 41
Quoted 10 lines
package/nfs-utils/Config.in +9
-0+config BR2_PACKAGE_NFS_UTILS_NFS4 + bool "NFSv4 support" + select BR2_PACKAGE_LIBEVENT + select BR2_PACKAGE_LIBNFSIDMAP + help + Enable support for NFSv4. + +comment "nfs-utils requires a toolchain with RPC and LARGEFILE support" + depends on !BR2_INET_RPC || !BR2_LARGEFILE
Why are you adding this comment ? nfs-utils already has the appropriate comment. Furthermore, neither BR2_INET_RPC nor BR2_LARGEFILE exist in Buildroot nowadays.
package/nfs-utils/S60nfs line 6
Quoted 9 lines
package/nfs-utils/S60nfs +1
-0@@ -3,6 +3,8 @@ # nfs This shell script takes care of starting and stopping # the NFS services. Stolen from RedHat FC5. +ENABLEv4=yes
This seems weird. Why is it unconditional ? I guess it won't work if BR2_PACKAGE_NFS_UTILS_NFS4 is disabled. Perhaps put this in /etc/default/nfsd, and generate it in package/nfs-utils/nfs-utils.mk ?
Quoted 52 lines
package/nfs-utils/S60nfs +22
-2+ mkdir -p /var/lock/subsys mkdir -p /run/nfs/sm mkdir -p /run/nfs/sm.bak@@ -15,13 +17,26 @@ if [ -f "${CFG_FILE}" ]; then . "${CFG_FILE}" fi +if [ $ENABLEv4 == "yes" ]; then + pipefs_dir="`sed -n 's/^ *Pipefs-Directory *= *//p' /etc/idmapd.conf`" +fi start() { # Start daemons. + if [ $ENABLEv4 == "yes" ]; then + printf "Starting NFS idmapd: " + [ -d /var/lib/nfs/v4recovery ] || mkdir -p /var/lib/nfs/v4recovery + [ -d "$pipefs_dir" ] || mkdir -p "$pipefs_dir" + if ! ( grep -q "on $pipefs_dir type rpc_pipefs" /proc/mounts ); then + mount -t rpc_pipefs sunrpc "$pipefs_dir" + fi + rpc.idmapd + echo "done" + fi + printf "Starting NFS statd: " rpc.statd [ $? = 0 ] && echo "OK" || echo "FAIL" - touch /var/lock/subsys/nfslock printf "Starting NFS services: " /usr/sbin/exportfs -r@@ -34,11 +49,17 @@ start() { printf "Starting NFS mountd: " rpc.mountd [ $? = 0 ] && echo "OK" || echo "FAIL" - touch /var/lock/subsys/nfs } stop() { # Stop daemons. + if [ $ENABLEv4 == "yes" ]; then + printf "Shutting down NFS idmapd: " + killall -q rpc.idmapd + umount "$pipefs_dir" + echo "done" + fi + printf "Shutting down NFS mountd: " killall -q rpc.mountd 2>/dev/null [ $? = 0 ] && echo "OK" || echo "FAIL"
package/nfs-utils/S60nfs stop() { · line 59
Quoted 4 lines
package/nfs-utils/S60nfs +0
-1@@ -56,7 +77,6 @@ stop() { [ $? = 0 ] && echo "OK" || echo "FAIL" rm -f /var/lock/subsys/nfs rm -f /var/run/rpc.statd.pid - rm -f /var/lock/subsys/nfslock
Any reason why this is being removed ?
package/nfs-utils/S60nfs case "$1" in · line 76
Quoted 8 lines
package/nfs-utils/S60nfs +0
-1} # See how we were called.@@ -73,7 +93,6 @@ case "$1" in ;; reload) /usr/sbin/exportfs -r - touch /var/lock/subsys/nfs
Any reason why this is being removed ?
Quoted 23 lines
package/nfs-utils/S60nfs +0
-0;; *) echo "Usage: $0 {start|stop|restart|reload}"package/nfs-utils/etc-idmapd.conf new file +9
-0@@ -0,0 +1,9 @@ +[General] +Verbosity = 0 +Pipefs-Directory = /var/lib/nfs/rpc_pipefs +Domain = localdomain + +[Mapping] +Nobody-User = nobody +Nobody-Group = nogroup +package/nfs-utils/nfs-utils.mk +0
-0
package/nfs-utils/nfs-utils.mk NFS_UTILS_DEPENDENCIES = host-pkgconf · line 22
Quoted 8 lines
package/nfs-utils/nfs-utils.mk +0
-3@@ -15,15 +15,19 @@ NFS_UTILS_DEPENDENCIES = host-pkgconf NFS_UTILS_CONF_ENV = knfsd_cv_bsd_signals=no NFS_UTILS_CONF_OPTS = \ - --disable-nfsv4 \ - --disable-nfsv41 \ --disable-gss \ --disable-uuid \ - --disable-ipv6 \
I'm not sure why we are disabling IPv6 here. Changing this is definitely OK, but it should be in a separate patch, as it's not related.
package/nfs-utils/nfs-utils.mk NFS_UTILS_DEPENDENCIES = host-pkgconf · line 25
Quoted 6 lines
package/nfs-utils/nfs-utils.mk +2
-0--without-tcp-wrappers \ --with-statedir=/run/nfs \ --with-rpcgen=internal +ifeq ($(BR2_PACKAGE_LIBNFSIDMAP),y) +NFS_UTILS_DEPENDENCIES += libevent libnfsidmap lvm2 sqlite
If lvm2 and sqlite are dependencies, they should be selected from the Config.in file. Any idea why lvm2 is needed ?
Quoted 9 lines
package/nfs-utils/nfs-utils.mk +5
-0+NFS_UTILS_CONF_OPTS += --enable-nfsv4 --enable-nfsv41 +else +NFS_UTILS_CONF_OPTS += --disable-nfsv4 --disable-nfsv41 +endif + HOST_NFS_UTILS_CONF_OPTS = \ --disable-nfsv4 \ --disable-nfsv41 \
package/nfs-utils/nfs-utils.mk define NFS_UTILS_INSTALL_FIXUP · line 73
Quoted 8 lines
package/nfs-utils/nfs-utils.mk +5
-0@@ -62,7 +66,16 @@ define NFS_UTILS_INSTALL_FIXUP $(INSTALL) -D -m 644 \ $(@D)/utils/mount/nfsmount.conf $(TARGET_DIR)/etc/nfsmount.conf endef + +define NFS_UTILS_INSTALL_IDMAPD_CONF + $(INSTALL) -m 0644 package/nfs-utils/etc-idmapd.conf \ + $(TARGET_DIR)/etc/idmapd.conf +endef
Please enclose this hook definition inside the ifeq ($(BR2_PACKAGE_NFS_UTILS_NFS4),y) condition.
package/nfs-utils/nfs-utils.mk define NFS_UTILS_INSTALL_FIXUP · line 77
Quoted 4 lines
package/nfs-utils/nfs-utils.mk +3
-0+ NFS_UTILS_POST_INSTALL_TARGET_HOOKS += NFS_UTILS_INSTALL_FIXUP +ifeq ($(BR2_PACKAGE_NFS_UTILS_NFS4),y) + NFS_UTILS_POST_INSTALL_TARGET_HOOKS += NFS_UTILS_INSTALL_IDMAPD_CONF
Please don't indent.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/2 package/libnfsidmap: new package
In reply to kostap at marvell.comHello Kostya,
Quoted 3 lines · On Wed, 6 Feb 2019 18:06:00 +0200 <[email protected]> wrote:
From: Konstantin Porotchkin <[email protected]>
Reqired for NFSv4 support.
Required
Quoted 2 lines
Taken from git at github.com:openstack/manila-test-image.git /patches/nfs-utils-enable-nfsv4.patch
What is taken from there ?
Quoted 4 lines
package/Config.in | 1 + package/libnfsidmap/Config.in | 7 +++++++ package/libnfsidmap/libnfsidmap.mk | 13 +++++++++++++ 3 files changed, 21 insertions(+)
An entry to the DEVELOPERS file should be added, and a .hash file is needed.
package/libnfsidmap/Config.in line 2
Quoted 8 lines
package/libnfsidmap/Config.in new file +2
-0@@ -0,0 +1,7 @@ +config BR2_PACKAGE_LIBNFSIDMAP + bool "libnfsidmap"
No dependencies at all ? Did you test this package with ./utils/test-pkg ?
package/libnfsidmap/Config.in line 7
Quoted 5 lines
package/libnfsidmap/Config.in new file +5
-0+ help + Library used by the NFSv4 server to do userid mapping. + + http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap +
Unneeded empty new line at the end of the file.
package/libnfsidmap/libnfsidmap.mk line 3
Quoted 9 lines
package/libnfsidmap/libnfsidmap.mk new file +3
-0@@ -0,0 +1,13 @@ +# +# libnfsidmap +#
Please use the standard header for packages.
package/libnfsidmap/libnfsidmap.mk line 7
Quoted 4 lines
package/libnfsidmap/libnfsidmap.mk new file +4
-0+ +LIBNFSIDMAP_VERSION = 0.25 +LIBNFSIDMAP_SITE = http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap +LIBNFSIDMAP_SOURCE = libnfsidmap-$(LIBNFSIDMAP_VERSION).tar.gz
Not needed, this is the default value. Have you run "make check-package" ?
package/libnfsidmap/libnfsidmap.mk line 9
Quoted 2 lines
package/libnfsidmap/libnfsidmap.mk new file +2
-0+LIBNFSIDMAP_INSTALL_STAGING = YES +LIBNFSIDMAP_LICENSE = BSD-like
This is not a proper license, see https://spdx.org/licenses/ for a proper list of SPDX license codes.
package/libnfsidmap/libnfsidmap.mk line 13
Quoted 4 lines
package/libnfsidmap/libnfsidmap.mk new file +4
-0+LIBNFSIDMAP_LICENSE_FILES = COPYING + +$(eval $(autotools-package)) +$(eval $(host-autotools-package))
You're not using the host version of this package, so it shouldn't be added.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hi, Thomas,
Quoted 18 lines
-----Original Message-----
From: Thomas Petazzoni <[email protected]>
Sent: Wednesday, February 6, 2019 18:16
To: Kostya Porotchkin <[email protected]>
Cc: buildroot at buildroot.org
Subject: [EXT] Re: [Buildroot] [PATCH 1/2] package/libnfsidmap: new packageExternal Email
----------------------------------------------------------------------
Hello Kostya,Quoted 2 lines · On Wed, 6 Feb 2019 18:06:00 +0200 <[email protected]> wrote:
From: Konstantin Porotchkin <[email protected]>
Quoted 8 lines
Quoted 1 line
Reqired for NFSv4 support.
Required
Quoted 2 lines
Taken from git at github.com:openstack/manila-test-image.git /patches/nfs-utils-enable-nfsv4.patch
What is taken from there ?
[KP] Someone already made this package, but not submitted to the mainline So I do not know the author, probably it was ported from 2011 patch series...
Quoted 7 lines
Quoted 5 lines
package/Config.in | 1 + package/libnfsidmap/Config.in | 7 +++++++ package/libnfsidmap/libnfsidmap.mk | 13 +++++++++++++ 3 files changed, 21 insertions(+)An entry to the DEVELOPERS file should be added, and a .hash file is needed.
[KP] OK
Quoted 12 lines
package/libnfsidmap/Config.in line 2
Quoted 10 lines
(quoted diff) +0
-0b/package/libnfsidmap/Config.in new file mode 100644 index 0000000000..12dbf505a5
package/libnfsidmap/Config.in new file +2
-0@@ -0,0 +1,7 @@ +config BR2_PACKAGE_LIBNFSIDMAP + bool "libnfsidmap"No dependencies at all ? Did you test this package with ./utils/test-pkg ?
[KP] Not, sorry, will do it.
Quoted 8 lines
package/libnfsidmap/Config.in line 7
Quoted 6 lines
package/libnfsidmap/Config.in new file +5
-0+ help + Library used by the NFSv4 server to do userid mapping. + + http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap +Unneeded empty new line at the end of the file.
[KP] OK
Quoted 13 lines
package/libnfsidmap/libnfsidmap.mk line 3
Quoted 11 lines
package/libnfsidmap/libnfsidmap.mk new file +3
-0@@ -0,0 +1,13 @@ +# +# libnfsidmap +#Please use the standard header for packages.
[KP] OK
Quoted 8 lines
package/libnfsidmap/libnfsidmap.mk line 7
Quoted 6 lines
package/libnfsidmap/libnfsidmap.mk new file +5
-0+ +LIBNFSIDMAP_VERSION = 0.25 +LIBNFSIDMAP_SITE = +http://www.citi.umich.edu/projects/nfsv4/linux/libnfsidmap +LIBNFSIDMAP_SOURCE = libnfsidmap-$(LIBNFSIDMAP_VERSION).tar.gzNot needed, this is the default value. Have you run "make check-package" ?
[KP] Not, sorry again, just tried to add these 2 patches as a quick fix to the NFSv4 support requirement
Quoted 6 lines
package/libnfsidmap/libnfsidmap.mk line 9
Quoted 3 lines
package/libnfsidmap/libnfsidmap.mk new file +2
-0+LIBNFSIDMAP_INSTALL_STAGING = YES +LIBNFSIDMAP_LICENSE = BSD-likeThis is not a proper license, see https://spdx.org/licenses/ for a proper list of SPDX license codes.
[KP] OK, will fix
Quoted 7 lines
package/libnfsidmap/libnfsidmap.mk line 13
Quoted 5 lines
package/libnfsidmap/libnfsidmap.mk new file +4
-0+LIBNFSIDMAP_LICENSE_FILES = COPYING + +$(eval $(autotools-package)) +$(eval $(host-autotools-package))You're not using the host version of this package, so it shouldn't be added.
[KP] I used it for host build, but later found this unnecessary and did not remove the reminder
Quoted 4 lines
Thanks!
Thomas
[KP] Thank you for review and sorry for lazy patches - I did not have time to invest into them yet.
Regards
Kosta
Quoted 4 lines
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com