Module Name: src
Committed By: riastradh
Date: Wed Apr 9 22:44:15 UTC 2014
Modified Files:
src/sys/ufs/lfs: lfs_syscalls.c
Log Message:
Take vp->v_interlock before vdead_check in lfs_bmapv.
XXX This code is a pile of bodge that needs a serious rototill anyway.
To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/ufs/lfs/lfs_syscalls.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/lfs/lfs_syscalls.c
diff -u src/sys/ufs/lfs/lfs_syscalls.c:1.152 src/sys/ufs/lfs/lfs_syscalls.c:1.153
--- src/sys/ufs/lfs/lfs_syscalls.c:1.152 Mon Mar 24 13:42:40 2014
+++ src/sys/ufs/lfs/lfs_syscalls.c Wed Apr 9 22:44:15 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_syscalls.c,v 1.152 2014/03/24 13:42:40 hannken Exp $ */
+/* $NetBSD: lfs_syscalls.c,v 1.153 2014/04/09 22:44:15 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007, 2008
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.152 2014/03/24 13:42:40 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.153 2014/04/09 22:44:15 riastradh Exp $");
#ifndef LFS
# define LFS /* for prototypes in syscallargs.h */
@@ -743,9 +743,10 @@ lfs_bmapv(struct proc *p, fsid_t *fsidp,
*/
mutex_enter(&ulfs_ihash_lock);
vp = ulfs_ihashlookup(ump->um_dev, blkp->bi_inode);
+ if (vp != NULL)
+ mutex_enter(vp->v_interlock);
if (vp != NULL && vdead_check(vp, VDEAD_NOWAIT) == 0) {
ip = VTOI(vp);
- mutex_enter(vp->v_interlock);
mutex_exit(&ulfs_ihash_lock);
if (lfs_vref(vp)) {
v_daddr = LFS_UNUSED_DADDR;
@@ -753,6 +754,7 @@ lfs_bmapv(struct proc *p, fsid_t *fsidp,
}
numrefed++;
} else {
+ mutex_exit(vp->v_interlock);
mutex_exit(&ulfs_ihash_lock);
/*
* Don't VFS_VGET if we're being unmounted,