md: fix possible deadlock in handling flush requests.