Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions net/nfs-kernel-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=nfs-kernel-server
PKG_VERSION:=2.8.7
PKG_VERSION:=2.9.1
PKG_RELEASE:=1
PKG_HASH:=59d0f1e17b18efaa60ea3ccf89a9cad3217f8d3b23c18d2fe34b25c8969d60ae
PKG_HASH:=302846343bf509f8f884c23bdbd0fe853b7f7cbb6572060a9082279d13b21a2c

PKG_SOURCE:=nfs-utils-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/nfs-utils/$(PKG_VERSION)
Expand All @@ -21,8 +21,8 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/nfs-utils-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/nfs-utils-$(PKG_VERSION)
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=$(PKG_NAME)/host libevent2
HOST_BUILD_DEPENDS:=libtirpc/host
PKG_BUILD_DEPENDS:=$(PKG_NAME)/host libevent2 libnl
HOST_BUILD_DEPENDS:=libtirpc/host libnl/host
PKG_CONFIG_DEPENDS:=CONFIG_IPV6

include $(INCLUDE_DIR)/host-build.mk
Expand All @@ -47,7 +47,7 @@ endef
define Package/nfs-kernel-server
$(call Package/nfs-kernel-server/Default)
TITLE:=Kernel NFS server (NFSv3)
DEPENDS+= +kmod-fs-nfsd +kmod-fs-nfs +rpcbind
DEPENDS+= +kmod-fs-nfsd +kmod-fs-nfs +rpcbind +libevent2-core +libreadline
VARIANT:=v3
USERID:=nfs:nfs
CONFLICTS:=nfs-kernel-server-v4
Expand Down Expand Up @@ -133,7 +133,8 @@ ifeq ($(BUILD_VARIANT),v3)
--disable-nfsv4server \
--disable-nfsv4 \
--disable-nfsv41 \
--disable-nfsv42
--disable-nfsv42 \
--enable-nfsdctl
endif

ifeq ($(BUILD_VARIANT),v4)
Expand Down Expand Up @@ -222,18 +223,20 @@ endef

define Package/nfs-kernel-server/install
$(INSTALL_DIR) $(1)/etc/config $(1)/usr/sbin $(1)/etc/init.d
$(INSTALL_DATA) ./files/nfsd.v3.exports $(1)/etc/exports
$(INSTALL_DATA) ./files/nfsd.exports $(1)/etc/exports
$(INSTALL_DATA) ./files/nfsd.v3.nfs.conf $(1)/etc/nfs.conf
$(INSTALL_BIN) ./files/nfsd.v3.init $(1)/etc/init.d/nfsd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/sm-notify $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/statd $(1)/usr/sbin/rpc.statd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsd/nfsd $(1)/usr/sbin/rpc.nfsd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/mountd/mountd $(1)/usr/sbin/rpc.mountd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/exportfs/exportfs $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsdctl/nfsdctl $(1)/usr/sbin/
endef

define Package/nfs-kernel-server-v4/install
$(INSTALL_DIR) $(1)/etc/config $(1)/usr/sbin $(1)/etc/init.d
$(INSTALL_DATA) ./files/nfsd.v4.exports $(1)/etc/exports
$(INSTALL_DATA) ./files/nfsd.exports $(1)/etc/exports
$(INSTALL_BIN) ./files/nfsd.v4.init $(1)/etc/init.d/nfsd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/sm-notify $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsd/nfsd $(1)/usr/sbin/rpc.nfsd
Expand Down
4 changes: 0 additions & 4 deletions net/nfs-kernel-server/files/nfsd.v3.exports

This file was deleted.

29 changes: 17 additions & 12 deletions net/nfs-kernel-server/files/nfsd.v3.init
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,46 @@ START=99
STOP=60
USE_PROCD=1

CONFIG_FILE="/etc/config/nfsd"
NFS_D=/var/lib/nfs
RECOVERY_D=$NFS_D/v4recovery
LOCK_D=/var/lib/nfs/sm
VAR_NFS=/var/lib/nfs

