Subject: bin/2556: mountd ALLDIRS deficiency
To: None <gnats-bugs@NetBSD.ORG>
From: None <oskar@unna.ping.de>
List: netbsd-bugs
Date: 06/17/1996 20:11:58
>Number:         2556
>Category:       bin
>Synopsis:       mountd ALLDIRS deficiency
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 17 14:50:01 1996
>Last-Modified:
>Originator:     Jan-Hinrich Fessel
>Organization:
Jan-Hinrich Fessel	fessel@quantum.de		oskar@unna.ping.de
"There are two major products that come out of Berkeley: LSD and BSD UNIX.
 We don't believe this to be a coincidence."
	- Andrew Bulhak (acb@yoyo.cc.monash.edu.au)
>Release:        06/15/96
>Environment:
	
System: NetBSD zappa.unna.Ping.DE 1.1A NetBSD 1.1A (ZAPPA) #52: Sat Mar 16 13:53:02 MET 1996 oskar@zappa.unna.Ping.DE:/usr/src/sys/arch/i386/compile/ZAPPA i386


>Description:
	The -alldirs option to mountd (in /etc/exports) is only usable if the directrory
	to be exported is a directory a filesystem is mounted on, e.g 
	/dev/sd1g                   249151   224938    11755    95%    /usr/local
	can be exported with -alldirs, /usr/local/faces fails to be exported -alldirs.
>How-To-Repeat:
	zappa# df
	Filesystem               1K-blocks     Used    Avail Capacity  Mounted on
	/dev/sd0a                    16415    12841     2753    82%    /
	kernfs                           1        1        0   100%    /kern
	procfs                           4        4        0   100%    /proc
	fdesc                            1        1        0   100%    /dev
	mfs:23                       26959     2585    23026    10%    /tmp
	/dev/sd0g                   180735   105872    65826    62%    /usr
	/dev/sd1g                   249151   224938    11755    95%    /usr/local
	/dev/sd0e                  1314541   700505   548308    56%    /usr/src
	/dev/sd1h                   322182   274714    31358    90%    /export/home
	/dev/sd1f                   409896   180864   208537    46%    /var
	/dev/sd1a                    16055     1851    13401    12%    /var/spool/uucp
	/dev/sd0h                   412639   325584    66423    83%    /export/ftp
	amd:84                           0        0        0   100%    /cdrom
	amd:84                           0        0        0   100%    /home
	zippo:/export/home/oskar    301141   197511    88572    69%    /amd/zippo/export/home/oskar
	zappa# cat /etc/exports
	/export/ftp     -alldirs -maproot=root 193.100.14.22 193.100.14.21 193.100.14.19 193.100.14.18
	/usr/src        -alldirs -maproot=root 193.100.14.22 193.100.14.19 193.100.14.18
	/usr/local/faces        -alldirs
	/xwin           -maproot=root 193.100.14.22 193.100.14.18
	/export/home            -maproot=root 193.100.14.22 193.100.14.18
	/cdrom          -ro
	zappa# mountd -d
	Getting export list.
	Got line /export/ftp    -alldirs -maproot=root 193.100.14.22 193.100.14.21 193.100.14.19 193.100.14.18
	Making new ep fs=0x407,0x78b
	doing opt -alldirs -maproot=root 193.100.14.22 193.100.14.21 193.100.14.19 193.100.14.18
	doing opt -maproot=root 193.100.14.22 193.100.14.21 193.100.14.19 193.100.14.18
	got host 193.100.14.22
	got host 193.100.14.21
	got host 193.100.14.19
	got host 193.100.14.18
	Got line /usr/src       -alldirs -maproot=root 193.100.14.22 193.100.14.19 193.100.14.18
	Making new ep fs=0x404,0x78b
	doing opt -alldirs -maproot=root 193.100.14.22 193.100.14.19 193.100.14.18
	doing opt -maproot=root 193.100.14.22 193.100.14.19 193.100.14.18
	got host 193.100.14.22
	got host 193.100.14.19
	got host 193.100.14.18
	Got line /usr/local/faces       -alldirs
	Making new ep fs=0x40e,0x78b
	doing opt -alldirs
	Adding a default entry
	Got line /xwin          -maproot=root 193.100.14.22 193.100.14.18
	Making new ep fs=0x400,0x78b
	doing opt -maproot=root 193.100.14.22 193.100.14.18
	got host 193.100.14.22
	got host 193.100.14.18
	Got line /export/home           -maproot=root 193.100.14.22 193.100.14.18
	Making new ep fs=0x40f,0x78b
	doing opt -maproot=root 193.100.14.22 193.100.14.18
	got host 193.100.14.22
	got host 193.100.14.18
	Got line /cdrom         -ro
	Making new ep fs=0x1c01,0x70b
	doing opt -ro
	Adding a default entry
	Getting mount list.
	Here we go.
	Jun 17 20:08:44 zappa mountd[26107]: Could not remount /usr/local/faces: Invalid argument
	Jun 17 20:08:44 zappa mountd[26107]: Bad exports list line /usr/local/faces     -alldirs

	This is espacially annoying when using amd on homedirs on the other end...

>Fix:
	
	temporary hack: just allow the mount, regardless what the mount call to
	update the kernel says, if we export -alldirs:

diff -c mountd.c~ mountd.c
*** mountd.c~   Mon Jun 17 20:00:08 1996
--- mountd.c    Mon Jun 17 19:58:08 1996
***************
*** 1606,1612 ****
--- 1606,1614 ----
                        if (opt_flags & OP_ALLDIRS) {
                                syslog(LOG_ERR, "Could not remount %s: %m",
                                        dirp);
+                               /*
                                return (1);
+                               */
                        }
                        /* back up over the last component */
                        while (*cp == '/' && cp > dirp)


>Audit-Trail:
>Unformatted: