Commit 0a1f127a0594d62cb23c26732686d0e2b097b264
Committed by
Linus Torvalds
1 parent
ca0297015d
Exists in
master
and in
4 other branches
aoe: prevent cache aliases
Prevent the AoE block driver from creating cache aliases of page cache pages on machines with virtually indexed caches. Building kernels on an AT91SAM9G20 board without this patch fails with segmentation faults after a couple of passes. Signed-off-by: Peter Horton <zero@colonel-panic.org> Cc: "Ed L. Cashin" <ecashin@coraid.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 21 additions and 2 deletions Side-by-side Diff
drivers/block/aoe/aoecmd.c
... | ... | @@ -735,6 +735,21 @@ |
735 | 735 | part_stat_unlock(); |
736 | 736 | } |
737 | 737 | |
738 | +/* | |
739 | + * Ensure we don't create aliases in VI caches | |
740 | + */ | |
741 | +static inline void | |
742 | +killalias(struct bio *bio) | |
743 | +{ | |
744 | + struct bio_vec *bv; | |
745 | + int i; | |
746 | + | |
747 | + if (bio_data_dir(bio) == READ) | |
748 | + __bio_for_each_segment(bv, bio, i, 0) { | |
749 | + flush_dcache_page(bv->bv_page); | |
750 | + } | |
751 | +} | |
752 | + | |
738 | 753 | void |
739 | 754 | aoecmd_ata_rsp(struct sk_buff *skb) |
740 | 755 | { |
... | ... | @@ -853,8 +868,12 @@ |
853 | 868 | |
854 | 869 | if (buf && --buf->nframesout == 0 && buf->resid == 0) { |
855 | 870 | diskstats(d->gd, buf->bio, jiffies - buf->stime, buf->sector); |
856 | - n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; | |
857 | - bio_endio(buf->bio, n); | |
871 | + if (buf->flags & BUFFL_FAIL) | |
872 | + bio_endio(buf->bio, -EIO); | |
873 | + else { | |
874 | + killalias(buf->bio); | |
875 | + bio_endio(buf->bio, 0); | |
876 | + } | |
858 | 877 | mempool_free(buf, d->bufpool); |
859 | 878 | } |
860 | 879 |