start_service() {
logger -t "nfsd" -p notice "Starting the NFSV3 daemon"
logger -t "nfsd" -p notice "Starting the NFSv3 daemon"
grep -q /proc/fs/nfsd /proc/mounts || \
mount -t nfsd nfsd /proc/fs/nfsd
mkdir -p "$NFS_D" "$RECOVERY_D" "$LOCK_D" "$VAR_NFS"
chown nfs:nfs "$VAR_NFS"
mkdir -p "$NFS_D" "$LOCK_D"
chown nfs:nfs "$NFS_D"
touch "$NFS_D/rmtab"

sysctl -w fs.nfs.nlm_tcpport=32777 fs.nfs.nlm_udpport=32777 > /dev/null

procd_open_instance
procd_open_instance "statd"
procd_set_param command /usr/sbin/rpc.statd -p 32778 -o 32779 -F
procd_set_param respawn
procd_close_instance

/usr/sbin/exportfs -r
/usr/sbin/rpc.nfsd --grace-time 10
/usr/sbin/nfsdctl autostart || /usr/sbin/rpc.nfsd --grace-time 10 --no-nfs-version 4

procd_open_instance
procd_open_instance "mountd"
procd_set_param command /usr/sbin/rpc.mountd -p 32780 -F
procd_set_param respawn
procd_close_instance
}

stop_service() {
rpc.nfsd 0 2>/dev/null
/usr/sbin/nfsdctl threads 0 || /usr/sbin/rpc.nfsd 0 2>/dev/null
/usr/sbin/exportfs -au
/usr/sbin/exportfs -f
grep -q /proc/fs/nfsd /proc/mounts && umount /proc/fs/nfsd
}

reload_service() {
/usr/sbin/exportfs -r
}

service_triggers() {
export_dirs="$(while read -r mp _r; do echo "$mp "; done < /etc/exports)"
procd_add_reload_mount_trigger "$export_dirs"
procd_add_reload_trigger "nfsd"
export_dirs="$(awk 'NF && !/^#/ {print $1}' /etc/exports)"
procd_add_reload_mount_trigger $export_dirs
}
98 changes: 98 additions & 0 deletions net/nfs-kernel-server/files/nfsd.v3.nfs.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#
# This is a general configuration for the
# NFS daemons and tools
#
[general]
# pipefs-directory=/var/lib/nfs/rpc_pipefs
#
[nfsrahead]
# nfs=15000
# nfs4=16000
#
[exports]
# rootdir=/export
#
[exportfs]
# debug=0
#
[gssd]
# verbosity=0
# rpc-verbosity=0
# use-memcache=0
# use-machine-creds=1
# use-gss-proxy=0
# avoid-dns=1
# allowed-enctypes=aes256-cts-hmac-sha384-192,aes128-cts-hmac-sha256-128,camellia256-cts-cmac,camellia128-cts-cmac,aes256-cts-hmac-sha1-96,aes128-cts-hmac-sha1-96
# context-timeout=0
# rpc-timeout=5
# keytab-file=/etc/krb5.keytab
# cred-cache-directory=
# preferred-realm=
# set-home=1
# upcall-timeout=30
# cancel-timed-out-upcalls=0
#
[lockd]
# port=0
# udp-port=0
#
[exportd]
# debug="all|auth|call|general|parse"
# manage-gids=n
# state-directory-path=/var/lib/nfs
# threads=1
# cache-use-ipaddr=n
# ttl=1800
[mountd]
# debug="all|auth|call|general|parse"
# apply-root-cred=n
# manage-gids=n
# descriptors=0
# port=0
# threads=1
# reverse-lookup=n
# state-directory-path=/var/lib/nfs
# ha-callout=
# cache-use-ipaddr=n
# ttl=1800
#
[nfsdcld]
# debug=0
# storagedir=/var/lib/nfs/nfsdcld
#
[nfsd]
# debug=0
# threads=16
# host=
# port=0
# grace-time=90
# lease-time=90
# udp=n
# tcp=y
vers3=y
vers4=n
vers4.0=n
vers4.1=n
vers4.2=n
# fh-key-file=/etc/nfs_fh.key

