summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2012-10-20 11:44:27 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-10-20 11:54:49 -0400
commit799dcbf071cffe1dfcb44bc5670e64a637b2ed4c (patch)
tree5d41088ccd38e7f58ef89c0b3a6b3c9b0534f2c7
parentf16088264f01014097e6c3e3c9119b27500b93a8 (diff)
downloadlongterm-queue-2.6.34-799dcbf071cffe1dfcb44bc5670e64a637b2ed4c.tar.gz
md: add two fixes ; deferred from prev. release
See : ------------ commit 60ad92d2ff7601d8dbdd9262d113d379f20d31f0 Author: Paul Gortmaker <paul.gortmaker@windriver.com> Date: Wed Aug 15 16:54:38 2012 -0400 md: postpone 2TB/4TB patch until 2.6.34.14 ------------ Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--queue/md-Don-t-truncate-size-at-4TB-for-RAID0-and-Linear.patch60
-rw-r--r--queue/md-Fix-handling-for-devices-from-2TB-to-4TB-in-0.90-.patch70
-rw-r--r--queue/series2
3 files changed, 132 insertions, 0 deletions
diff --git a/queue/md-Don-t-truncate-size-at-4TB-for-RAID0-and-Linear.patch b/queue/md-Don-t-truncate-size-at-4TB-for-RAID0-and-Linear.patch
new file mode 100644
index 0000000..eb90991
--- /dev/null
+++ b/queue/md-Don-t-truncate-size-at-4TB-for-RAID0-and-Linear.patch
@@ -0,0 +1,60 @@
+From 786307dbd573c67e10aec8c85dfbe705421f1155 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Thu, 16 Aug 2012 16:46:12 +1000
+Subject: [PATCH 2/2] md: Don't truncate size at 4TB for RAID0 and Linear
+
+commit 667a5313ecd7308d79629c0738b0db588b0b0a4e upstream.
+
+commit 27a7b260f71439c40546b43588448faac01adb93
+ md: Fix handling for devices from 2TB to 4TB in 0.90 metadata.
+
+changed 0.90 metadata handling to truncated size to 4TB as that is
+all that 0.90 can record.
+However for RAID0 and Linear, 0.90 doesn't need to record the size, so
+this truncation is not needed and causes working arrays to become too small.
+
+So avoid the truncation for RAID0 and Linear
+
+This bug was introduced in 3.1 and is suitable for any stable kernels
+from then onwards.
+As the offending commit was tagged for 'stable', any stable kernel
+that it was applied to should also get this patch. That includes
+at least 2.6.32, 2.6.33 and 3.0. (Thanks to Ben Hutchings for
+providing that list).
+
+Signed-off-by: Neil Brown <neilb@suse.de>
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+---
+ drivers/md/md.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/md/md.c b/drivers/md/md.c
+index 4788c82..d8e5adc 100644
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -985,8 +985,11 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
+ ret = 0;
+ }
+ rdev->sectors = rdev->sb_start;
+- /* Limit to 4TB as metadata cannot record more than that */
+- if (rdev->sectors >= (2ULL << 32))
++ /* Limit to 4TB as metadata cannot record more than that.
++ * (not needed for Linear and RAID0 as metadata doesn't
++ * record this size)
++ */
++ if (rdev->sectors >= (2ULL << 32) && sb->level >= 1)
+ rdev->sectors = (2ULL << 32) - 2;
+
+ if (rdev->sectors < ((sector_t)sb->size) * 2 && sb->level >= 1)
+@@ -1266,7 +1269,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
+ /* Limit to 4TB as metadata cannot record more than that.
+ * 4TB == 2^32 KB, or 2*2^32 sectors.
+ */
+- if (num_sectors >= (2ULL << 32))
++ if (num_sectors >= (2ULL << 32) && rdev->mddev->level >= 1)
+ num_sectors = (2ULL << 32) - 2;
+ md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
+ rdev->sb_page);
+--
+1.7.12.1
+
diff --git a/queue/md-Fix-handling-for-devices-from-2TB-to-4TB-in-0.90-.patch b/queue/md-Fix-handling-for-devices-from-2TB-to-4TB-in-0.90-.patch
new file mode 100644
index 0000000..8570d30
--- /dev/null
+++ b/queue/md-Fix-handling-for-devices-from-2TB-to-4TB-in-0.90-.patch
@@ -0,0 +1,70 @@
+From d66226ab6a5f957129333293d4547afc6dca72fa Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Sat, 10 Sep 2011 17:21:28 +1000
+Subject: [PATCH 1/2] md: Fix handling for devices from 2TB to 4TB in 0.90
+ metadata.
+
+commit 27a7b260f71439c40546b43588448faac01adb93 upstream.
+
+0.90 metadata uses an unsigned 32bit number to count the number of
+kilobytes used from each device.
+This should allow up to 4TB per device.
+However we multiply this by 2 (to get sectors) before casting to a
+larger type, so sizes above 2TB get truncated.
+
+Also we allow rdev->sectors to be larger than 4TB, so it is possible
+for the array to be resized larger than the metadata can handle.
+So make sure rdev->sectors never exceeds 4TB when 0.90 metadata is in
+used.
+
+Also the sanity check at the end of super_90_load should include level
+1 as it used ->size too. (RAID0 and Linear don't use ->size at all).
+
+Reported-by: Pim Zandbergen <P.Zandbergen@macroscoop.nl>
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+---
+ drivers/md/md.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/md/md.c b/drivers/md/md.c
+index d26df7f..4788c82 100644
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -985,8 +985,11 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version
+ ret = 0;
+ }
+ rdev->sectors = rdev->sb_start;
++ /* Limit to 4TB as metadata cannot record more than that */
++ if (rdev->sectors >= (2ULL << 32))
++ rdev->sectors = (2ULL << 32) - 2;
+
+- if (rdev->sectors < sb->size * 2 && sb->level > 1)
++ if (rdev->sectors < ((sector_t)sb->size) * 2 && sb->level >= 1)
+ /* "this cannot possibly happen" ... */
+ ret = -EINVAL;
+
+@@ -1021,7 +1024,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
+ mddev->clevel[0] = 0;
+ mddev->layout = sb->layout;
+ mddev->raid_disks = sb->raid_disks;
+- mddev->dev_sectors = sb->size * 2;
++ mddev->dev_sectors = ((sector_t)sb->size) * 2;
+ mddev->events = ev1;
+ mddev->bitmap_info.offset = 0;
+ mddev->bitmap_info.default_offset = MD_SB_BYTES >> 9;
+@@ -1260,6 +1263,11 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors)
+ rdev->sb_start = calc_dev_sboffset(rdev->bdev);
+ if (!num_sectors || num_sectors > rdev->sb_start)
+ num_sectors = rdev->sb_start;
++ /* Limit to 4TB as metadata cannot record more than that.
++ * 4TB == 2^32 KB, or 2*2^32 sectors.
++ */
++ if (num_sectors >= (2ULL << 32))
++ num_sectors = (2ULL << 32) - 2;
+ md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
+ rdev->sb_page);
+ md_super_wait(rdev->mddev);
+--
+1.7.12.1
+
diff --git a/queue/series b/queue/series
index 3a5573a..ef4a10c 100644
--- a/queue/series
+++ b/queue/series
@@ -10,6 +10,8 @@ ALSA-hda-ALSA-HD-Audio-patch-for-Intel-Panther-Point.patch
ALSA-hda-Use-position_fix-1-for-Acer-Aspire-5538-to-.patch
cifs-fix-cifs-stable-patch-cifs-fix-oplock-break-han.patch
gro-reset-vlan_tci-on-reuse.patch
+md-Fix-handling-for-devices-from-2TB-to-4TB-in-0.90-.patch
+md-Don-t-truncate-size-at-4TB-for-RAID0-and-Linear.patch
# from .50
i2c-algo-bit-Generate-correct-i2c-address-sequence-f.patch