From patchwork Thu May 23 12:11:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2606501 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 17C3B3FDBC for ; Thu, 23 May 2013 12:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758352Ab3EWMLr (ORCPT ); Thu, 23 May 2013 08:11:47 -0400 Received: from mail-ie0-f177.google.com ([209.85.223.177]:38821 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753645Ab3EWMLq (ORCPT ); Thu, 23 May 2013 08:11:46 -0400 Received: by mail-ie0-f177.google.com with SMTP id 9so8329678iec.22 for ; Thu, 23 May 2013 05:11:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=yetuoyKSUrnx3e2l6hU14gaiCeGQ/CtLMrYrcNFnHQw=; b=Bd5I4gqPYl9k2PxJkNyYVSm16qOrVj3NDqkE2r/H6I/T8vWAuz4gMy+BsHf2iTHf30 T1fDHtn/V0GBwOU5vRLK3KgOPzYLKcF7llCkGBABE/yLfw0MgRuUFkBGX1bVSZJrMm4z H/AGytU/JpwhSymnamRaweXPdEjmX8f1uewYp3X81HoDzYxxp04GCMN7BZh1WEp4qkE9 WtQl2KpnQCEv+WFa1aYyq236KS1aZZrPFX68IpvfF67FESZ6xwy63TC7Ub7K0yfAKAPK /6CWcKsNjmT2qsMnid+K1VqAnV+6HoEJM5PnUeMBkG9exyUeAhBVuEp1d3CdXuM8i9V3 YYzw== X-Received: by 10.50.22.106 with SMTP id c10mr1503242igf.14.1369311106275; Thu, 23 May 2013 05:11:46 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id uv10sm11577183igb.3.2013.05.23.05.11.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 05:11:45 -0700 (PDT) Message-ID: <519E0781.4000603@inktank.com> Date: Thu, 23 May 2013 07:11:45 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH] rbd: flush dcache after zeroing page data X-Gm-Message-State: ALoCoQmVWjw0UBufucwc5j+8zgJQjiz9RM0O3JSHNR5irgLMdmVOw0N9mxoWdWDK3AuBvnHiiNlA Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org 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 Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+) 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); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 6e377a0..f860dd6 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -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); }