Module Name: src
Committed By: tsutsui
Date: Fri Sep 11 15:59:07 UTC 2009
Modified Files:
src/sys/ufs/ext2fs: ext2fs_vfsops.c
Log Message:
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().
To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/ufs/ext2fs/ext2fs_vfsops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/ext2fs/ext2fs_vfsops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.144 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.145
--- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.144 Mon Jun 29 05:08:18 2009
+++ src/sys/ufs/ext2fs/ext2fs_vfsops.c Fri Sep 11 15:59:07 2009
@@ -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);