Commit e2156054 authored by Alex Elder's avatar Alex Elder Committed by Sage Weil

rbd: flush dcache after zeroing page data

Neither zero_bio_chain() nor zero_pages() contains a call to flush
caches after zeroing a portion of a page.  This can cause problems
on architectures that have caches that allow virtual address
aliasing.

This resolves:
    http://tracker.ceph.com/issues/4777Signed-off-by: default avatarAlex Elder <elder@inktank.com>
Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
parent 96e4dac6
...@@ -1126,6 +1126,7 @@ static void zero_bio_chain(struct bio *chain, int start_ofs) ...@@ -1126,6 +1126,7 @@ static void zero_bio_chain(struct bio *chain, int start_ofs)
buf = bvec_kmap_irq(bv, &flags); buf = bvec_kmap_irq(bv, &flags);
memset(buf + remainder, 0, memset(buf + remainder, 0,
bv->bv_len - remainder); bv->bv_len - remainder);
flush_dcache_page(bv->bv_page);
bvec_kunmap_irq(buf, &flags); bvec_kunmap_irq(buf, &flags);
} }
pos += bv->bv_len; pos += bv->bv_len;
...@@ -1158,6 +1159,7 @@ static void zero_pages(struct page **pages, u64 offset, u64 end) ...@@ -1158,6 +1159,7 @@ static void zero_pages(struct page **pages, u64 offset, u64 end)
local_irq_save(flags); local_irq_save(flags);
kaddr = kmap_atomic(*page); kaddr = kmap_atomic(*page);
memset(kaddr + page_offset, 0, length); memset(kaddr + page_offset, 0, length);
flush_dcache_page(*page);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
local_irq_restore(flags); local_irq_restore(flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment