Commit d8ccbd2
btrfs: remove BUG_ON()'s in add_new_free_space()
At add_new_free_space() we have these BUG_ON()'s that are there to deal
with any failure to add free space to the in memory free space cache.
Such failures are mostly -ENOMEM that should be very rare. However there's
no need to have these BUG_ON()'s, we can just return any error to the
caller and all callers and their upper call chain are already dealing with
errors.
So just make add_new_free_space() return any errors, while removing the
BUG_ON()'s, and returning the total amount of added free space to an
optional u64 pointer argument.
Reported-by: syzbot+3ba856e07b7127889d8c@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-btrfs/000000000000e9cb8305ff4e8327@google.com/
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 8dbfc14 commit d8ccbd2
3 files changed
+53
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
| 502 | + | |
| 503 | + | |
503 | 504 | | |
504 | 505 | | |
505 | | - | |
| 506 | + | |
506 | 507 | | |
507 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
508 | 512 | | |
509 | 513 | | |
510 | 514 | | |
| |||
517 | 521 | | |
518 | 522 | | |
519 | 523 | | |
520 | | - | |
521 | 524 | | |
522 | 525 | | |
523 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
524 | 530 | | |
525 | 531 | | |
526 | 532 | | |
| |||
529 | 535 | | |
530 | 536 | | |
531 | 537 | | |
532 | | - | |
533 | 538 | | |
534 | 539 | | |
535 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
536 | 544 | | |
537 | 545 | | |
538 | | - | |
| 546 | + | |
539 | 547 | | |
540 | 548 | | |
541 | 549 | | |
| |||
779 | 787 | | |
780 | 788 | | |
781 | 789 | | |
782 | | - | |
783 | | - | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
784 | 797 | | |
785 | 798 | | |
786 | 799 | | |
| |||
795 | 808 | | |
796 | 809 | | |
797 | 810 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | 811 | | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
803 | 815 | | |
804 | 816 | | |
805 | 817 | | |
| |||
2294 | 2306 | | |
2295 | 2307 | | |
2296 | 2308 | | |
2297 | | - | |
2298 | | - | |
| 2309 | + | |
| 2310 | + | |
2299 | 2311 | | |
| 2312 | + | |
| 2313 | + | |
2300 | 2314 | | |
2301 | 2315 | | |
2302 | 2316 | | |
| |||
2740 | 2754 | | |
2741 | 2755 | | |
2742 | 2756 | | |
2743 | | - | |
2744 | | - | |
| 2757 | + | |
2745 | 2758 | | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
2746 | 2763 | | |
2747 | 2764 | | |
2748 | 2765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
293 | | - | |
| 292 | + | |
| 293 | + | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1515 | 1515 | | |
1516 | 1516 | | |
1517 | 1517 | | |
1518 | | - | |
1519 | | - | |
1520 | | - | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
1521 | 1525 | | |
1522 | 1526 | | |
1523 | 1527 | | |
| |||
1529 | 1533 | | |
1530 | 1534 | | |
1531 | 1535 | | |
1532 | | - | |
1533 | | - | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
1534 | 1539 | | |
1535 | 1540 | | |
1536 | 1541 | | |
| |||
1569 | 1574 | | |
1570 | 1575 | | |
1571 | 1576 | | |
| 1577 | + | |
| 1578 | + | |
1572 | 1579 | | |
1573 | 1580 | | |
1574 | 1581 | | |
| |||
1583 | 1590 | | |
1584 | 1591 | | |
1585 | 1592 | | |
1586 | | - | |
1587 | | - | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
1588 | 1598 | | |
1589 | 1599 | | |
1590 | 1600 | | |
| |||
0 commit comments