Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Adjust mountroot routines to vrele rootvp in case of mou...



details:   https://anonhg.NetBSD.org/src/rev/e2b03b74590c
branches:  trunk
changeset: 474718:e2b03b74590c
user:      wrstuden <wrstuden%NetBSD.org@localhost>
date:      Sat Jul 17 01:08:28 1999 +0000

description:
Adjust mountroot routines to vrele rootvp in case of mount error. Closes
PR 7977 by Neil Carson, <neil%brini.com@localhost>.

diffstat:

 sys/isofs/cd9660/cd9660_vfsops.c |  8 ++++++--
 sys/msdosfs/msdosfs_vfsops.c     |  8 ++++++--
 sys/ufs/ext2fs/ext2fs_vfsops.c   |  7 +++++--
 sys/ufs/ffs/ffs_vfsops.c         |  7 +++++--
 sys/ufs/lfs/lfs_vfsops.c         |  7 +++++--
 sys/ufs/mfs/mfs_vfsops.c         |  7 +++++--
 6 files changed, 32 insertions(+), 12 deletions(-)

diffs (174 lines):

diff -r ea617d187c0b -r e2b03b74590c sys/isofs/cd9660/cd9660_vfsops.c
--- a/sys/isofs/cd9660/cd9660_vfsops.c  Sat Jul 17 00:42:20 1999 +0000
+++ b/sys/isofs/cd9660/cd9660_vfsops.c  Sat Jul 17 01:08:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.38 1999/07/13 11:12:06 scw Exp $   */
+/*     $NetBSD: cd9660_vfsops.c,v 1.39 1999/07/17 01:08:28 wrstuden Exp $      */
 
 /*-
  * Copyright (c) 1994
@@ -127,14 +127,18 @@
        if (bdevvp(rootdev, &rootvp))
                panic("cd9660_mountroot: can't setup rootvp");
 
-       if ((error = vfs_rootmountalloc(MOUNT_CD9660, "root_device", &mp)) != 0)
+       if ((error = vfs_rootmountalloc(MOUNT_CD9660, "root_device", &mp))
+                       != 0) {
+               vrele(rootvp);
                return (error);
+       }
 
        args.flags = ISOFSMNT_ROOT;
        if ((error = iso_mountfs(rootvp, mp, p, &args)) != 0) {
                mp->mnt_op->vfs_refcount--;
                vfs_unbusy(mp);
                free(mp, M_MOUNT);
+               vrele(rootvp);
                return (error);
        }
        simple_lock(&mountlist_slock);
diff -r ea617d187c0b -r e2b03b74590c sys/msdosfs/msdosfs_vfsops.c
--- a/sys/msdosfs/msdosfs_vfsops.c      Sat Jul 17 00:42:20 1999 +0000
+++ b/sys/msdosfs/msdosfs_vfsops.c      Sat Jul 17 01:08:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vfsops.c,v 1.61 1999/03/07 13:57:20 tron Exp $ */
+/*     $NetBSD: msdosfs_vfsops.c,v 1.62 1999/07/17 01:08:29 wrstuden Exp $     */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -186,8 +186,10 @@
        if (bdevvp(rootdev, &rootvp))
                panic("msdosfs_mountroot: can't setup rootvp");
 
-       if ((error = vfs_rootmountalloc(MOUNT_MSDOS, "root_device", &mp)))
+       if ((error = vfs_rootmountalloc(MOUNT_MSDOS, "root_device", &mp))) {
+               vrele(rootvp);
                return (error);
+       }
 
        args.flags = 0;
        args.uid = 0;
@@ -198,6 +200,7 @@
                mp->mnt_op->vfs_refcount--;
                vfs_unbusy(mp);
                free(mp, M_MOUNT);
+               vrele(rootvp);
                return (error);
        }
 
@@ -205,6 +208,7 @@
                (void)msdosfs_unmount(mp, 0, p);
                vfs_unbusy(mp);
                free(mp, M_MOUNT);
+               vrele(rootvp);
                return (error);
        }
 
diff -r ea617d187c0b -r e2b03b74590c sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Sat Jul 17 00:42:20 1999 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Sat Jul 17 01:08:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vfsops.c,v 1.26 1999/07/08 01:06:04 wrstuden Exp $      */
+/*     $NetBSD: ext2fs_vfsops.c,v 1.27 1999/07/17 01:08:29 wrstuden Exp $      */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -149,13 +149,16 @@
        if (bdevvp(rootdev, &rootvp))
                panic("ext2fs_mountroot: can't setup bdevvp's");
 
