Commit 24e066d
btrfs: don't skip remaining extrefs if dir not found during log replay
During log replay, at add_inode_ref(), if we have an extref item that
contains multiple extrefs and one of them points to a directory that does
not exist in the subvolume tree, we are supposed to ignore it and process
the remaining extrefs encoded in the extref item, since each extref can
point to a different parent inode. However when that happens we just
return from the function and ignore the remaining extrefs.
The problem has been around since extrefs were introduced, in commit
f186373 ("btrfs: extended inode refs"), but it's hard to hit in
practice because getting extref items encoding multiple extref requires
getting a hash collision when computing the offset of the extref's
key. The offset if computed like this:
key.offset = btrfs_extref_hash(dir_ino, name->name, name->len);
and btrfs_extref_hash() is just a wrapper around crc32c().
Fix this by moving to next iteration of the loop when we don't find
the parent directory that an extref points to.
Fixes: f186373 ("btrfs: extended inode refs")
CC: [email protected] # 6.1+
Reviewed-by: Boris Burkov <[email protected]>
Signed-off-by: Filipe Manana <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent 7ebf381 commit 24e066d
1 file changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1433 | 1433 | | |
1434 | 1434 | | |
1435 | 1435 | | |
| 1436 | + | |
| 1437 | + | |
1436 | 1438 | | |
1437 | 1439 | | |
1438 | 1440 | | |
| |||
1449 | 1451 | | |
1450 | 1452 | | |
1451 | 1453 | | |
1452 | | - | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
1453 | 1460 | | |
| 1461 | + | |
| 1462 | + | |
1454 | 1463 | | |
1455 | 1464 | | |
1456 | 1465 | | |
1457 | 1466 | | |
1458 | 1467 | | |
| 1468 | + | |
| 1469 | + | |
1459 | 1470 | | |
1460 | | - | |
1461 | | - | |
1462 | 1471 | | |
1463 | 1472 | | |
1464 | 1473 | | |
| |||
1492 | 1501 | | |
1493 | 1502 | | |
1494 | 1503 | | |
| 1504 | + | |
1495 | 1505 | | |
1496 | 1506 | | |
1497 | 1507 | | |
1498 | | - | |
| 1508 | + | |
1499 | 1509 | | |
1500 | 1510 | | |
1501 | 1511 | | |
| |||
0 commit comments