Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1655354

[PATCH 3.16 131/212] dm cache: fix corruption seen when using cache > 2TB

Path csiph.com!feeder.erje.net!1.eu.feeder.erje.net!news.unit0.net!news.mixmin.net!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.kernel
Subject [PATCH 3.16 131/212] dm cache: fix corruption seen when using cache > 2TB
Date Thu, 01 Jun 2017 18:10:05 +0200
Message-ID <tNAPH-4Ly-87@gated-at.bofh.it> (permalink)
References <tNAwh-4oP-3@gated-at.bofh.it>
X-Original-To linux-kernel@vger.kernel.org, stable@vger.kernel.org
Content-Type text/plain; charset="UTF-8"
Content-Disposition inline
Content-Transfer-Encoding 8bit
MIME-Version 1.0
X-Mailer LinuxStableQueue (scripts by bwh)
X-Sa-Exim-Connect-IP 82.70.136.246
X-Sa-Exim-Mail-From ben@decadent.org.uk
X-Sa-Exim-Scanned No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 46
Organization linux.* mail to news gateway
X-Original-Cc akpm@linux-foundation.org, "Joe Thornber" <ejt@redhat.com>, "Mike Snitzer" <snitzer@redhat.com>
X-Original-Date Thu, 01 Jun 2017 16:43:16 +0100
X-Original-Message-ID <lsq.1496331796.815554252@decadent.org.uk>
X-Original-References <lsq.1496331794.574686034@decadent.org.uk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1655354

Show key headers only | View raw


3.16.44-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Joe Thornber <ejt@redhat.com>

commit ca763d0a53b264a650342cee206512bc92ac7050 upstream.

A rounding bug due to compiler generated temporary being 32bit was found
in remap_to_cache().  A localized cast in remap_to_cache() fixes the
corruption but this preferred fix (changing from uint32_t to sector_t)
eliminates potential for future rounding errors elsewhere.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/dm-cache-target.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -210,7 +210,7 @@ struct cache {
 	/*
 	 * Fields for converting from sectors to blocks.
 	 */
-	uint32_t sectors_per_block;
+	sector_t sectors_per_block;
 	int sectors_per_block_shift;
 
 	spinlock_t lock;
@@ -2823,11 +2823,11 @@ static void cache_status(struct dm_targe
 
 		residency = policy_residency(cache->policy);
 
-		DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %lu ",
+		DMEMIT("%u %llu/%llu %llu %llu/%llu %u %u %u %u %u %u %lu ",
 		       (unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT),
 		       (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata),
 		       (unsigned long long)nr_blocks_metadata,
-		       cache->sectors_per_block,
+		       (unsigned long long)cache->sectors_per_block,
 		       (unsigned long long) from_cblock(residency),
 		       (unsigned long long) from_cblock(cache->cache_size),
 		       (unsigned) atomic_read(&cache->stats.read_hit),

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.16 131/212] dm cache: fix corruption seen when using  cache > 2TB Ben Hutchings <ben@decadent.org.uk> - 2017-06-01 18:10 +0200

csiph-web