-       if ((error = vfs_rootmountalloc(MOUNT_EXT2FS, "root_device", &mp)))
+       if ((error = vfs_rootmountalloc(MOUNT_EXT2FS, "root_device", &mp))) {
+               vrele(rootvp);
                return (error);
+       }
 
        if ((error = ext2fs_mountfs(rootvp, mp, p)) != 0) {
                mp->mnt_op->vfs_refcount--;
                vfs_unbusy(mp);
                free(mp, M_MOUNT);
+               vrele(rootvp);
                return (error);
        }
        simple_lock(&mountlist_slock);
diff -r ea617d187c0b -r e2b03b74590c sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Sat Jul 17 00:42:20 1999 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Sat Jul 17 01:08:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.50 1999/07/08 01:06:05 wrstuden Exp $ */
+/*     $NetBSD: ffs_vfsops.c,v 1.51 1999/07/17 01:08:29 wrstuden Exp $ */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -133,12 +133,15 @@
        if (bdevvp(rootdev, &rootvp))
                panic("ffs_mountroot: can't setup bdevvp's");
 
-       if ((error = vfs_rootmountalloc(MOUNT_FFS, "root_device", &mp)))
+       if ((error = vfs_rootmountalloc(MOUNT_FFS, "root_device", &mp))) {
+               vrele(rootvp);
                return (error);
+       }
        if ((error = ffs_mountfs(rootvp, mp, p)) != 0) {
                mp->mnt_op->vfs_refcount--;
                vfs_unbusy(mp);
                free(mp, M_MOUNT);
+               vrele(rootvp);
                return (error);
        }
        simple_lock(&mountlist_slock);
diff -r ea617d187c0b -r e2b03b74590c sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Sat Jul 17 00:42:20 1999 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Sat Jul 17 01:08:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vfsops.c,v 1.34 1999/06/01 03:00:40 perseant Exp $ */
+/*     $NetBSD: lfs_vfsops.c,v 1.35 1999/07/17 01:08:30 wrstuden Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -171,12 +171,15 @@
                printf("lfs_mountroot: can't setup bdevvp's");
                return (error);
        }
-       if ((error = vfs_rootmountalloc(MOUNT_LFS, "root_device", &mp)))
+       if ((error = vfs_rootmountalloc(MOUNT_LFS, "root_device", &mp))) {
+               vrele(rootvp);
                return (error);
+       }
        if ((error = lfs_mountfs(rootvp, mp, p))) {
                mp->mnt_op->vfs_refcount--;
                vfs_unbusy(mp);
                free(mp, M_MOUNT);
+               vrele(rootvp);
                return (error);
        }
        simple_lock(&mountlist_slock);
diff -r ea617d187c0b -r e2b03b74590c sys/ufs/mfs/mfs_vfsops.c
--- a/sys/ufs/mfs/mfs_vfsops.c  Sat Jul 17 00:42:20 1999 +0000
+++ b/sys/ufs/mfs/mfs_vfsops.c  Sat Jul 17 01:08:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mfs_vfsops.c,v 1.20 1999/04/04 18:15:58 mycroft Exp $  */
+/*     $NetBSD: mfs_vfsops.c,v 1.21 1999/07/17 01:08:30 wrstuden Exp $ */
 
 /*
  * Copyright (c) 1989, 1990, 1993, 1994
@@ -130,8 +130,10 @@
                return (error);
        }
 
-       if ((error = vfs_rootmountalloc(MOUNT_MFS, "mfs_root", &mp)))
+       if ((error = vfs_rootmountalloc(MOUNT_MFS, "mfs_root", &mp))) {
+               vrele(rootvp);
                return (error);
+       }
 
        mfsp = malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
        rootvp->v_data = mfsp;
@@ -147,6 +149,7 @@
                vfs_unbusy(mp);
                free(mp, M_MOUNT);
                free(mfsp, M_MFSNODE);
+               vrele(rootvp);
                return (error);
        }       
        simple_lock(&mountlist_slock);



Home | Main Index | Thread Index | Old Index