kernel - Fix vkernel lwp stuck thread bug
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 4 Jan 2011 04:22:47 +0000 (20:22 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 4 Jan 2011 04:22:47 +0000 (20:22 -0800)
* Fix a tsleep hz / 100 which calculates to 0 due to the vkernel's 20hz
  tick rate.  This could cause threads running under the vkernel to get
  stuck.

sys/kern/vfs_bio.c

index 55b5207..2c26b85 100644 (file)
@@ -2043,7 +2043,8 @@ restart:
                /*
                 * Sanity Checks
                 */
                /*
                 * Sanity Checks
                 */
-               KASSERT(bp->b_qindex == qindex, ("getnewbuf: inconsistent queue %d bp %p", qindex, bp));
+               KASSERT(bp->b_qindex == qindex,
+                       ("getnewbuf: inconsistent queue %d bp %p", qindex, bp));
 
                /*
                 * Note: we no longer distinguish between VMIO and non-VMIO
 
                /*
                 * Note: we no longer distinguish between VMIO and non-VMIO
@@ -2081,7 +2082,7 @@ restart:
 
                if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
                        spin_unlock(&bufqspin);
 
                if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
                        spin_unlock(&bufqspin);
-                       tsleep(&bd_request, 0, "gnbxxx", hz / 100);
+                       tsleep(&bd_request, 0, "gnbxxx", (hz + 99) / 100);
                        goto restart;
                }
                if (bp->b_qindex != qindex) {
                        goto restart;
                }
                if (bp->b_qindex != qindex) {