Skip to contentSkip to conversation

split nfsroot rpc start code

PATCH In review Dave Young 2 participants 10 messages Feb 1, 2012 6 messages not in the archive

lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH v2 1/2 split nfsroot rpc start code

fstab-sys will mount nonroot nfs as well, so we need to split the necessary code from nfsroot to start rpc daemon as hook script.

---
 modules.d/95nfs/module-setup.sh  |    1 +
 modules.d/95nfs/nfs-start-rpc.sh |   17 +++++++++++++++++
 modules.d/95nfs/nfsroot          |   15 ---------------
 3 files changed, 18 insertions(+), 15 deletions(-)
modules.d/95nfs/module-setup.sh +1 -0
Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================
@@ -57,6 +57,7 @@ install() {
     dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
     inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"
     inst_hook pre-pivot 99 "$moddir/nfsroot-cleanup.sh"
     inst "$moddir/nfsroot" "/sbin/nfsroot"
     mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
modules.d/95nfs/nfs-start-rpc.sh new file +17 -0
Index: dracut/modules.d/95nfs/nfs-start-rpc.sh
===================================================================
@@ -0,0 +1,17 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# Start rpcbind or rpcbind
+# FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
+command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
+command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ] && rpcbind
+
+[ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
+    mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
+
+# Start rpc.statd as mount won't let us use locks on a NFSv4
+# filesystem without talking to it. NFSv4 does locks internally,
+# rpc.lockd isn't needed
+[ -z "$(pidof rpc.statd)" ] && rpc.statd
+[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
modules.d/95nfs/nfsroot +0 -15
Index: dracut/modules.d/95nfs/nfsroot
===================================================================
@@ -84,22 +84,7 @@ getarg rw && nfsrw=rw
 
 options=${options:+$options,}$nfsrw
 
-# Start rpcbind or rpcbind
-# FIXME occasionally saw 'rpcbind: fork failed: No such device' -- why?
-command -v portmap >/dev/null && [ -z "$(pidof portmap)" ] && portmap
-command -v rpcbind >/dev/null && [ -z "$(pidof rpcbind)" ] && rpcbind
-
 if [ "$nfs" = "nfs4" ]; then
-    [ ! -d /var/lib/nfs/rpc_pipefs/nfs ] && \
-         mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
-
-    # Start rpc.statd as mount won't let us use locks on a NFSv4
-    # filesystem without talking to it. NFSv4 does locks internally,
-    # rpc.lockd isn't needed
-    [ -z "$(pidof rpc.statd)" ] && rpc.statd
-
-    [ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
-
     # XXX Should we loop here?
     mount -t nfs4 -o$options${nfslock+,$nfslock} \
         $server:$path $NEWROOT \
#1 lore raw
Quoted 4 lines · Dave Young

fstab-sys will mount nonroot nfs as well, so we need to split the necessary code from nfsroot to start rpc daemon as hook script.

Why not Cc me who reviewed your V1 patches? :-/

Quoted 11 lines
---
 modules.d/95nfs/module-setup.sh  |    1 +
 modules.d/95nfs/nfs-start-rpc.sh |   17 +++++++++++++++++
 modules.d/95nfs/nfsroot          |   15 ---------------
 3 files changed, 18 insertions(+), 15 deletions(-)

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh install() { · line 60

Quoted 4 lines
modules.d/95nfs/module-setup.sh +1 -0
@@ -57,6 +57,7 @@ install() {
     dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
     inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

author
#2 lore raw
Quoted 7 lines · Cong Wang
Quoted 4 lines · Dave Young

fstab-sys will mount nonroot nfs as well, so we need to split the necessary code from nfsroot to start rpc daemon as hook script.

Why not Cc me who reviewed your V1 patches? :-/

Hehe, Will do next time.
I assume you will monitor dracut list. sorry about the lazy.

Quoted 14 lines
Quoted 14 lines
---
 modules.d/95nfs/module-setup.sh  |    1 +
 modules.d/95nfs/nfs-start-rpc.sh |   17 +++++++++++++++++
 modules.d/95nfs/nfsroot          |   15 ---------------
 3 files changed, 18 insertions(+), 15 deletions(-)

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +0 -0
@@ -57,6 +57,7 @@ install() {
     dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
Quoted 4 lines

modules.d/95nfs/module-setup.sh install() { · line 60

Quoted 2 lines
modules.d/95nfs/module-setup.sh +1 -0
     inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

I want to start them as early as we can, I always think about user use dracut as a minimal recovery system, they need do something manually.

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks
Dave
#4 lore raw
In reply to a message not in the archive
Quoted 9 lines · Dave Young
Quoted 8 lines · Cong Wang
Quoted 7 lines · Dave Young

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +0 -0
@@ -57,6 +57,7 @@ install() {
      dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
Quoted 9 lines
Quoted 4 lines

modules.d/95nfs/module-setup.sh install() { · line 60

Quoted 2 lines
modules.d/95nfs/module-setup.sh +1 -0
      inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

I want to start them as early as we can, I always think about user use dracut as a minimal recovery system, they need do something manually.

Then install it as pre-pivot 00.

Do one thing at one time, I know this patch now is for kdump. If you really need a minimal recovery system, do that later. :)

author
#6 lore raw
In reply to a message not in the archive
Quoted 17 lines · Cong Wang
Quoted 16 lines · Dave Young
Quoted 13 lines · Cong Wang

modules.d/95nfs/module-setup.sh install() { · line 61

Quoted 10 lines · Dave Young

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +1 -0
@@ -57,6 +57,7 @@ install() {
      dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so
 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
      inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

Quoted 5 lines
Quoted 3 lines

I want to start them as early as we can, I always think about user use dracut as a minimal recovery system, they need do something manually.

Then install it as pre-pivot 00.

What if I use rdbreak=point which is before pre-pivot?

Quoted 3 lines

Do one thing at one time, I know this patch now is for kdump. If you really need a minimal recovery system, do that later. :)

Signature · 2 lines
Thanks
Dave
author
#8 lore raw
In reply to a message not in the archive
Quoted 19 lines · Dave Young
Quoted 17 lines · Cong Wang
Quoted 16 lines · Dave Young
Quoted 13 lines · Cong Wang

modules.d/95nfs/module-setup.sh install() { · line 61

Quoted 10 lines · Dave Young

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +1 -0
@@ -57,6 +57,7 @@ install() {
      dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so
 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
      inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

Quoted 12 lines
Quoted 5 lines
Quoted 3 lines

I want to start them as early as we can, I always think about user use dracut as a minimal recovery system, they need do something manually.

Then install it as pre-pivot 00.

What if I use rdbreak=point which is before pre-pivot?

Quoted 3 lines

Do one thing at one time, I know this patch now is for kdump. If you really need a minimal recovery system, do that later. :)

Generally it's right, but for this issue they are not conflict. I'd like to think it as a general feature and do not assume it's only for kdump.

Signature · 2 lines
Thanks
Dave
#9 lore raw
In reply to a message not in the archive
Quoted 19 lines · Dave Young
Quoted 17 lines · Cong Wang
Quoted 16 lines · Dave Young
Quoted 13 lines · Cong Wang

modules.d/95nfs/module-setup.sh install() { · line 61

Quoted 10 lines · Dave Young

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +1 -0
@@ -57,6 +57,7 @@ install() {
       dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so
 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
       inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

I want to start them as early as we can, I always think about user use dracut as a minimal recovery system, they need do something manually.

Then install it as pre-pivot 00.

What if I use rdbreak=point which is before pre-pivot?

Take a look at all existing cmdline hooks, all of them handle cmdline, but nfs-start-rpc doesn't, so not cmdline hook please. You are abusing cmdline hooks.

author
#11 lore raw
In reply to a message not in the archive
Quoted 28 lines · Cong Wang
Quoted 27 lines · Dave Young
Quoted 23 lines · Cong Wang
Quoted 11 lines · Dave Young
Quoted 10 lines · Cong Wang
Quoted 8 lines · Dave Young

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +0 -0
@@ -57,6 +57,7 @@ install() {
       dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so
 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
Quoted 9 lines
Quoted 4 lines

modules.d/95nfs/module-setup.sh install() { · line 61

Quoted 2 lines
modules.d/95nfs/module-setup.sh +1 -0
       inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

I want to start them as early as we can, I always think about user use dracut as a minimal recovery system, they need do something manually.

Then install it as pre-pivot 00.

Quoted 6 lines
Quoted 2 lines

What if I use rdbreak=point which is before pre-pivot?

Take a look at all existing cmdline hooks, all of them handle cmdline, but nfs-start-rpc doesn't, so not cmdline hook please. You are abusing cmdline hooks.

Maybe current cmdline hooks all deal with cmdline things, but as my understand cmdline hook point is just a point for injecting anything we need to handle at this point.

Signature · 2 lines
Thanks
Dave
#13 lore raw
In reply to a message not in the archive
Quoted 39 lines · Dave Young
Quoted 28 lines · Cong Wang
Quoted 27 lines · Dave Young
Quoted 23 lines · Cong Wang
Quoted 11 lines · Dave Young
Quoted 10 lines · Cong Wang
Quoted 8 lines · Dave Young

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +0 -0
@@ -57,6 +57,7 @@ install() {
        dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so
 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
Quoted 9 lines
Quoted 4 lines

modules.d/95nfs/module-setup.sh install() { · line 61

Quoted 2 lines
modules.d/95nfs/module-setup.sh +1 -0
        inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

I want to start them as early as we can, I always think about user use dracut as a minimal recovery system, they need do something manually.

Then install it as pre-pivot 00.

Quoted 6 lines
Quoted 2 lines

What if I use rdbreak=point which is before pre-pivot?

Take a look at all existing cmdline hooks, all of them handle cmdline, but nfs-start-rpc doesn't, so not cmdline hook please. You are abusing cmdline hooks.

Quoted 3 lines

Maybe current cmdline hooks all deal with cmdline things, but as my understand cmdline hook point is just a point for injecting anything we need to handle at this point.

If you think pre-pivot is too late, then try other hooks, e.g. pre-mount, pre-udev. Anyhow, cmdline is definitely not the place.

author
#15 lore raw
In reply to a message not in the archive
Quoted 41 lines · Cong Wang
Quoted 40 lines · Dave Young
Quoted 35 lines · Cong Wang
Quoted 25 lines · Dave Young
Quoted 23 lines · Cong Wang
Quoted 21 lines · Dave Young
Quoted 10 lines · Cong Wang
Quoted 8 lines · Dave Young

Index: dracut/modules.d/95nfs/module-setup.sh
===================================================================

modules.d/95nfs/module-setup.sh +0 -0
@@ -57,6 +57,7 @@ install() {
        dracut_install $(for _i in $(ls {/usr,}$libdir/libnss*.so
 2>/dev/null); do echo $_i;done | egrep "$_nsslibs")
 
Quoted 4 lines

modules.d/95nfs/module-setup.sh install() { · line 61

Quoted 2 lines
modules.d/95nfs/module-setup.sh +1 -0
        inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+    inst_hook cmdline 91 "$moddir/nfs-start-rpc.sh"

I am sure this is wrong. You need pre-pivot.

I want to start them as early as we can, I always think about user use
dracut as a minimal recovery system, they need do something manually.

Quoted 5 lines
Quoted 1 line

Then install it as pre-pivot 00.

What if I use rdbreak=point which is before pre-pivot?

Take a look at all existing cmdline hooks, all of them handle cmdline, but nfs-start-rpc doesn't, so not cmdline hook please. You are abusing cmdline hooks.

Quoted 7 lines
Quoted 3 lines

Maybe current cmdline hooks all deal with cmdline things, but as my understand cmdline hook point is just a point for injecting anything we need to handle at this point.

If you think pre-pivot is too late, then try other hooks, e.g. pre-mount, pre-udev. Anyhow, cmdline is definitely not the place.

Sigh, Ok. I will test pre-udev

Signature · 2 lines
Thanks
Dave