- /* I have seen this happen for swapfile. So it is safer to
- * check for dirty buffers again. --Umesh
- */
- if (vp->v_dirtyblkhd.lh_first || (vp->v_flag & VHASDIRTY)) {
- vprint("ffs_fsync: dirty", vp);
- splx(s);
+ if (vp->v_dirtyblkhd.lh_first) {
+ /* still have some dirty buffers */
+ if (retry++ > 10) {
+ vprint("ffs_fsync: dirty", vp);
+ splx(s);
+ /*
+ * Looks like the requests are not
+ * getting queued to the driver.
+ * Retrying here causes a cpu bound loop.
+ * Yield to the other threads and hope
+ * for the best.
+ */
+ (void)tsleep((caddr_t)&vp->v_numoutput,
+ PRIBIO + 1, "ffs_fsync", hz/10);
+ retry = 0;
+ } else {
+ splx(s);
+ }
+ /* try again */