diff options
| author | Mani Tofigh <mt4022@columbia.edu> | 2026-11-03 15:03:21 -0500 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-11-09 18:50:58 +0100 |
| commit | d27d0039bc1334be8a72c769e14c0b0c3efc317d (patch) | |
| tree | 62bdd3c1dedc63a007e2fd489c0d4627a1d01442 /tools/lib/python/kdoc/python_version.py | |
| parent | a1250669825f96ecc7045ab1b10cdc3d8832339d (diff) | |
| download | linux-next-d27d0039bc1334be8a72c769e14c0b0c3efc317d.tar.gz linux-next-d27d0039bc1334be8a72c769e14c0b0c3efc317d.zip | |
btrfs: fix bio counter and bioc leak when async checksumming fails
A single failed checksum allocation can make a later device replace
hang forever. btrfs_submit_chunk() takes a dev-replace bio counter
reference and a bioc before it hands a write to the checksum worker.
If the checksum fails there (e.g., its allocation fails),
run_one_async_done() ends the bio but drops neither. The counter then
never gets back to zero and the next replace waits for it:
[ 8.369] BTRFS info (device ram0): dev_replace from /dev/ram0 (devid 1) to /dev/ram1 finished
[41.534] INFO: task btrfscsum:80 blocked for more than 20 seconds.
[41.534] btrfs_rm_dev_replace_blocked+0x135/0x180
[41.534] btrfs_dev_replace_finishing+0xefe/0x13b0
The worker is only used when CONFIG_BTRFS_EXPERIMENTAL is off and the
checksum isn't a fast one, e.g., sha256. We hit it on a sha256
filesystem.
We put the bioc and drop the counter in that error branch. We also
put the bioc on the synchronous error path and on the btrfs_split_bio()
error path, which both only drop the counter. With the fix, the
replace doesn't hang anymore.
This bug was identified and confirmed with the help of fault-injection
testing on a deterministic hypervisor currently under development. Our
C reproducer however hits it within about 35s.
Fixes: f8a53bb58ec7 ("btrfs: handle checksum generation in the storage layer")
Fixes: c7c97ceff98c ("btrfs: handle bio_split() errors")
CC: stable@vger.kernel.org # 6.6+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
