 -		DEBUG_BMPCE(PLL_INFO, e, " ");
 -
 -		if (!biorq_is_my_bmpce(r, e)) {
--			/* For pages not owned by this request,
--			 *    wait for them to become DATARDY
--			 *    or to have failed.
+-			/*
+-			 * For pages not owned by this request, wait for
+-			 * them to become DATARDY or to have failed.
 -			 */
 -			while (!(e->bmpce_flags &
 -			    (BMPCE_DATARDY | BMPCE_EIO | BMPCE_AIOWAIT))) {

 	    (b)->biorq_buf, (b)->biorq_fsrqi, (b)->biorq_last_sliod,	\
 	    psc_dynarray_len(&(b)->biorq_pages), (b)->biorq_bmap,	\
 	    PSCPRI_TIMESPEC_ARGS(&(b)->biorq_expire), ## __VA_ARGS__)
@@ -355,20 +357,6 @@
 };
 
 static __inline void

+		rc = 0;
+		if (op == SRMT_WRITE) {
+			q = r->biorq_fsrqi;
+			/* the waitq of biorq is used for bmpce, so this hackery */
+			while (1) {
+				locked = MFH_RLOCK(q->mfsrq_fh);
+				BIORQ_LOCK(r);
+				if (!(r->biorq_flags & BIORQ_AIOWAIT)) {
+					BIORQ_ULOCK(r);
+					MFH_URLOCK(q->mfsrq_fh, locked);
+					break;
+				}
+				BIORQ_ULOCK(r);
+				q->mfsrq_flags |= MFSRQ_AIOWAIT;
+				DEBUG_BIORQ(PLL_INFO, r, "aiowait sleep, q = %p", q);
+				psc_waitq_wait(&msl_fhent_flush_waitq, 
+					&q->mfsrq_fh->mfh_lock);
+			}
+			rc = -EAGAIN;
+		}
+	}
