From nobody  Wed Nov 19 22:47:04 1997
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.7/8.8.7) id WAA14355;
          Wed, 19 Nov 1997 22:47:04 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199711200647.WAA14355@hub.freebsd.org>
Date: Wed, 19 Nov 1997 22:47:04 -0800 (PST)
From: mburgett@awen.com
To: freebsd-gnats-submit@freebsd.org
Subject: Repeated nfs mounts succeed, creating multiple instances in 'df' ; umount -ft nfs doesn't succeed if network is down
X-Send-Pr-Version: www-1.0

>Number:         5100
>Category:       bin
>Synopsis:       Repeated nfs mounts succeed, creating multiple instances in 'df' ; umount -ft nfs doesn't succeed if network is down
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    peter
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 19 22:50:03 PST 1997
>Closed-Date:    Sun Nov 23 14:50:27 MET 1997
>Last-Modified:  Sat Apr 25 22:36:44 PDT 1998
>Originator:     Mike Burgett
>Release:        2.2-stable (~15 Nov 97)
>Organization:
None
>Environment:
FreeBSD dragon.awen.com 2.2.5-STABLE FreeBSD 2.2.5-STABLE #0: Sat Nov 15 22:02:21 PST 1997     mburgett@dragon.awen.com:/usr/src/sys/compile/DRAGON  i386

FreeBSD draco.awen.com 2.2.5-STABLE FreeBSD 2.2.5-STABLE #0: Tue Nov 18 21:15:53 PST 1997     mburgett@dragon.awen.com:/usr/src/sys/compile/MOBILE  i386

>Description:
mount seems happy to repeatedly mount nfs partitions, even after they've
already been mounted.  It gets really interesting when umounting, since
you need to umount the same number of times you mounted, to get rid
of all entries.  Especially interesting is the fact that the mounts are
indeed good, after umounting the first time... Shouldn't mount_nfs be
returning an error if the requested mount is aready in place (like
mounting local filesystems do) and refuse to create the second entry in
the table?

Conversely, umount -ft nfs won't succeed if the network is down ( error
returned is 'nfs send error 50' ) if the network is down.  When the
network has disappeared, umount_nfs should probably go ahead and tear
down the mount points quietly, if requested.

I've marked this 'serious', because I believe it is, for laptop use.

