Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern brelsel: Clear B_COWDONE flag on clean (! BO_DELWRI...
details: https://anonhg.NetBSD.org/src/rev/4f162bbc2173
branches: trunk
changeset: 759526:4f162bbc2173
user: hannken <hannken%NetBSD.org@localhost>
date: Sun Dec 12 10:30:09 2010 +0000
description:
brelsel: Clear B_COWDONE flag on clean (! BO_DELWRI) buffer. B_COWDONE is set
if the buffer was read with intention to modify but the caller changed its mind.
This error could lead to snapshot corruption when a buffer with B_COWDONE set
resides on the freelist and we create a new snapshot.
diffstat:
sys/kern/vfs_bio.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (33 lines):
diff -r d9333e76a737 -r 4f162bbc2173 sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c Sun Dec 12 10:29:25 2010 +0000
+++ b/sys/kern/vfs_bio.c Sun Dec 12 10:30:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_bio.c,v 1.224 2010/11/02 15:09:52 pooka Exp $ */
+/* $NetBSD: vfs_bio.c,v 1.225 2010/12/12 10:30:09 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.224 2010/11/02 15:09:52 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.225 2010/12/12 10:30:09 hannken Exp $");
#include "opt_bufcache.h"
@@ -983,6 +983,14 @@
if (ISSET(bp->b_cflags, BC_WANTED))
CLR(bp->b_cflags, BC_WANTED|BC_AGE);
+ /* If it's clean clear the copy-on-write flag. */
+ if (ISSET(bp->b_flags, B_COWDONE)) {
+ mutex_enter(bp->b_objlock);
+ if (!ISSET(bp->b_oflags, BO_DELWRI))
+ CLR(bp->b_flags, B_COWDONE);
+ mutex_exit(bp->b_objlock);
+ }
+
/*
* Determine which queue the buffer should be on, then put it there.
*/
Home |
Main Index |
Thread Index |
Old Index