allow multiple references when mounting miniroot
[unix-history] / usr / src / sys / ufs / lfs / lfs_vfsops.c
index 0a4b271..c264471 100644 (file)
@@ -2,19 +2,9 @@
  * Copyright (c) 1989 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1989 The Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  *
  *
- *     @(#)lfs_vfsops.c        7.46 (Berkeley) %G%
+ *     @(#)lfs_vfsops.c        7.50 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -170,6 +160,8 @@ ufs_mount(mp, path, data, ndp)
                        return (error);
                if (devvp != ump->um_devvp)
                        error = EINVAL; /* needs translation */
                        return (error);
                if (devvp != ump->um_devvp)
                        error = EINVAL; /* needs translation */
+               else
+                       vrele(devvp);
        }
        if (error) {
                vrele(devvp);
        }
        if (error) {
                vrele(devvp);
@@ -206,6 +198,7 @@ mountfs(devvp, mp)
        int error, i, size;
        int needclose = 0;
        int ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
        int error, i, size;
        int needclose = 0;
        int ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
+       extern struct vnode *rootvp;
 
        if (error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED))
                return (error);
 
        if (error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED))
                return (error);
@@ -744,11 +737,8 @@ getmdev(devvpp, fname, ndp)
        ndp->ni_nameiop = LOOKUP | FOLLOW;
        ndp->ni_segflg = UIO_USERSPACE;
        ndp->ni_dirp = fname;
        ndp->ni_nameiop = LOOKUP | FOLLOW;
        ndp->ni_segflg = UIO_USERSPACE;
        ndp->ni_dirp = fname;
-       if (error = namei(ndp)) {
-               if (error == ENOENT)
-                       return (ENODEV);        /* needs translation */
+       if (error = namei(ndp))
                return (error);
                return (error);
-       }
        vp = ndp->ni_vp;
        if (vp->v_type != VBLK) {
                vrele(vp);
        vp = ndp->ni_vp;
        if (vp->v_type != VBLK) {
                vrele(vp);