| Summary: | Need to load NFS client LKM. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | quinot <quinot> | ||||
| Component: | conf | Assignee: | Sheldon Hearn <sheldonh> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 5.0-CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
quinot
2001-10-18 19:00:02 UTC
Attached to this email is an update to the patch supplied with PR
conf/31358, which fixes two issues:
* amd can only be started when NFS client is enabled;
* when nfs_client_enable is set and no NFS file systems are mounted
at boot time from /etc/fstab, rc.network needs to ensure that the
nfsclient module is loaded.
Can someone please take a look at this PR?
Thanks,
Thomas.
diff -u ../rc rc
--- ../rc Tue Jan 8 10:11:48 2002
+++ rc Tue Jan 8 10:42:38 2002
@@ -103,6 +103,7 @@
}
chkdepend amd amd_enable portmap portmap_enable
+chkdepend amd amd_enable NFS nfs_client_enable
chkdepend NFS nfs_server_enable portmap portmap_enable
chkdepend NIS nis_server_enable portmap portmap_enable
chkdepend NIS nis_client_enable portmap portmap_enable
diff -u ../rc.network rc.network
--- ../rc.network Tue Jan 8 10:11:48 2002
+++ rc.network Tue Jan 8 10:57:58 2002
@@ -712,8 +712,30 @@
;;
esac
+ # Handle absent nfs client support
+ if sysctl vfs.nfs >/dev/null 2>&1; then
+ nfsclient_in_kernel=1
+ else
+ nfsclient_in_kernel=0
+ fi
+
case ${nfs_client_enable} in
[Yy][Ee][Ss])
+ kldload nfsclient && nfsclient_in_kernel=1
+
+ case $nfsclient_in_kernel in
+ 1)
+ ;;
+ *)
+ echo 'Warning: NFS client kernel module failed to load'
+ nfs_client_enable=NO
+ ;;
+ esac
+ ;;
+ esac
+
+ case "${nfs_client_enable}" in
+ [Yy][Ee][Ss])
if [ -n "${nfs_access_cache}" ]; then
echo -n " NFS access cache time=${nfs_access_cache}"
sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
@@ -732,6 +754,27 @@
echo -n ' rpc.lockd'; rpc.lockd
;;
esac
+
+ case ${amd_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' amd'
+ case ${amd_map_program} in
+ [Nn][Oo] | '')
+ ;;
+ *)
+ amd_flags="${amd_flags} `eval\
+ ${amd_map_program}`"
+ ;;
+ esac
+
+ if [ -n "${amd_flags}" ]; then
+ amd -p ${amd_flags}\
+ > /var/run/amd.pid 2> /dev/null
+ else
+ amd 2> /dev/null
+ fi
+ ;;
+ esac
;;
esac
@@ -742,26 +785,6 @@
rpc.umntall -k
fi
- case ${amd_enable} in
- [Yy][Ee][Ss])
- echo -n ' amd'
- case ${amd_map_program} in
- [Nn][Oo] | '')
- ;;
- *)
- amd_flags="${amd_flags} `eval\
- ${amd_map_program}`"
- ;;
- esac
-
- if [ -n "${amd_flags}" ]; then
- amd -p ${amd_flags}\
- > /var/run/amd.pid 2> /dev/null
- else
- amd 2> /dev/null
- fi
- ;;
- esac
;;
esac
--
Thomas Quinot ** Département Informatique & Réseaux ** quinot@inf.enst.fr
ENST // 46 rue Barrault // 75634 PARIS CEDEX 13
On Tue, 8 Jan 2002 11:02:06 +0100 Thomas Quinot <quinot@inf.enst.fr> wrote: [snip] > + # Handle absent nfs client support > + if sysctl vfs.nfs >/dev/null 2>&1; then > + nfsclient_in_kernel=1 > + else > + nfsclient_in_kernel=0 > + fi > + This should be handled inside the case statement for ${nfs_client_enable}, as you want to load the nfsclient kld only if the nfs client is enabled. > case ${nfs_client_enable} in > [Yy][Ee][Ss]) > + kldload nfsclient && nfsclient_in_kernel=1 > + > + case $nfsclient_in_kernel in > + 1) > + ;; > + *) > + echo 'Warning: NFS client kernel module failed to load' > + nfs_client_enable=NO > + ;; > + esac > + ;; > + esac > + > + case "${nfs_client_enable}" in > + [Yy][Ee][Ss]) > if [ -n "${nfs_access_cache}" ]; then > echo -n " NFS access cache time=${nfs_access_cache}" > sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null > @@ -732,6 +754,27 @@ > echo -n ' rpc.lockd'; rpc.lockd > ;; > esac You should clean this up so there is only *one* 'case "${nfs_client_enable}"'. Look at the implementation of case ${nfs_server_enable}, earlier in rc.network for an example of how it should be done. Cheers, mike makonnen Le 2002-01-08, Mike Makonnen écrivait :
> You should clean this up so there is only *one* 'case "${nfs_client_enable}"'.
> Look at the implementation of case ${nfs_server_enable}, earlier in rc.network for an example of how it should be done.
Thanks for your feedback!
Does the following look more appropriate?
diff -u {/usr/src,}/etc/rc
--- /usr/src/etc/rc Fri Jan 4 14:35:43 2002
+++ /etc/rc Tue Jan 8 11:11:56 2002
@@ -103,6 +103,7 @@
}
chkdepend amd amd_enable portmap portmap_enable
+chkdepend amd amd_enable NFS nfs_client_enable
chkdepend NFS nfs_server_enable portmap portmap_enable
chkdepend NIS nis_server_enable portmap portmap_enable
chkdepend NIS nis_client_enable portmap portmap_enable
diff -u {/usr/src,}/etc/rc.network
--- /usr/src/etc/rc.network Fri Jan 4 14:35:44 2002
+++ /etc/rc.network Tue Jan 8 13:54:05 2002
@@ -714,24 +714,59 @@
case ${nfs_client_enable} in
[Yy][Ee][Ss])
- if [ -n "${nfs_access_cache}" ]; then
- echo -n " NFS access cache time=${nfs_access_cache}"
- sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
+ nfsclient_in_kernel=0
+ # Handle absent nfs client support
+ if sysctl vfs.nfs >/dev/null 2>&1; then
+ nfsclient_in_kernel=1
+ else
+ kldload nfsclient && nfsclient_in_kernel=1
fi
- if [ -n "${nfs_bufpackets}" ]; then
- sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
+
+ if [ $nfsclient_in_kernel -eq 1 ]
+ then
+ if [ -n "${nfs_access_cache}" ]; then
+ echo -n " NFS access cache time=${nfs_access_cache}"
+ sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
+ fi
+ if [ -n "${nfs_bufpackets}" ]; then
+ sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
+ fi
+ case ${rpc_statd_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' rpc.statd'; rpc.statd
+ ;;
+ esac
+
+ case ${rpc_lockd_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' rpc.lockd'; rpc.lockd
+ ;;
+ esac
+
+ case ${amd_enable} in
+ [Yy][Ee][Ss])
+ echo -n ' amd'
+ case ${amd_map_program} in
+ [Nn][Oo] | '')
+ ;;
+ *)
+ amd_flags="${amd_flags} `eval\
+ ${amd_map_program}`"
+ ;;
+ esac
+
+ if [ -n "${amd_flags}" ]; then
+ amd -p ${amd_flags}\
+ > /var/run/amd.pid 2> /dev/null
+ else
+ amd 2> /dev/null
+ fi
+ ;;
+ esac
+ else
+ echo 'Warning: NFS client kernel module failed to load'
+ nfs_client_enable=NO
fi
- case ${rpc_statd_enable} in
- [Yy][Ee][Ss])
- echo -n ' rpc.statd'; rpc.statd
- ;;
- esac
-
- case ${rpc_lockd_enable} in
- [Yy][Ee][Ss])
- echo -n ' rpc.lockd'; rpc.lockd
- ;;
- esac
;;
esac
@@ -742,26 +777,6 @@
rpc.umntall -k
fi
- case ${amd_enable} in
- [Yy][Ee][Ss])
- echo -n ' amd'
- case ${amd_map_program} in
- [Nn][Oo] | '')
- ;;
- *)
- amd_flags="${amd_flags} `eval\
- ${amd_map_program}`"
- ;;
- esac
-
- if [ -n "${amd_flags}" ]; then
- amd -p ${amd_flags}\
- > /var/run/amd.pid 2> /dev/null
- else
- amd 2> /dev/null
- fi
- ;;
- esac
;;
esac
On Tue, 08 Jan 2002 05:00:02 PST, Thomas Quinot wrote: > Thanks for your feedback! > > Does the following look more appropriate? I like this idea a lot. :-) Nits follow: > chkdepend amd amd_enable portmap portmap_enable > +chkdepend amd amd_enable NFS nfs_client_enable > chkdepend NFS nfs_server_enable portmap portmap_enable > chkdepend NIS nis_server_enable portmap portmap_enable > chkdepend NIS nis_client_enable portmap portmap_enable This section contains unnecessarily weird spacing. You shouldn't try to fix that in your patch, but the use of a tab between "NFS" and "nfs_client_enable" is unnecessary. > + if [ $nfsclient_in_kernel -eq 1 ] The style of the rc scripts mandates the use of braces around shell variable names, except for throw away variables like $i. So that should be ${nfsclient_in_kernel}. I'd suggest getting your patch tested by -CURRENT users by posting the patch to the freebsd-current mailing list. Ciao, Sheldon. Le 2002-01-08, Sheldon Hearn écrivait : > Nits follow: [ whitespace ] [ style ] > I'd suggest getting your patch tested by -CURRENT users by posting the > patch to the freebsd-current mailing list. I have produced a new diff that incorporates the changes suggested by Sheldon. Those interested can fetch it from http://www.cuivre.fr.eu.org/~thomas/31358.diff Thomas. On Thu, 24 Jan 2002 16:57:29 +0100, Thomas Quinot wrote:
> In the absence of any feedback from -audit, I'm afraid we are going to
> gave to resort to that last solution...
Now that I'm actually looking at committing this... what on earth is
'sysctl -r'? :-)
Ciao,
Sheldon.
Le 2002-01-25, Sheldon Hearn écrivait : > Now that I'm actually looking at committing this... what on earth is > 'sysctl -r'? :-) Hum, puzzling one indeed. this must have been a thinko that nobody noticed before. I do not know how it could possibly have worked (this is quite odd because I generated the diffs from /etc/rc.network on the freshly rebooted machine). Anyway, it was present only in the old version of the patch, not in the current one (http://www.cuivre.fr.eu.org/~thomas/31358.diff), which is exactly identical to the one posted to -audit. Thomas. -- Thomas.Quinot@Cuivre.FR.EU.ORG Responsible Changed From-To: freebsd-bugs->sheldonh I'll take this one. State Changed From-To: open->analyzed Committed as follows: rev 1.292 src/etc/rc rev 1.121 src/etc/rc.network I plan to MFC this change onto the RELENG_4 branch in a month. Thomas, will this patch apply cleanly to and work on RELENG_4? Le 2002-01-28, Sheldon Hearn écrivait : > I've committed that patch, thanks. As for the MFC, the patch does not apply directly on RELENG_4; I have prepared another diff; I'll send it to you as soon as I get the time to test it on by -stable box. Thomas. -- Thomas.Quinot@Cuivre.FR.EU.ORG > rev 1.292 src/etc/rc > rev 1.121 src/etc/rc.network > I plan to MFC this change onto the RELENG_4 branch in a month. Thomas, > will this patch apply cleanly to and work on RELENG_4? Here is a patch for RELENG_4 that I have tested here with no obvious havoc: Index: rc =================================================================== RCS file: /home/ncvs/src/etc/rc,v retrieving revision 1.212.2.38 diff -u -r1.212.2.38 rc --- rc 19 Dec 2001 17:52:17 -0000 1.212.2.38 +++ rc 31 Jan 2002 21:30:35 -0000 @@ -98,6 +98,7 @@ } chkdepend amd amd_enable portmap portmap_enable +chkdepend amd amd_enable NFS nfs_client_enable chkdepend NFS nfs_server_enable portmap portmap_enable chkdepend NIS nis_server_enable portmap portmap_enable chkdepend NIS nis_client_enable portmap portmap_enable Index: rc.network =================================================================== RCS file: /home/ncvs/src/etc/rc.network,v retrieving revision 1.74.2.28 diff -u -r1.74.2.28 rc.network --- rc.network 19 Dec 2001 17:52:17 -0000 1.74.2.28 +++ rc.network 31 Jan 2002 21:30:36 -0000 @@ -695,11 +695,39 @@ case ${nfs_client_enable} in [Yy][Ee][Ss]) - echo -n ' nfsiod'; nfsiod ${nfs_client_flags} - if [ -n "${nfs_access_cache}" ]; then - echo -n " NFS access cache time=${nfs_access_cache}" - sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} \ - >/dev/null + nfsclient_in_kernel=0 + # Handle absent nfs client support + if sysctl vfs.nfs >/dev/null 2>&1; then + nfsclient_in_kernel=1 + else + kldload nfsclient && nfsclient_in_kernel=1 + fi + if [ ${nfsclient_in_kernel} -eq 1 ] + then + echo -n ' nfsiod'; nfsiod ${nfs_client_flags} + if [ -n "${nfs_access_cache}" ]; then + echo -n " NFS access cache time=${nfs_access_cache}" + sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null + fi + + case ${amd_enable} in + [Yy][Ee][Ss]) + echo -n ' amd' + case ${amd_map_program} in + [Nn][Oo] | '') + ;; + *) + amd_flags="${amd_flags} `eval ${amd_map_program}`" + ;; + esac + + if [ -n "${amd_flags}" ]; then + amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null + else + amd 2> /dev/null + fi + ;; + esac fi ;; esac @@ -710,25 +738,6 @@ if [ -f /var/db/mounttab ]; then rpc.umntall -k fi - - case ${amd_enable} in - [Yy][Ee][Ss]) - echo -n ' amd' - case ${amd_map_program} in - [Nn][Oo] | '') - ;; - *) - amd_flags="${amd_flags} `eval ${amd_map_program}`" - ;; - esac - - if [ -n "${amd_flags}" ]; then - amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null - else - amd 2> /dev/null - fi - ;; - esac case ${rwhod_enable} in [Yy][Ee][Ss]) -- Thomas.Quinot@Cuivre.FR.EU.ORG The proposed changes have been committed to -CURRENT and MFC'd as
rev 1.212.2.43 of /etc/rc
rev 1.74.2.34 of /etc/rc.network
Thanks to Sheldon Hearn for taking care of this PR.
--
Thomas.Quinot@Cuivre.FR.EU.ORG
State Changed From-To: analyzed->closed Submitted by Thomas: The proposed changes have been committed to -CURRENT and MFC'd as rev 1.212.2.43 of /etc/rc rev 1.74.2.34 of /etc/rc.network Thanks, Thomas! |