浏览代码

[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>
NeilBrown 19 年之前
父节点
当前提交
6f91fe88e4
共有 2 个文件被更改,包括 7 次插入6 次删除
  1. 6 5
      drivers/md/Kconfig
  2. 1 1
      include/linux/raid/md_p.h

+ 6 - 5
drivers/md/Kconfig

@@ -139,11 +139,12 @@ config MD_RAID5_RESHAPE
 	  is online.  However it is still EXPERIMENTAL code.  It should
 	  is online.  However it is still EXPERIMENTAL code.  It should
 	  work, but please be sure that you have backups.
 	  work, but please be sure that you have backups.
 
 
-	  You will need a version of mdadm newer than 2.3.1.   During the
-	  early stage of reshape there is a critical section where live data
-	  is being over-written.  A crash during this time needs extra care
-	  for recovery.  The newer mdadm takes a copy of the data in the
-	  critical section and will restore it, if necessary, after a crash.
+	  You will need mdadm verion 2.4.1 or later to use this
+	  feature safely.  During the early stage of reshape there is
+	  a critical section where live data is being over-written.  A
+	  crash during this time needs extra care for recovery.  The
+	  newer mdadm takes a copy of the data in the critical section
+	  and will restore it, if necessary, after a crash.
 
 
 	  The mdadm usage is e.g.
 	  The mdadm usage is e.g.
 	       mdadm --grow /dev/md1 --raid-disks=6
 	       mdadm --grow /dev/md1 --raid-disks=6

+ 1 - 1
include/linux/raid/md_p.h

@@ -227,8 +227,8 @@ struct mdp_superblock_1 {
 				 */
 				 */
 
 
 	/* These are only valid with feature bit '4' */
 	/* These are only valid with feature bit '4' */
-	__u64	reshape_position;	/* next address in array-space for reshape */
 	__u32	new_level;	/* new level we are reshaping to		*/
 	__u32	new_level;	/* new level we are reshaping to		*/
+	__u64	reshape_position;	/* next address in array-space for reshape */
 	__u32	delta_disks;	/* change in number of raid_disks		*/
 	__u32	delta_disks;	/* change in number of raid_disks		*/
 	__u32	new_layout;	/* new layout					*/
 	__u32	new_layout;	/* new layout					*/
 	__u32	new_chunk;	/* new chunk size (bytes)			*/
 	__u32	new_chunk;	/* new chunk size (bytes)			*/