[PATCH 5.17 226/298] md: protect md_unregister_thread from reentrancy