mdadm/mdadm-3.2.3-Bitmap_offset-is-a-signed-number.patch
Jes Sorensen 6148d71c1d Fix a large number of bzs:
- Fix Monitor mode sometimes crashes when a resync completes
- Fix missing symlink for mdadm container device when incremental creates
  the array
- Make sure when creating a second array in a container that the second
  array uses all available space since leaving space for a third array
  is invalid
- Validate the number of imsm volumes per controller
- Fix issues with imsm arrays and disks larger than 2TB
- Add support for expanding imsm arrays/containers
- The support for expanding imsm arrays/containers was accepted upstream,
  update to the official patches from there
- Fix for the issue of --add not being very smart
- Fix an issue causing rebuilds to fail to restart on reboot (data
  corrupter level problem)
- Reset the bad flag on map file updates
- Correctly fix failure when trying to add internal bitmap to 1.0 arrays
- Resolves: bz817023 (f17) bz817024 (f17) bz817026 (f17) bz817028 (f17)
- Resolves: bz817029 (f17) bz817032 (f17) bz817038 (f17) bz808774 (f17)
- Resolves: bz817039 (f17) bz817042 (f17)

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
2012-04-30 17:50:18 +02:00

67 lines
2.2 KiB
Diff

From fbdef49811c9e2b54e2064d9af68cfffa77c6e77 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Wed, 4 Apr 2012 14:00:42 +1000
Subject: [PATCH] Bitmap_offset is a signed number
As the bitmap can be before the superblock, bitmap_offset is signed.
But some of the code didn't honour that :-(
Signed-off-by: NeilBrown <neilb@suse.de>
---
mdadm.h | 2 +-
super1.c | 4 ++--
sysfs.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mdadm.h b/mdadm.h
index 941cffa..9f58800 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -211,7 +211,7 @@ struct mdinfo {
unsigned long long recovery_start; /* per-device rebuild position */
#define MaxSector (~0ULL) /* resync/recovery complete position */
};
- unsigned long bitmap_offset; /* 0 == none, 1 == a file */
+ long bitmap_offset; /* 0 == none, 1 == a file */
unsigned long safe_mode_delay; /* ms delay to mark clean */
int new_level, delta_disks, new_layout, new_chunk;
int errors;
diff --git a/super1.c b/super1.c
index 20f4c86..2770a7f 100644
--- a/super1.c
+++ b/super1.c
@@ -620,7 +620,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
info->data_offset = __le64_to_cpu(sb->data_offset);
info->component_size = __le64_to_cpu(sb->size);
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_BITMAP_OFFSET))
- info->bitmap_offset = __le32_to_cpu(sb->bitmap_offset);
+ info->bitmap_offset = (long)__le32_to_cpu(sb->bitmap_offset);
info->disk.major = 0;
info->disk.minor = 0;
@@ -1636,7 +1636,7 @@ add_internal_bitmap1(struct supertype *st,
offset = -room;
}
- sb->bitmap_offset = __cpu_to_le32(offset);
+ sb->bitmap_offset = (long)__cpu_to_le32(offset);
sb->feature_map = __cpu_to_le32(__le32_to_cpu(sb->feature_map)
| MD_FEATURE_BITMAP_OFFSET);
diff --git a/sysfs.c b/sysfs.c
index cddabae..a1007cf 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -226,7 +226,7 @@ struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options)
else if (strncmp(buf, "none", 4) == 0)
sra->bitmap_offset = 0;
else if (buf[0] == '+')
- sra->bitmap_offset = strtoul(buf+1, NULL, 10);
+ sra->bitmap_offset = strtol(buf+1, NULL, 10);
else
goto abort;
}
--
1.7.7.6