Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ext2fs Fix botch around argument check in ext2fs_mou...



details:   https://anonhg.NetBSD.org/src/rev/0a58bac76b69
branches:  trunk
changeset: 747328:0a58bac76b69
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Sep 11 15:59:07 2009 +0000

description:
Fix botch around argument check in ext2fs_mount(). Taken from ffs_vfsops.c.

Fixes LOCKDEBUG panic which is the same one mentioned in PR kern/41078
on trying to mount_ext2fs against a raw device, while that panic
seems to have another route cause around module_autoload() in
sys/miscfs/specfs/spec_vnops.c:spec_open().

diffstat:

 sys/ufs/ext2fs/ext2fs_vfsops.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (43 lines):

diff -r 77aa242091da -r 0a58bac76b69 sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Fri Sep 11 13:36:37 2009 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Fri Sep 11 15:59:07 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vfsops.c,v 1.144 2009/06/29 05:08:18 dholland Exp $     */
+/*     $NetBSD: ext2fs_vfsops.c,v 1.145 2009/09/11 15:59:07 tsutsui Exp $      */
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.144 2009/06/29 05:08:18 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.145 2009/09/11 15:59:07 tsutsui Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -384,14 +384,16 @@
         * updating the mount is okay (for example, as far as securelevel goes)
         * which leaves us with the normal check.
         */
-       accessmode = VREAD;
-       if (update ?
-           (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
-           (mp->mnt_flag & MNT_RDONLY) == 0)
-               accessmode |= VWRITE;
-       vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
-       error = genfs_can_mount(devvp, accessmode, l->l_cred);
-       VOP_UNLOCK(devvp, 0);
+       if (error == 0) {
+               accessmode = VREAD;
+               if (update ?
+                   (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
+                   (mp->mnt_flag & MNT_RDONLY) == 0)
+                       accessmode |= VWRITE;
+               vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+               error = genfs_can_mount(devvp, accessmode, l->l_cred);
+               VOP_UNLOCK(devvp, 0);
+       }
 
        if (error) {
                vrele(devvp);



Home | Main Index | Thread Index | Old Index