[statd]
# debug=0
# port=0
# outgoing-port=0
# name=
# state-directory-path=/var/lib/nfs/statd
# ha-callout=
# no-notify=0
#
[sm-notify]
# debug=0
# force=0
# retry-time=900
# outgoing-port=
# outgoing-addr=
# lift-grace=y
#
[svcgssd]
# principal=

26 changes: 22 additions & 4 deletions net/nfs-kernel-server/files/nfsd.v4.init
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ USE_PROCD=1
CONFIG_FILE="/etc/config/nfsd"
NFS_D=/var/lib/nfs
RPC_PIPEFS_D=/var/lib/nfs/rpc_pipefs
NFSDCLD_PID=/var/run/nfsdcld.pid

start_service() {
logger -t "nfsd" -p notice "Starting the NFSV4 daemon"
Expand All @@ -20,22 +19,23 @@ start_service() {
grep -q "$RPC_PIPEFS_D" /proc/mounts || mount -t rpc_pipefs sunrpc "$RPC_PIPEFS_D"

procd_open_instance
procd_set_param command /usr/sbin/nfsv4.exportd -f
procd_set_param command /usr/sbin/nfsv4.exportd -f -L
procd_set_param respawn
procd_close_instance

procd_open_instance
procd_set_param command /usr/sbin/rpc.idmapd -f
procd_set_param respawn
procd_close_instance

procd_open_instance
procd_set_param command /usr/sbin/nfsdcld
procd_append_param -F
procd_close_instance

/usr/sbin/exportfs -r

procd_open_instance
procd_set_param command /usr/sbin/rpc.nfsd -N 3
procd_set_param command /usr/sbin/rpc.nfsd -N 3 -V 4.0
procd_close_instance
}

Expand All @@ -51,6 +51,24 @@ stop_service() {
) &
}

status_service() {
local n_running=0
local n_total=3
pgrep -x nfsv4.exportd > /dev/null && n_running=$((n_running + 1))
pgrep -x rpc.idmapd > /dev/null && n_running=$((n_running + 1))
pgrep -x nfsdcld > /dev/null && n_running=$((n_running + 1))
if [ "$n_running" -eq "$n_total" ]; then
echo "running"
return 0
elif [ "$n_running" -gt 0 ]; then
echo "running ($n_running/$n_total)"
return 0
else
echo "not running"
return 5
fi
}

service_triggers() {
export_dirs="$(while read -r mp _r; do echo "$mp "; done < /etc/exports)"
procd_add_reload_mount_trigger "$export_dirs"
Expand Down
4 changes: 2 additions & 2 deletions net/nfs-kernel-server/patches/100-fix-host-build.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -363,9 +363,6 @@ CPPFLAGS="${nfsutils_save_CPPFLAGS}"
@@ -369,9 +369,6 @@ CPPFLAGS="${nfsutils_save_CPPFLAGS}"
AC_CHECK_HEADER(uuid/uuid.h, ,
AC_MSG_ERROR([Cannot find needed header file uuid/uuid.h. Install libuuid-devel]))

Expand All @@ -10,7 +10,7 @@
dnl Check for sqlite3
AC_SQLITE3_VERS

@@ -445,9 +442,6 @@ if test "$enable_gss" = yes; then
@@ -451,9 +448,6 @@ if test "$enable_gss" = yes; then
dnl 'gss' requires getnameinfo - at least for gssd_proc.c
AC_CHECK_FUNC([getnameinfo], , [AC_MSG_ERROR([GSSAPI support requires 'getnameinfo' function])])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ environment.

--- a/utils/exportd/exportd.c
+++ b/utils/exportd/exportd.c
@@ -51,9 +51,10 @@ static char shortopts[] = "d:fghs:t:liT:
@@ -53,9 +53,10 @@ static char shortopts[] = "d:fghs:t:liLT
/*
* Signal handlers.
*/
Expand Down
Loading