|
Bugzilla – Full Text Bug Listing |
| Summary: | nfsserver restart -=> mounts stuff without unmounting first | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE 12.2 | Reporter: | Jon Nelson <jnelson-suse> |
| Component: | Basesystem | Assignee: | E-mail List <bnc-team-screening> |
| Status: | RESOLVED FIXED | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | ||
| Version: | Factory | ||
| Target Milestone: | Milestone 4 | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
|
Description
Jon Nelson
2012-03-29 17:21:55 UTC
Hi Jon, this doesn't make a lot of sense. 'nfsserver' doesn't mount anything (except /proc/fs/nfsd). In things are getting mounted then something else must be triggering it. Is '/exports' managed by an automounter? 'nfsserver' would certainly try to access the things listed in /etc/exports which might cause them to be auto-mounted. If accessing that causes them to be mounted again, then it is a problem with the automounter. Are the mount points listed repeatedly in /proc/mounts or only in /etc/mtab (or is /etc/mtab a link to /proc/mounts?). The file /etc/init.d/nfsserver contains functions (nfs4_bind_mounts) and nfs4_unbind_mounts. The former:
nfs4_bind_mounts() {
# In case of doubt, try "man sed" :-)
cat /etc/exports |
sed -n 'H;g;s/\\$//;h;t;s/^\n//;s/\n[[:space:]]*//g;s/#.*//;p;s/.*//;h' |
sed 's/^\([^[:space:]]*\).*bind=\([^,)]*\).*/\1 \2/;t;d' |
sort |
while read export dir; do
test -d "$export" || mkdir -p "$export"
# Fortunately, mount ignores unknown
# options, so we have an easy way to
# tag our "magic" bind mounts
mount -o bind,nfsexp "$dir" "$export"
done
}
However, the latter is coded wrong and doesn't work (I'm not sure it ever worked).
Oh yes, of course. I keep forgetting about that. I think it did work when /etc/mtab was a normal file. Now that it is a symlink to /proc/mounts, it needs fixing. However I don't think we actually need the bind-mounts any more. nfs-utils and the kernel do something clever so it all 'just works'. I'll try to find time to sort out the right solution, but I've been very busy of late, so it might be a while. Thanks. I suspect a patch like the following would fix it. Can you test?
However it would be best not to use the bind= exports and more, they aren't needed.
If remove the "bind=" options from /etc/exports, and remove the "fsid=0" setting on the exported 'root', then nfsd will automatically export all exported filesystems in a way that NFSv4 can see them. It is 'pseudo-export' the root filesystem so that just the directories needed to get to the export points are visible, and they are read-only.
Can you check that works for you too please?
Index: nfsserver.init
===================================================================
--- nfsserver.init (revision 1)
+++ nfsserver.init (working copy)
@@ -57,6 +57,7 @@
IDMAPD_CLIENT_STATE=/var/run/nfs/nfs-rpc.idmapd
IDMAPD_SERVER_STATE=/var/run/nfs/nfsserver-rpc.idmapd
+NFSD_BIND_MOUNTS=/var/run/nfsd.bind.mounts
NEED_SVCGSSD=no
NEED_IDMPAPD=no
@@ -101,17 +102,13 @@
sort |
while read export dir; do
test -d "$export" || mkdir -p "$export"
- # Fortunately, mount ignores unknown
- # options, so we have an easy way to
- # tag our "magic" bind mounts
- mount -o bind,nfsexp "$dir" "$export"
- done
+ mount -o bind "$dir" "$export"
+ echo "$dir" "$export"
+ done > $NFSD_BIND_MOUNTS
}
nfs4_unbind_mounts() {
-
- cat /etc/mtab |
- grep '\<nfsexp\>' |
+ cat $NFSD_BIND_MOUNTS |
sort -r -k2 |
while read src mountpoint crap; do
umount -l "$mountpoint"
I tested the path. It works. I also removed the 'fsid' root filesystem from /etc/exports, and removed the bind= option from the other entries there. I also had to change the exports themselves from "/exports/whatever" (which was bind mounted to /whatever) to just "/whatever". Then I placed equivalent bind entries in /etc/fstab, mounted them, and then restarted nfsserver. The nfsserver _did_ properly export them. Thanks! Thanks for the confirmation. I don't think I'll bother with an update for 12.1, but I have applied this patch to our main branch so it will appear in 12.2. I've also request that yast2-nfs-server stop offering fsid=0 as it is no longer needed. |