Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] mkinitcpio-nfs-utils: support NFSv4 roots
@ 2023-01-10 16:00 ahesford
  2023-01-10 17:24 ` [PR PATCH] [Updated] " ahesford
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ahesford @ 2023-01-10 16:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

There is a new pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages nfsroot
https://github.com/void-linux/void-packages/pull/41560

mkinitcpio-nfs-utils: support NFSv4 roots
The `net` hook for `mkinitcpio` shipped by this package uses a helper to do v2 or v3 mounts that support locking without the need for a local `lockd` in the initramfs. The helper does not support v4 mounts and v4 does not require a local `lockd`, so we can look for an NFS version requirement in the root spec and directly call `mount -t nfs4` instead of `nfsmount` to support v4 roots.

#### Testing the changes
- I tested the changes in this PR: **in progress**

A patch file from https://github.com/void-linux/void-packages/pull/41560.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-nfsroot-41560.patch --]
[-- Type: text/x-diff, Size: 2646 bytes --]

From f38036e6d2d1ba72fe247fbd2f40ae784e38e583 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 10 Jan 2023 10:57:51 -0500
Subject: [PATCH] mkinitcpio-nfs-utils: support NFSv4 roots

---
 .../mkinitcpio-nfs-utils/files/initcpio-hook-net    | 13 ++++++++++++-
 .../mkinitcpio-nfs-utils/files/initcpio-install-net |  2 ++
 srcpkgs/mkinitcpio-nfs-utils/template               |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
index 4d1ebb95605e..33382d95b728 100644
--- a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
+++ b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
@@ -84,7 +84,18 @@ nfs_mount_handler() {
         launch_interactive_shell
         msg "Trying to continue (this will most likely fail) ..."
     fi
-    nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"
+
+    # nfsmount avoids problems with lockd for v2 and v3 but does not support v4;
+    # to support v4 roots, examine mount options for a v4 version spec and use
+    # the ordinary mount program. v4 doesn't need lockd for file locking anyway.
+    mount_cmd=nfsmount
+    case "${nfs_option}" in
+        nfsvers=4*|*,nfsvers=4*|vers=4*|*,vers=4*)
+            command -v mount.nfs4 >/dev/null 2>&1 && mount_cmd="mount -t nfs4"
+            ;;
+    esac
+
+    ${mount_cmd} ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"
 }
 
 # vim: set ft=sh ts=4 sw=4 et:
diff --git a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
index 79b678949c95..153767add8c5 100644
--- a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
+++ b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
@@ -3,9 +3,11 @@
 build() {
     add_checked_modules '/drivers/net/'
     add_module nfsv3?
+    add_module nfsv4?
 
     add_binary "/usr/lib/initcpio/ipconfig" "/bin/ipconfig"
     add_binary "/usr/lib/initcpio/nfsmount" "/bin/nfsmount"
+    command -v mount.nfs4 >/dev/null 2>&1 && add_binary "mount.nfs4"
 
     add_runscript
 }
diff --git a/srcpkgs/mkinitcpio-nfs-utils/template b/srcpkgs/mkinitcpio-nfs-utils/template
index 7f36e1cf7fdf..05664525ebfe 100644
--- a/srcpkgs/mkinitcpio-nfs-utils/template
+++ b/srcpkgs/mkinitcpio-nfs-utils/template
@@ -1,7 +1,7 @@
 # Template file for 'mkinitcpio-nfs-utils'
 pkgname=mkinitcpio-nfs-utils
 version=0.3
-revision=3
+revision=4
 build_style=gnu-makefile
 depends="mkinitcpio"
 short_desc="Ipconfig and nfsmount tools for NFS root support in mkinitcpio"

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-11  2:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 16:00 [PR PATCH] mkinitcpio-nfs-utils: support NFSv4 roots ahesford
2023-01-10 17:24 ` [PR PATCH] [Updated] " ahesford
2023-01-10 18:04 ` ahesford
2023-01-11  2:35 ` [PR PATCH] [Merged]: " ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).