This could actually be sporadically triggered with test case generic/094
from fstests, which reports a missing extent/delalloc range like this:
- generic/094 2s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/094.out.bad)
- --- tests/generic/094.out 2020-06-10 19:29:03.830519425 +0100
- +++ /home/fdmanana/git/hub/xfstests/results//generic/094.out.bad 2024-02-28 11:00:00.381071525 +0000
- @@ -1,3 +1,9 @@
- QA output created by 094
- fiemap run with sync
- fiemap run without sync
- +ERROR: couldn't find extent at 7
- +map is 'HHDDHPPDPHPH'
- +logical: [ 5.. 6] phys: 301517.. 301518 flags: 0x800 tot: 2
- +logical: [ 8.. 8] phys: 301520.. 301520 flags: 0x800 tot: 1
- ...
- (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/094.out /home/fdmanana/git/hub/xfstests/results//generic/094.out.bad' to see the entire diff)
+# generic/094 2s ... - output mismatch (see /home/fdmanana/git/hub/xfstests/results//generic/094.out.bad)
+# --- tests/generic/094.out 2020-06-10 19:29:03.830519425 +0100
+# +++ /home/fdmanana/git/hub/xfstests/results//generic/094.out.bad 2024-02-28 11:00:00.381071525 +0000
+# @@ -1,3 +1,9 @@
+# QA output created by 094
+# fiemap run with sync
+# fiemap run without sync
+# +ERROR: couldn't find extent at 7
+# +map is 'HHDDHPPDPHPH'
+# +logical: [ 5.. 6] phys: 301517.. 301518 flags: 0x800 tot: 2
+# +logical: [ 8.. 8] phys: 301520.. 301520 flags: 0x800 tot: 1
+# ...
+# (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/generic/094.out /home/fdmanana/git/hub/xfstests/results//generic/094.out.bad' to see the entire diff)
So in order to fix this, while still avoiding deadlocks in the case where
the fiemap buffer is memory mapped to the same file, change fiemap to work