Skip to contentSkip to conversation

rbd: flush dcache after zeroing page data

PATCH In review Alex Elder 2 participants 3 messages May 23, 2013

Subsystems (2)
lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 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/4777
---
 drivers/block/rbd.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/block/rbd.c +0 -0
index 6e377a0..f860dd6 100644
@@ -1124,6 +1124,7 @@ static void zero_bio_chain(struct bio *chain, int

start_ofs)
buf = bvec_kmap_irq(bv, &flags); memset(buf + remainder, 0,
bv->bv_len - remainder);
+ flush_dcache_page(bv->bv_page);
bvec_kunmap_irq(buf, &flags);
}
pos += bv->bv_len;
@@ -1156,6 +1157,7 @@ static void zero_pages(struct page **pages, u64 offset, u64 end)
local_irq_save(flags);
kaddr = kmap_atomic(*page);
memset(kaddr + page_offset, 0, length);
+ flush_dcache_page(*page);
kunmap_atomic(kaddr); local_irq_restore(flags);

Signature · 1 line
1.7.9.5
author
#1 lore raw
Quoted 9 lines · Alex Elder

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/4777

This patch and the other two I just posted are available in the "review/wip-rbd" branch of the ceph-client git repository.

-Alex

Reviewed-by on v1 1/1
#2 lore raw
In reply to Alex Elder
Quoted 35 lines · Alex Elder

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/4777
---
  drivers/block/rbd.c |    2 ++
  1 file changed, 2 insertions(+)
drivers/block/rbd.c +1 -0
index 6e377a0..f860dd6 100644
@@ -1124,6 +1124,7 @@ static void zero_bio_chain(struct bio *chain, int
 start_ofs)
  				buf = bvec_kmap_irq(bv, &flags);
  				memset(buf + remainder, 0,
  				       bv->bv_len - remainder);
+				flush_dcache_page(bv->bv_page);
  				bvec_kunmap_irq(buf, &flags);
  			}
  			pos += bv->bv_len;
drivers/block/rbd.c +1 -0
@@ -1156,6 +1157,7 @@ static void zero_pages(struct page **pages, u64
 offset, u64 end)
  		local_irq_save(flags);
  		kaddr = kmap_atomic(*page);
  		memset(kaddr + page_offset, 0, length);
+		flush_dcache_page(*page);
  		kunmap_atomic(kaddr);
  		local_irq_restore(flags);