Commit de134cb
btrfs: fix squota compressed stats leak
The following workload on a squota enabled fs:
btrfs subvol create mnt/subvol
# ensure subvol extents get accounted
sync
btrfs qgroup create 1/1 mnt
btrfs qgroup assign mnt/subvol 1/1 mnt
btrfs qgroup delete mnt/subvol
# make the cleaner thread run
btrfs filesystem sync mnt
sleep 1
btrfs filesystem sync mnt
btrfs qgroup destroy 1/1 mnt
will fail with EBUSY. The reason is that 1/1 does the quick accounting
when we assign subvol to it, gaining its exclusive usage as excl and
excl_cmpr. But then when we delete subvol, the decrement happens via
record_squota_delta() which does not update excl_cmpr, as squotas does
not make any distinction between compressed and normal extents. Thus,
we increment excl_cmpr but never decrement it, and are unable to delete
1/1. The two possible fixes are to make squota always mirror excl and
excl_cmpr or to make the fast accounting separately track the plain and
cmpr numbers. The latter felt cleaner to me so that is what I opted for.
Fixes: 1e0e9d5 ("btrfs: add helper for recording simple quota deltas")
CC: [email protected] # 6.12+
Reviewed-by: Qu Wenruo <[email protected]>
Signed-off-by: Boris Burkov <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent 986bf6e commit de134cb
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1455 | 1455 | | |
1456 | 1456 | | |
1457 | 1457 | | |
| 1458 | + | |
1458 | 1459 | | |
1459 | 1460 | | |
1460 | 1461 | | |
| |||
1466 | 1467 | | |
1467 | 1468 | | |
1468 | 1469 | | |
1469 | | - | |
| 1470 | + | |
1470 | 1471 | | |
1471 | 1472 | | |
| 1473 | + | |
1472 | 1474 | | |
1473 | | - | |
| 1475 | + | |
1474 | 1476 | | |
1475 | 1477 | | |
1476 | 1478 | | |
| |||
0 commit comments