block: do not drain while holding the graph lock
Merge Request Required Information
Summary of Changes
This fixes some deadlocks that are caused by draining (and therefore polling) while holding the graph lock.
The backport contains only the first part of the series, which was independently merged upstream and contains the fix for the deadlock, and omits the second part which only contains further code cleanups and GRAPH_UNLOCKED annotations to prevent future bugs.