diff options
| -rw-r--r-- | block/bio.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/block/bio.c b/block/bio.c index 67e51ace1b77..e4682ec11fcd 100644 --- a/block/bio.c +++ b/block/bio.c | |||
| @@ -1745,26 +1745,25 @@ static inline bool bio_remaining_done(struct bio *bio) | |||
| 1745 | **/ | 1745 | **/ |
| 1746 | void bio_endio(struct bio *bio) | 1746 | void bio_endio(struct bio *bio) |
| 1747 | { | 1747 | { |
| 1748 | while (bio) { | 1748 | again: |
| 1749 | if (unlikely(!bio_remaining_done(bio))) | 1749 | if (unlikely(!bio_remaining_done(bio))) |
| 1750 | break; | 1750 | return; |
| 1751 | 1751 | ||
| 1752 | /* | 1752 | /* |
| 1753 | * Need to have a real endio function for chained bios, | 1753 | * Need to have a real endio function for chained bios, otherwise |
| 1754 | * otherwise various corner cases will break (like stacking | 1754 | * various corner cases will break (like stacking block devices that |
| 1755 | * block devices that save/restore bi_end_io) - however, we want | 1755 | * save/restore bi_end_io) - however, we want to avoid unbounded |
| 1756 | * to avoid unbounded recursion and blowing the stack. Tail call | 1756 | * recursion and blowing the stack. Tail call optimization would |
| 1757 | * optimization would handle this, but compiling with frame | 1757 | * handle this, but compiling with frame pointers also disables |
| 1758 | * pointers also disables gcc's sibling call optimization. | 1758 | * gcc's sibling call optimization. |
| 1759 | */ | 1759 | */ |
| 1760 | if (bio->bi_end_io == bio_chain_endio) { | 1760 | if (bio->bi_end_io == bio_chain_endio) { |
| 1761 | bio = __bio_chain_endio(bio); | 1761 | bio = __bio_chain_endio(bio); |
| 1762 | } else { | 1762 | goto again; |
| 1763 | if (bio->bi_end_io) | ||
| 1764 | bio->bi_end_io(bio); | ||
| 1765 | bio = NULL; | ||
| 1766 | } | ||
| 1767 | } | 1763 | } |
| 1764 | |||
| 1765 | if (bio->bi_end_io) | ||
| 1766 | bio->bi_end_io(bio); | ||
| 1768 | } | 1767 | } |
| 1769 | EXPORT_SYMBOL(bio_endio); | 1768 | EXPORT_SYMBOL(bio_endio); |
| 1770 | 1769 | ||
