BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.sbin / amd / amd / srvr_nfs.c
index 604221c..1afd45c 100644 (file)
@@ -1,6 +1,4 @@
 /*
 /*
- * $Id: srvr_nfs.c,v 5.2.1.3 91/03/17 17:44:37 jsp Alpha $
- *
  * Copyright (c) 1990 Jan-Simon Pendry
  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  * Copyright (c) 1990 The Regents of the University of California.
  * Copyright (c) 1990 Jan-Simon Pendry
  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  * Copyright (c) 1990 The Regents of the University of California.
@@ -9,9 +7,38 @@
  * This code is derived from software contributed to Berkeley by
  * Jan-Simon Pendry at Imperial College, London.
  *
  * This code is derived from software contributed to Berkeley by
  * Jan-Simon Pendry at Imperial College, London.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)srvr_nfs.c  5.3 (Berkeley) 5/12/91
+ *
+ * $Id: srvr_nfs.c,v 5.2.1.6 91/05/07 22:18:36 jsp Alpha $
  *
  *
- *     @(#)srvr_nfs.c  5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -219,11 +246,16 @@ static void recompute_portmap P((fserver *fs));
 static void recompute_portmap(fs)
 fserver *fs;
 {                              
 static void recompute_portmap(fs)
 fserver *fs;
 {                              
-       if (!nfs_auth)
-               nfs_auth = authunix_create_default();
-       if (!nfs_auth) {
+       int error;
+
+       if (nfs_auth)
+               error = 0;
+       else
+               error = make_nfs_auth();
+
+       if (error) {
                nfs_private *np = (nfs_private *) fs->fs_private;
                nfs_private *np = (nfs_private *) fs->fs_private;
-               np->np_error = ENOBUFS;
+               np->np_error = error;
        } else {
                call_portmap(fs, nfs_auth, MOUNTPROG,
                        MOUNTVERS, (unsigned long) IPPROTO_UDP);
        } else {
                call_portmap(fs, nfs_auth, MOUNTPROG,
                        MOUNTVERS, (unsigned long) IPPROTO_UDP);
@@ -284,6 +316,7 @@ int done;
                                if (fs->fs_flags & FSF_WANT)
                                        wakeup_srvr(fs);
 #endif /* notdef */
                                if (fs->fs_flags & FSF_WANT)
                                        wakeup_srvr(fs);
 #endif /* notdef */
+                               map_flush_srvr(fs);
                        } else {
                                if (fs->fs_flags & FSF_VALID) {
 #ifdef DEBUG
                        } else {
                                if (fs->fs_flags & FSF_VALID) {
 #ifdef DEBUG
@@ -364,6 +397,7 @@ fserver *fs;
         * If ttl has expired then guess that it is dead
         */
        if (np->np_ttl < clocktime()) {
         * If ttl has expired then guess that it is dead
         */
        if (np->np_ttl < clocktime()) {
+               int oflags = fs->fs_flags;
                if ((fs->fs_flags & FSF_DOWN) == 0) {
                        /*
                         * Server was up, but is now down.
                if ((fs->fs_flags & FSF_DOWN) == 0) {
                        /*
                         * Server was up, but is now down.
@@ -387,12 +421,13 @@ fserver *fs;
                        /*
                         * Known to be down
                         */
                        /*
                         * Known to be down
                         */
-                       fs->fs_flags |= FSF_VALID;
 #ifdef DEBUG
 #ifdef DEBUG
-                       srvrlog(fs, "starts down");
+                       if ((fs->fs_flags & FSF_VALID) == 0)
+                               srvrlog(fs, "starts down");
 #endif
 #endif
+                       fs->fs_flags |= FSF_VALID;
                }
                }
-               if (fs->fs_flags & FSF_WANT)
+               if (oflags != fs->fs_flags && (fs->fs_flags & FSF_WANT))
                        wakeup_srvr(fs);
        } else {
 #ifdef DEBUG
                        wakeup_srvr(fs);
        } else {
 #ifdef DEBUG