Module Name: src
Committed By: christos
Date: Sat Dec 29 21:56:04 UTC 2012
Modified Files:
src/sys/kern: vfs_bio.c
Log Message:
Always call brelse() on error. Otherwise a possible error from bread() will
cause the buffer to stay lock and we end up blocking forever in
VOP_CLOSE->spec_close->vinvalbuf->bbysy since the buffer is marked busy
but there is no I/O pending.
This caused my laptop to hang on boot_findwedge because:
findroot: unable to read block 358331527 of dev dk0 (22)
To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/kern/vfs_bio.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/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.240 src/sys/kern/vfs_bio.c:1.241
--- src/sys/kern/vfs_bio.c:1.240 Thu Dec 20 03:03:43 2012
+++ src/sys/kern/vfs_bio.c Sat Dec 29 16:56:04 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_bio.c,v 1.240 2012/12/20 08:03:43 hannken Exp $ */
+/* $NetBSD: vfs_bio.c,v 1.241 2012/12/29 21:56:04 christos Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.240 2012/12/20 08:03:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.241 2012/12/29 21:56:04 christos Exp $");
#include "opt_bufcache.h"
@@ -727,12 +727,11 @@ bread(struct vnode *vp, daddr_t blkno, i
/* Wait for the read to complete, and return result. */
error = biowait(bp);
- if (error == 0 && (flags & B_MODIFY) != 0) {
+ if (error == 0 && (flags & B_MODIFY) != 0)
error = fscow_run(bp, true);
- if (error) {
- brelse(bp, 0);
- *bpp = NULL;
- }
+ if (error) {
+ brelse(bp, 0);
+ *bpp = NULL;
}
return error;