Module Name:    src
Committed By:   hannken
Date:           Sun Dec 30 09:19:24 UTC 2012

Modified Files:
        src/sys/kern: vfs_bio.c

Log Message:
Always call brelse() on error for breadn() too.


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 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.241 src/sys/kern/vfs_bio.c:1.242
--- src/sys/kern/vfs_bio.c:1.241	Sat Dec 29 21:56:04 2012
+++ src/sys/kern/vfs_bio.c	Sun Dec 30 09:19:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.241 2012/12/29 21:56:04 christos Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.242 2012/12/30 09:19:24 hannken 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.241 2012/12/29 21:56:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.242 2012/12/30 09:19:24 hannken Exp $");
 
 #include "opt_bufcache.h"
 
@@ -770,12 +770,11 @@ breadn(struct vnode *vp, daddr_t blkno, 
 
 	/* Otherwise, we had to start a read for it; wait until it's valid. */
 	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;

Reply via email to