In order to be able to script nfs mounts/umounts cleanly in pccard.conf
this needs to work somewhat as described, since the pcmcia card being
removed is what triggers the remove scripts, which is the first logical
chance the system gets to remove the nfs mount points, unless a user 
would be required to run a script before removing the card, therefore
defeating some of the intent behind the pccard.conf script lines.
>How-To-Repeat:
# df
Filesystem         1K-blocks     Used    Avail Capacity  Mounted on
/dev/wd0a              49231    28459    16834    63%    /
/dev/wd0s1f          1076975   312816   678001    32%    /usr
/dev/wd0s1e            49231     2497    42796     6%    /var
procfs                     4        4        0   100%    /proc
dragon:/usr/home     1677668   644385   899070    42%    /usr/home
dragon:/usr/src      1677668   644385   899070    42%    /usr/src
dragon:/export        996755   276783   640232    30%    /export
dragon:/export/obj    996755   276783   640232    30%    /usr/obj
#
# mount -vat nfs
dragon:/usr/home on /usr/home
dragon:/usr/src on /usr/src
dragon:/export on /export
dragon:/export/obj on /usr/obj
# df
Filesystem         1K-blocks     Used    Avail Capacity  Mounted on
/dev/wd0a              49231    28459    16834    63%    /
/dev/wd0s1f          1076975   312816   678001    32%    /usr
/dev/wd0s1e            49231     2497    42796     6%    /var
procfs                     4        4        0   100%    /proc
dragon:/usr/home     1677668   644385   899070    42%    /usr/home
dragon:/usr/src      1677668   644385   899070    42%    /usr/src
dragon:/export        996755   276783   640232    30%    /export
dragon:/export/obj    996755   276783   640232    30%    /usr/obj
dragon:/usr/home     1677668   644385   899070    42%    /usr/home
dragon:/usr/src      1677668   644385   899070    42%    /usr/src
dragon:/export        996755   276783   640232    30%    /export
dragon:/export/obj    996755   276783   640232    30%    /usr/obj
# ls /export
bench                   majorcool               mmx_stuff
buildworld.log          makeworld.diff          obj
cachechk                makeworld.diff1         test
cpucheck                makeworld.diff2         testit
cyberian                makeworld.log           testit.c
dns                     makeworld.log.1         testit.s
fiftp                   makeworld.log.2         tmp
ftp                     makeworld.log.master    www
lost+found              makeworld.log.prev
m4test                  makeworld.manual.log
# umount -vat nfs
/export/obj: unmount from /usr/obj
/export: unmount from /export
/usr/src: unmount from /usr/src
/usr/home: unmount from /usr/home
# ls /export
bench                   majorcool               mmx_stuff
buildworld.log          makeworld.diff          obj
cachechk                makeworld.diff1         test
cpucheck                makeworld.diff2         testit
cyberian                makeworld.log           testit.c
dns                     makeworld.log.1         testit.s
fiftp                   makeworld.log.2         tmp
ftp                     makeworld.log.master    www
lost+found              makeworld.log.prev
m4test                  makeworld.manual.log
# umount -vat nfs
/export/obj: unmount from /usr/obj
/export: unmount from /export
/usr/src: unmount from /usr/src
/usr/home: unmount from /usr/home
umount: /usr/home: Device busy
# df
Filesystem       1K-blocks     Used    Avail Capacity  Mounted on
/dev/wd0a            49231    28459    16834    63%    /
/dev/wd0s1f        1076975   312816   678001    32%    /usr
/dev/wd0s1e          49231     2497    42796     6%    /var
procfs                   4        4        0   100%    /proc
dragon:/usr/home   1677668   644385   899070    42%    /usr/home
# ls /export
#

>Fix:

>Release-Note:
>Audit-Trail:

From: j@uriah.heep.sax.de (J Wunsch)
To: mburgett@awen.com
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/5100: Repeated nfs mounts succeed, creating multiple instances in 'df' ; umount -ft nfs doesn't succeed if network is down
Date: Thu, 20 Nov 1997 09:46:55 +0100

 As mburgett@awen.com wrote:
 
 > ... Shouldn't mount_nfs be
 > returning an error if the requested mount is aready in place (like
 > mounting local filesystems do) and refuse to create the second entry in
 > the table?
 
 No, all 4.4BSD mounts can be stacked on the same mountpoint.  UFS
 mounts only don't succeed in this since the resource (partition) is
 busy, and cannot be mounted again anywhere else.  This is not the case
 for MFS mounts, or mounts of other (non-device) resources.
 
 mount -a should, however, be modified to not blindly mount something
 that's already mounted.  This is indeed a bug.  I'm not sure whether
 there's already an existing PR for it, but i think so.  You apparently
 didn't bother to check the open PRs either, did you? :-)
 
 > Conversely, umount -ft nfs won't succeed if the network is down ( error
 > returned is 'nfs send error 50' ) if the network is down.
 
 There's an open PR for it.  Our NFS maintainer is, unfortunately, out
 to lunch.
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sun Nov 23 14:50:27 MET 1997 
State-Changed-Why:  

The actual bug was in mount -a attempting to perform the mount 
operation multiple times.  This bug has been fixed by Steve Price in 
rev 1.19 of src/sbin/mount/mount.c on 1997/08/24.  The fix was 
intentionally not merged into 2.2-stable due to the rather serious 
change in behaviour it constitutes.  Avoid trying to run mount -a 
multiple times on non-current versions of FreeBSD. 
Responsible-Changed-From-To: freebsd-bugs->peter 
Responsible-Changed-By: peter 
Responsible-Changed-When: Sat Apr 25 22:36:12 PDT 1998 
Responsible-Changed-Why:  
I'll take a look at this again for 2.2 use.. 
>Unformatted:
