I've instrumented the scrub alloctions to check for the GFP_NOFS context and whether the device_list_mutex is not held. This caught one allocation, and I've used the instrumented code to verify that Filipe's scrub/reclaim fix is correct.
There are some debugging helpers need that live in the generic code so I'm posting only results. The patches are in branch dev/locks-not-held in my devel repos. David Sterba (2): btrfs: scrub: pass fs_info to scrub_setup_ctx btrfs: scrub: move scrub_setup_ctx allocation out of device_list_mutex fs/btrfs/scrub.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) -- 2.19.1