* a single ib_post_send() call.
         */
        prev = &first;
-       while ((mr = rpcrdma_mr_pop(&req->rl_registered))) {
-
+       mr = rpcrdma_mr_pop(&req->rl_registered);
+       do {
                trace_xprtrdma_mr_localinv(mr);
                r_xprt->rx_stats.local_inv_needed++;
 
 
                *prev = last;
                prev = &last->next;
-       }
+       } while ((mr = rpcrdma_mr_pop(&req->rl_registered)));
+
        mr = container_of(last, struct rpcrdma_mr, mr_invwr);
 
        /* Strong send queue ordering guarantees that when the
         * a single ib_post_send() call.
         */
        prev = &first;
-       while ((mr = rpcrdma_mr_pop(&req->rl_registered))) {
-
+       mr = rpcrdma_mr_pop(&req->rl_registered);
+       do {
                trace_xprtrdma_mr_localinv(mr);
                r_xprt->rx_stats.local_inv_needed++;
 
 
                *prev = last;
                prev = &last->next;
-       }
+       } while ((mr = rpcrdma_mr_pop(&req->rl_registered)));
 
        /* Strong send queue ordering guarantees that when the
         * last WR in the chain completes, all WRs in the chain