Module Name: src
Committed By: mlelstv
Date: Thu Dec 23 14:43:37 UTC 2010
Modified Files:
src/sys/ufs/ffs: ffs_wapbl.c
Log Message:
mount(2) doesn't remove vnodes from the freelist in the error path,
so that they get reused with a invalid pointer to a mount structure.
As a workaround, free the vnodes used to create the in-filesystem journal
immediately.
To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/ufs/ffs/ffs_wapbl.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/ffs/ffs_wapbl.c
diff -u src/sys/ufs/ffs/ffs_wapbl.c:1.15 src/sys/ufs/ffs/ffs_wapbl.c:1.16
--- src/sys/ufs/ffs/ffs_wapbl.c:1.15 Sat Feb 27 12:04:19 2010
+++ src/sys/ufs/ffs/ffs_wapbl.c Thu Dec 23 14:43:37 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_wapbl.c,v 1.15 2010/02/27 12:04:19 mlelstv Exp $ */
+/* $NetBSD: ffs_wapbl.c,v 1.16 2010/12/23 14:43:37 mlelstv Exp $ */
/*-
* Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.15 2010/02/27 12:04:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_wapbl.c,v 1.16 2010/12/23 14:43:37 mlelstv Exp $");
#define WAPBL_INTERNAL
@@ -609,10 +609,12 @@
return error;
if ((error = UFS_VALLOC(rvp, 0 | S_IFREG, NOCRED, &vp)) != 0) {
- vput(rvp);
+ VOP_UNLOCK(rvp);
+ vgone(rvp);
return error;
}
- vput(rvp);
+ VOP_UNLOCK(rvp);
+ vgone(rvp);
vp->v_type = VREG;
ip = VTOI(vp);
@@ -634,7 +636,8 @@
*/
ip->i_nlink = 0;
DIP_ASSIGN(ip, nlink, 0);
- vput(vp);
+ VOP_UNLOCK(vp);
+ vgone(vp);
return error;
}
@@ -643,7 +646,8 @@
* Now that we have the place-holder inode for the journal,
* we don't need the vnode ever again.
*/
- vput(vp);
+ VOP_UNLOCK(vp);
+ vgone(vp);
return 0;
}