Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] md: make sure 64bit fields in version-1 metadata are 64-bit aligned

reshape_position is a 64bit field that was not 64bit aligned. So swap with
new_level.

NOTE: this is a user-visible change. However:
- The bad code has not appeared in a released kernel
- This code is still marked 'experimental'
- This only affects version-1 superblock, which are not in wide use
- These field are only used (rather than simply reported) by user-space
tools in extemely rare circumstances : after a reshape crashes in the
first second of the reshape process.

So I believe that, at this stage, the change is safe. Especially if people
heed the 'help' message on use mdadm-2.4.1.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

NeilBrown and committed by
Linus Torvalds
6f91fe88 54404e72

+7 -6
+6 -5
drivers/md/Kconfig
··· 139 139 is online. However it is still EXPERIMENTAL code. It should 140 140 work, but please be sure that you have backups. 141 141 142 - You will need a version of mdadm newer than 2.3.1. During the 143 - early stage of reshape there is a critical section where live data 144 - is being over-written. A crash during this time needs extra care 145 - for recovery. The newer mdadm takes a copy of the data in the 146 - critical section and will restore it, if necessary, after a crash. 142 + You will need mdadm verion 2.4.1 or later to use this 143 + feature safely. During the early stage of reshape there is 144 + a critical section where live data is being over-written. A 145 + crash during this time needs extra care for recovery. The 146 + newer mdadm takes a copy of the data in the critical section 147 + and will restore it, if necessary, after a crash. 147 148 148 149 The mdadm usage is e.g. 149 150 mdadm --grow /dev/md1 --raid-disks=6
+1 -1
include/linux/raid/md_p.h
··· 227 227 */ 228 228 229 229 /* These are only valid with feature bit '4' */ 230 - __u64 reshape_position; /* next address in array-space for reshape */ 231 230 __u32 new_level; /* new level we are reshaping to */ 231 + __u64 reshape_position; /* next address in array-space for reshape */ 232 232 __u32 delta_disks; /* change in number of raid_disks */ 233 233 __u32 new_layout; /* new layout */ 234 234 __u32 new_chunk; /* new chunk size (bytes) */