kern/178997: Heavy disk I/O may hang system
Klaus Weber
fbsd-bugs-2013-1 at unix-admin.de
Sun Jul 21 17:50:02 UTC 2013
The following reply was made to PR kern/178997; it has been noted by GNATS.
From: Klaus Weber <fbsd-bugs-2013-1 at unix-admin.de>
To: Klaus Weber <fbsd-bugs-2013-1 at unix-admin.de>
Cc: Bruce Evans <brde at optusnet.com.au>, freebsd-gnats-submit at FreeBSD.org
Subject: Re: kern/178997: Heavy disk I/O may hang system
Date: Sun, 21 Jul 2013 19:45:25 +0200
--AqsLC8rIMeq19msA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Sun, Jul 21, 2013 at 07:42:15PM +0200, Klaus Weber wrote:
> With the following patch (also attached)
Attachment was missing.
Klaus
--AqsLC8rIMeq19msA
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="bo_dirty.bv_cnt_FIX_prod.patch"
Index: sys/kern/vfs_bio.c
===================================================================
--- sys/kern/vfs_bio.c (revision 253339)
+++ sys/kern/vfs_bio.c (working copy)
@@ -1146,7 +1146,7 @@
if (bo->bo_dirty.bv_cnt > dirtybufthresh + 10) {
(void) VOP_FSYNC(bp->b_vp, MNT_NOWAIT, curthread);
altbufferflushes++;
- } else if (bo->bo_dirty.bv_cnt > dirtybufthresh) {
+ } else if ( bdflush_required(bo) ) {
BO_LOCK(bo);
/*
* Try to find a buffer to flush.
@@ -1438,6 +1438,28 @@
}
/*
+ * Flushing is deemed necessary if at least one of the following is true:
+ * - bo is hogging more than dirtybufthresh buffers (previous behavior)
+ * - numdirtybuffers exceeds dirtybufthresh
+ * - we are or act as bufdaemon (TDP_NORUNNINGBUF)
+ *
+ * Used by bufbdflush (above) and ffs_bdflush (in ffs_snapshot).
+ */
+int
+bdflush_required(struct bufobj *bo)
+{
+ struct thread *td = curthread;
+
+ KASSERT(bo != NULL, ("bdflush_required: NULL bo"));
+
+ if ((bo->bo_dirty.bv_cnt > dirtybufthresh) ||
+ (numdirtybuffers > dirtybufthresh) ||
+ (td && (td->td_pflags & TDP_NORUNNINGBUF)) )
+ return(1);
+ return(0);
+ }
+
+/*
* brelse:
*
* Release a busy buffer and, if requested, free its resources. The
Index: sys/sys/bio.h
===================================================================
--- sys/sys/bio.h (revision 253339)
+++ sys/sys/bio.h (working copy)
@@ -151,6 +151,10 @@
#define physread physio
#define physwrite physio
+extern struct bufobj *bo;
+int bdflush_required(struct bufobj *bo);
+
+
#endif /* _KERNEL */
#endif /* !_SYS_BIO_H_ */
Index: sys/ufs/ffs/ffs_snapshot.c
===================================================================
--- sys/ufs/ffs/ffs_snapshot.c (revision 253339)
+++ sys/ufs/ffs/ffs_snapshot.c (working copy)
@@ -2161,7 +2161,7 @@
struct buf *nbp;
int bp_bdskip;
- if (bo->bo_dirty.bv_cnt <= dirtybufthresh)
+ if ( !bdflush_required(bo) )
return;
td = curthread;
--AqsLC8rIMeq19msA--
More information about the freebsd-bugs
mailing list