summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2007-04-24 10:59:21 +0000
committerkib <kib@FreeBSD.org>2007-04-24 10:59:21 +0000
commit543a201e4b11d37d8d2441b8268a51ddaa168592 (patch)
treee40220c131895b0639b5d3f9849ca730c0e096a6
parent67b5103f2993df28870c0a2060a3e0955cfcc7a5 (diff)
downloadFreeBSD-src-543a201e4b11d37d8d2441b8268a51ddaa168592.zip
FreeBSD-src-543a201e4b11d37d8d2441b8268a51ddaa168592.tar.gz
Disable nesting of BOP_BDFLUSH(). VOP_FSYNC() call in bdwrite() could
result in bdwrite() being reentered, thus causing infinite recursion. Reported and tested by: Peter Holm Reviewed by: tegge MFC after: 2 weeks
-rw-r--r--sys/kern/vfs_bio.c6
-rw-r--r--sys/sys/proc.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index b642040..44879ff 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -961,9 +961,11 @@ bdwrite(struct buf *bp)
*/
vp = bp->b_vp;
bo = bp->b_bufobj;
- if ((td->td_pflags & TDP_COWINPROGRESS) == 0)
+ if ((td->td_pflags & (TDP_COWINPROGRESS|TDP_INBDFLUSH)) == 0) {
+ td->td_pflags |= TDP_INBDFLUSH;
BO_BDFLUSH(bo, bp);
- else
+ td->td_pflags &= ~TDP_INBDFLUSH;
+ } else
recursiveflushes++;
bdirty(bp);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 7d71b8c..529512c 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -366,6 +366,7 @@ struct thread {
#define TDP_SOFTDEP 0x00020000 /* Stuck processing softdep worklist */
#define TDP_NORUNNINGBUF 0x00040000 /* Ignore runningbufspace check */
#define TDP_WAKEUP 0x00080000 /* Don't sleep in umtx cond_wait */
+#define TDP_INBDFLUSH 0x00100000 /* Already in BO_BDFLUSH, do not recurse */
/*
* Reasons that the current thread can not be run yet.
OpenPOWER on IntegriCloud