* [PATCH] super1: make write_bitmap1 compatible with previous mdadm versions
@ 2016-10-12 6:24 Guoqing Jiang
2016-10-19 15:21 ` Jes Sorensen
0 siblings, 1 reply; 2+ messages in thread
From: Guoqing Jiang @ 2016-10-12 6:24 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: linux-raid, Guoqing Jiang, Neil Brown
For older mdadm version, v1.x metadata has different bitmap_offset,
we can't ensure all the bitmaps are on a 4K boundary since writing
4K for bitmap could corrupt the superblock, and Anthony reported
the bug about it at below link.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837964
So let's check about the alignment for bitmap_offset before set
the boundary to 4096 unconditionally. Thanks for Neil's detailed
explanation.
Reported-by: Anthony DeRobertis <anthony@derobert.net>
Fixes: 95a05b37e8eb ("Create n bitmaps for clustered mode")
Cc: Neil Brown <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
---
super1.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/super1.c b/super1.c
index 9f62d23..4fef378 100644
--- a/super1.c
+++ b/super1.c
@@ -2433,7 +2433,15 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
memset(buf, 0xff, 4096);
memcpy(buf, (char *)bms, sizeof(bitmap_super_t));
- towrite = calc_bitmap_size(bms, 4096);
+ /*
+ * use 4096 boundary if bitmap_offset is aligned
+ * with 8 sectors, then it should compatible with
+ * older mdadm.
+ */
+ if (__le32_to_cpu(sb->bitmap_offset) & 7)
+ towrite = calc_bitmap_size(bms, 512);
+ else
+ towrite = calc_bitmap_size(bms, 4096);
while (towrite > 0) {
n = towrite;
if (n > 4096)
--
2.6.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] super1: make write_bitmap1 compatible with previous mdadm versions
2016-10-12 6:24 [PATCH] super1: make write_bitmap1 compatible with previous mdadm versions Guoqing Jiang
@ 2016-10-19 15:21 ` Jes Sorensen
0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2016-10-19 15:21 UTC (permalink / raw)
To: Guoqing Jiang; +Cc: linux-raid, Neil Brown
Guoqing Jiang <gqjiang@suse.com> writes:
> For older mdadm version, v1.x metadata has different bitmap_offset,
> we can't ensure all the bitmaps are on a 4K boundary since writing
> 4K for bitmap could corrupt the superblock, and Anthony reported
> the bug about it at below link.
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837964
>
> So let's check about the alignment for bitmap_offset before set
> the boundary to 4096 unconditionally. Thanks for Neil's detailed
> explanation.
>
> Reported-by: Anthony DeRobertis <anthony@derobert.net>
> Fixes: 95a05b37e8eb ("Create n bitmaps for clustered mode")
> Cc: Neil Brown <neilb@suse.com>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
> super1.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
Applied!
Thanks,
Jes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-19 15:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-12 6:24 [PATCH] super1: make write_bitmap1 compatible with previous mdadm versions Guoqing Jiang
2016-10-19 15:21 ` Jes Sorensen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.