From patchwork Wed Feb 6 16:06:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kostya Porotchkin X-Patchwork-Id: 1037616 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=marvell.com header.i=@marvell.com header.b="N8XKPcrd"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43vmX168jVz9sLw for ; Thu, 7 Feb 2019 03:06:09 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 64EC987E1B; Wed, 6 Feb 2019 16:06:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w-zx0FyblOaW; Wed, 6 Feb 2019 16:06:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 9DA3087D8B; Wed, 6 Feb 2019 16:06:02 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BA9C41BF311 for ; Wed, 6 Feb 2019 16:05:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B5F1888661 for ; Wed, 6 Feb 2019 16:05:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GvvBNBqxR3HO for ; Wed, 6 Feb 2019 16:05:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by hemlock.osuosl.org (Postfix) with ESMTPS id EE5738862D for ; Wed, 6 Feb 2019 16:05:58 +0000 (UTC) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x16G18Sv019946 for ; Wed, 6 Feb 2019 08:05:58 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=tU7nBKdWc9y2mt1yQoPP3hNedkHwuAPrl7jqBUoScXk=; b=N8XKPcrd8qfKIyLu0FtO6HDsBLXwdZeI7wPT16fatJUl4+3wzL79xKXxkM75/AfTzLHc bo8Qm2aSunb6PcEjVs59NquHM7A+Stivd7lSyNSi9idgZETb88/xFI6QO70e2rD1PsC2 MIlk17GUDfm146rJgluWu3ry8Hd7/hxu1dXE0mTfk/66OY+NZpSEcwcSnFsvOYIlrBju P4mQVmiOcVVGJnI2Ina6N4qMCg8YBmdgnfXLy5PEzfYup72oVBRtN5YhPfr3ekr3Qe1w 5FC882286/C/yf5+fv78mo8tuVBN6i2fBWrrGeqe1mMn7NGXzVTowwDhGle4B0JfHFpc XA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2qfc2avk4b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 06 Feb 2019 08:05:57 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 6 Feb 2019 08:05:56 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 6 Feb 2019 08:05:56 -0800 Received: from malogato.marvell.com (malogato.marvell.com [10.5.24.38]) by maili.marvell.com (Postfix) with ESMTP id 9324E3F703F; Wed, 6 Feb 2019 08:05:55 -0800 (PST) From: To: Date: Wed, 6 Feb 2019 18:06:01 +0200 Message-ID: <20190206160601.6360-2-kostap@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190206160601.6360-1-kostap@marvell.com> References: <20190206160601.6360-1-kostap@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-06_10:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=15 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=831 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902060124 Subject: [Buildroot] [PATCH 2/2] package/nfs-utils: enable support of NFSv4 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Konstantin Porotchkin Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Konstantin Porotchkin Taken from git@github.com:openstack/manila-test-image.git /patches/nfs-utils-enable-nfsv4.patch Signed-off-by: Konstantin Porotchkin --- 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 diff --git a/package/nfs-utils/Config.in b/package/nfs-utils/Config.in index 055b711f0d..08c0f4caae 100644 --- a/package/nfs-utils/Config.in +++ b/package/nfs-utils/Config.in @@ -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 diff --git a/package/nfs-utils/S60nfs b/package/nfs-utils/S60nfs index 4183ff6268..bec7307653 100755 --- a/package/nfs-utils/S60nfs +++ b/package/nfs-utils/S60nfs @@ -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}" diff --git a/package/nfs-utils/etc-idmapd.conf b/package/nfs-utils/etc-idmapd.conf new file mode 100644 index 0000000000..0288c0ce03 --- /dev/null +++ b/package/nfs-utils/etc-idmapd.conf @@ -0,0 +1,9 @@ +[General] +Verbosity = 0 +Pipefs-Directory = /var/lib/nfs/rpc_pipefs +Domain = localdomain + +[Mapping] +Nobody-User = nobody +Nobody-Group = nogroup + diff --git a/package/nfs-utils/nfs-utils.mk b/package/nfs-utils/nfs-utils.mk index 9fa7ae200b..517ec19bea 100644 --- a/package/nfs-utils/nfs-utils.mk +++ b/package/nfs-utils/nfs-utils.mk @@ -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