Bug 922944 - adding write-intent bitmap overwrites data on raid device when data offset on a component device is too small
Summary: adding write-intent bitmap overwrites data on raid device when data offset on...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: mdadm
Version: 25
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Nigel Croxon
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-18 20:26 UTC by Lars Wijtemans
Modified: 2017-06-01 16:24 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-01 16:24:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Bash script to reproduce (2.92 KB, application/x-shellscript)
2013-03-18 20:26 UTC, Lars Wijtemans
no flags Details
patch (1.05 KB, patch)
2013-03-21 04:45 UTC, Lars Wijtemans
no flags Details | Diff

Description Lars Wijtemans 2013-03-18 20:26:48 UTC
Created attachment 712230 [details]
Bash script to reproduce

Description of problem:
When adding a write-intent bitmap to an array with a component device which has a low data offset (16 sectors), the bitmap gets written to the data portion of the array. This will be the case with an array that was created as raid0 and converted to raid5. It appears this causes data corruption in the first portion of the array (up to data_disks * chunk_size)

Version-Release number of selected component (if applicable):
3.2.6-7.fc17

Steps to Reproduce:
1. Create raid0 array
2. Convert array to raid5 (add disk)
3. Put some data on the array
4. Try to add write-intent bitmap
5. Verify data

Actual results:
The data is changed when adding write-intent bitmap

Expected results:
The data is not changed when adding write-intent bitmap

Additional info:
$ mdadm --grow --bitmap=internal --bitmap-chunk=512M /dev/md/bulk
mdadm: failed to set internal bitmap.

$ dmesg | tail
kernel: [  543.768771] created bitmap (2 pages) for device md124
kernel: [  543.768778] md124: bitmap file is out of date, doing full recovery
kernel: [  543.778904] md124: bitmap initialisation failed: -5

$ dd if=/dev/md/bulk bs=16 count=16 | hexdump -C
00000000  62 69 74 6d 04 00 00 00  4d 11 94 a9 39 85 3d 14  |bitm....M...9.=.|

Comment 1 Jes Sorensen 2013-03-19 07:37:00 UTC
Lars,

Did you report this to the upstream mailing list, or is this the first reporting
of this incident?

Thanks,
Jes

Comment 2 Lars Wijtemans 2013-03-19 10:49:52 UTC
This is the first time, I didn't know where else to report it.

Comment 3 Jes Sorensen 2013-03-20 15:48:37 UTC
I have been trying this out here, but with a slightly different system,
also mdadm-3.2.6-7, but with kernel 3.7.0-rc1+.

What kernel did you run your tests with?


.....
mdadm: added /dev/loop1
Writing random data

This looks ok to me:

Array device contains:
00000000  88 80 7f 70 88 02 2e ee  0d 40 ff ba 23 82 38 e1  |...p.....@..#.8.|
00000010  42 94 22 30 80 28 4e 62  ec b8 24 28 b5 70 b8 67  |B."0.(Nb..$(.p.g|
00000020  4b eb 29 60 08 3c 0a 8e  71 7c 6d 6e 16 e9 74 09  |K.)`.<..q|mn..t.|
00000030

Array device contains:
00000000  88 80 7f 70 88 02 2e ee  0d 40 ff ba 23 82 38 e1  |...p.....@..#.8.|
00000010  42 94 22 30 80 28 4e 62  ec b8 24 28 b5 70 b8 67  |B."0.(Nb..$(.p.g|
00000020  4b eb 29 60 08 3c 0a 8e  71 7c 6d 6e 16 e9 74 09  |K.)`.<..q|mn..t.|
00000030
press return to continue with cleanup

Cheers,
Jes

Comment 4 Lars Wijtemans 2013-03-21 04:44:03 UTC
Hi Jes,

It seems you have run it with the workaround (the /dev/loop1 is the tell-tale). You should choose 'n' at the beginning. It's good to see that works ;)

I've seen the bug with these versions:
kernel.x86_64  3.7.6-102.fc17
mdadm.x86_64   3.2.6-7.fc17

kernel.i686    3.6.10-4.fc18
mdadm.i686     3.2.6-1.fc18

kernel.x86_64  3.8.3-203.fc18
mdadm.x86_64   3.2.6-14.fc18

kernel.x86_64  3.9.0-0.rc3.git0.5.fc20
mdadm.x86_64   3.2.6-15.fc19

The patch I added solves the bug for me. One part prevents overwriting the data, the other part actually reserves space when creating a raid0, but I don't know whether it has side-effects.

Comment 5 Lars Wijtemans 2013-03-21 04:45:12 UTC
Created attachment 713595 [details]
patch

Comment 6 Fedora End Of Life 2013-07-03 22:55:27 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Jes Sorensen 2013-11-28 15:40:12 UTC
Don't want to drop this one - moving to 19

Comment 8 Lars Wijtemans 2013-12-03 23:40:39 UTC
Fedora 20 has a new version of mdadm, 3.3

With this version, the minimum data_offset defaults to 2 * chunk_size. When using this default data_offset, the bug will not manifest.
( commit http://git.neil.brown.name/?p=mdadm.git;a=commitdiff;h=cb19a251a581fe78dcddd1d95dca4d8cb7664819 )

However, the bug is still there and data will be overwritten when data_offset is too small. This can be caused by using the new (as of mdadm 3.3) argument --data-offset, or by using a raid-array created with an older version of mdadm (<= 3.2.6)

Also, with mdadm-3.3, the previous workaround does not work any more for reasons unknown to me.

Comment 9 Fedora End Of Life 2015-01-09 17:46:48 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Fedora End Of Life 2015-02-17 14:52:19 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 11 Jes Sorensen 2015-02-17 15:29:07 UTC
I still want to keep an eye on this one.

Comment 12 Fedora End Of Life 2015-11-04 15:40:42 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 13 Fedora End Of Life 2015-12-02 02:45:13 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 14 Fedora End Of Life 2016-07-19 18:57:45 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 15 Jan Kurik 2016-07-26 04:23:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 16 Nigel Croxon 2017-06-01 16:24:35 UTC
Closing due to EOL.


Note You need to log in before you can comment on or make changes to this bug.