Update mdadm to upstream v4.0
Resolves: bz#1411555 Signed-off-by: Xiao Ni <xni@redhat.com>
This commit is contained in:
		
							parent
							
								
									c950024ba2
								
							
						
					
					
						commit
						104980a243
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -20,3 +20,4 @@ clog | |||||||
| /mdadm-3.3.2.tar.xz | /mdadm-3.3.2.tar.xz | ||||||
| /mdadm-3.3.4.tar.xz | /mdadm-3.3.4.tar.xz | ||||||
| /mdadm-3.4.tar.xz | /mdadm-3.4.tar.xz | ||||||
|  | /mdadm-4.0.tar.xz | ||||||
|  | |||||||
| @ -1,18 +0,0 @@ | |||||||
| --- mdadm-3.2.4/Makefile.map-dir	2012-05-10 12:29:09.687578525 +0200
 |  | ||||||
| +++ mdadm-3.2.4/Makefile	2012-05-10 12:28:05.514380800 +0200
 |  | ||||||
| @@ -67,12 +67,12 @@
 |  | ||||||
|  # Both MAP_DIR and MDMON_DIR should be somewhere that persists across the |  | ||||||
|  # pivotroot from early boot to late boot. |  | ||||||
|  # /run is best, but for distros that don't support that, /dev can work. |  | ||||||
| -MAP_DIR=/run/mdadm
 |  | ||||||
| -MAP_FILE = map
 |  | ||||||
| +MAP_DIR=/dev/md
 |  | ||||||
| +MAP_FILE = md-device-map
 |  | ||||||
|  MAP_PATH = $(MAP_DIR)/$(MAP_FILE) |  | ||||||
|  MDMON_DIR = $(MAP_DIR) |  | ||||||
|  # place for autoreplace cookies |  | ||||||
| -FAILED_SLOTS_DIR = /run/mdadm/failed-slots
 |  | ||||||
| +FAILED_SLOTS_DIR = $(MDMON_DIR)/failed-slots
 |  | ||||||
|  DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\" |  | ||||||
|  DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\" |  | ||||||
|  DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\" |  | ||||||
| @ -1,92 +0,0 @@ | |||||||
| From d9751e06a601b5576b1b9e2c8126584083110ca5 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: NeilBrown <neilb@suse.de> |  | ||||||
| Date: Tue, 15 May 2012 09:51:03 +1000 |  | ||||||
| Subject: [PATCH] super1: fix choice of data_offset. |  | ||||||
| 
 |  | ||||||
| While it is nice to set a high data_offset to leave plenty of head |  | ||||||
| room it is much more important to leave enough space to allow |  | ||||||
| of the data of the array. |  | ||||||
| So after we check that sb->size is still available, only reduce the |  | ||||||
| 'reserved', don't increase it. |  | ||||||
| 
 |  | ||||||
| This fixes a bug where --adding a spare fails because it does not have |  | ||||||
| enough space in it. |  | ||||||
| 
 |  | ||||||
| Reported-by: nowhere <nowhere@hakkenden.ath.cx> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  super1.c |   31 ++++++++++++++++--------------- |  | ||||||
|  1 files changed, 16 insertions(+), 15 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super1.c b/super1.c
 |  | ||||||
| index be77c33..4f20cc3 100644
 |  | ||||||
| --- a/super1.c
 |  | ||||||
| +++ b/super1.c
 |  | ||||||
| @@ -1189,40 +1189,42 @@ static int write_init_super1(struct supertype *st)
 |  | ||||||
|  		case 1: |  | ||||||
|  			sb->super_offset = __cpu_to_le64(0); |  | ||||||
|  			reserved = bm_space + 4*2; |  | ||||||
| +			if (reserved < headroom)
 |  | ||||||
| +				reserved = headroom;
 |  | ||||||
| +			if (reserved + array_size > dsize)
 |  | ||||||
| +				reserved = dsize - array_size;
 |  | ||||||
|  			/* Try for multiple of 1Meg so it is nicely aligned */ |  | ||||||
|  			#define ONE_MEG (2*1024) |  | ||||||
| -			reserved = ((reserved + ONE_MEG-1)/ONE_MEG) * ONE_MEG;
 |  | ||||||
| -			if (reserved + __le64_to_cpu(sb->size) > dsize)
 |  | ||||||
| -				reserved = dsize - __le64_to_cpu(sb->size);
 |  | ||||||
| +			if (reserved > ONE_MEG)
 |  | ||||||
| +				reserved = (reserved/ONE_MEG) * ONE_MEG;
 |  | ||||||
| +
 |  | ||||||
|  			/* force 4K alignment */ |  | ||||||
|  			reserved &= ~7ULL; |  | ||||||
|   |  | ||||||
| -			if (reserved < headroom)
 |  | ||||||
| -				reserved = headroom;
 |  | ||||||
| -
 |  | ||||||
|  			sb->data_offset = __cpu_to_le64(reserved); |  | ||||||
|  			sb->data_size = __cpu_to_le64(dsize - reserved); |  | ||||||
|  			break; |  | ||||||
|  		case 2: |  | ||||||
|  			sb_offset = 4*2; |  | ||||||
|  			sb->super_offset = __cpu_to_le64(4*2); |  | ||||||
| -			if (4*2 + 4*2 + bm_space + __le64_to_cpu(sb->size)
 |  | ||||||
| +			if (4*2 + 4*2 + bm_space + array_size
 |  | ||||||
|  			    > dsize) |  | ||||||
| -				bm_space = dsize - __le64_to_cpu(sb->size)
 |  | ||||||
| +				bm_space = dsize - array_size
 |  | ||||||
|  					- 4*2 - 4*2; |  | ||||||
|   |  | ||||||
|  			reserved = bm_space + 4*2 + 4*2; |  | ||||||
| +			if (reserved < headroom)
 |  | ||||||
| +				reserved = headroom;
 |  | ||||||
| +			if (reserved + array_size > dsize)
 |  | ||||||
| +				reserved = dsize - array_size;
 |  | ||||||
|  			/* Try for multiple of 1Meg so it is nicely aligned */ |  | ||||||
|  			#define ONE_MEG (2*1024) |  | ||||||
| -			reserved = ((reserved + ONE_MEG-1)/ONE_MEG) * ONE_MEG;
 |  | ||||||
| -			if (reserved + __le64_to_cpu(sb->size) > dsize)
 |  | ||||||
| -				reserved = dsize - __le64_to_cpu(sb->size);
 |  | ||||||
| +			if (reserved > ONE_MEG)
 |  | ||||||
| +				reserved = (reserved/ONE_MEG) * ONE_MEG;
 |  | ||||||
| +
 |  | ||||||
|  			/* force 4K alignment */ |  | ||||||
|  			reserved &= ~7ULL; |  | ||||||
|   |  | ||||||
| -			if (reserved < headroom)
 |  | ||||||
| -				reserved = headroom;
 |  | ||||||
| -
 |  | ||||||
|  			sb->data_offset = __cpu_to_le64(reserved); |  | ||||||
|  			sb->data_size = __cpu_to_le64(dsize - reserved); |  | ||||||
|  			break; |  | ||||||
| @@ -1234,7 +1236,6 @@ static int write_init_super1(struct supertype *st)
 |  | ||||||
|  			goto out; |  | ||||||
|  		} |  | ||||||
|   |  | ||||||
| -
 |  | ||||||
|  		sb->sb_csum = calc_sb_1_csum(sb); |  | ||||||
|  		rv = store_super1(st, di->fd); |  | ||||||
|  		if (rv == 0 && (__le32_to_cpu(sb->feature_map) & 1)) |  | ||||||
| -- 
 |  | ||||||
| 1.7.7.6 |  | ||||||
| 
 |  | ||||||
| @ -1,45 +0,0 @@ | |||||||
| From 39fe768b8d9f3bd641f98029cb33f61f0c66841b Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| Date: Wed, 3 Oct 2012 10:00:34 +0200 |  | ||||||
| Subject: [PATCH 2/2] Add zlib license to crc32.c |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  crc32.c | 20 ++++++++++++++++++++ |  | ||||||
|  1 file changed, 20 insertions(+) |  | ||||||
| 
 |  | ||||||
| diff --git a/crc32.c b/crc32.c
 |  | ||||||
| index 12d08e5..94fda06 100644
 |  | ||||||
| --- a/crc32.c
 |  | ||||||
| +++ b/crc32.c
 |  | ||||||
| @@ -2,6 +2,26 @@
 |  | ||||||
|   * Copyright (C) 1995-2003 Mark Adler |  | ||||||
|   * For conditions of distribution and use, see copyright notice in zlib.h |  | ||||||
|   * |  | ||||||
| + * Note: zlib license from from zlib.h added explicitly as mdadm does
 |  | ||||||
| + *       not include zlib.h. License from v1.2.2 of zlib:
 |  | ||||||
| + *
 |  | ||||||
| + *  This software is provided 'as-is', without any express or implied
 |  | ||||||
| + *  warranty.  In no event will the authors be held liable for any damages
 |  | ||||||
| + *  arising from the use of this software.
 |  | ||||||
| + *
 |  | ||||||
| + *  Permission is granted to anyone to use this software for any purpose,
 |  | ||||||
| + *  including commercial applications, and to alter it and redistribute it
 |  | ||||||
| + *  freely, subject to the following restrictions:
 |  | ||||||
| + *
 |  | ||||||
| + *  1. The origin of this software must not be misrepresented; you must not
 |  | ||||||
| + *     claim that you wrote the original software. If you use this software
 |  | ||||||
| + *     in a product, an acknowledgment in the product documentation would be
 |  | ||||||
| + *     appreciated but is not required.
 |  | ||||||
| + *  2. Altered source versions must be plainly marked as such, and must not be
 |  | ||||||
| + *     misrepresented as being the original software.
 |  | ||||||
| + *  3. This notice may not be removed or altered from any source distribution.
 |  | ||||||
| + *
 |  | ||||||
| + *
 |  | ||||||
|   * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster |  | ||||||
|   * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing |  | ||||||
|   * tables for updating the shift register in one step with three exclusive-ors |  | ||||||
| -- 
 |  | ||||||
| 1.7.11.4 |  | ||||||
| 
 |  | ||||||
| @ -1,39 +0,0 @@ | |||||||
| From c0e59ebcf91e43bdf3e1dbd69a59980655e3ac38 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: NeilBrown <neilb@suse.de> |  | ||||||
| Date: Wed, 3 Oct 2012 13:34:15 +1000 |  | ||||||
| Subject: [PATCH 1/2] Replace sha1.h with slightly older version. |  | ||||||
| 
 |  | ||||||
| sha1.h claims GPL3+, while sha1.c claims GPL2+.  This is |  | ||||||
| inconsistent and technically prevents the whole from being |  | ||||||
| distributed under GPL2. |  | ||||||
| So replace sha1.h with a version from the GCC sources from before |  | ||||||
|   Tue Apr 20 08:36:39 2010 |  | ||||||
| when the copyright notice was updated. |  | ||||||
| 
 |  | ||||||
| Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  sha1.h | 4 ++-- |  | ||||||
|  1 file changed, 2 insertions(+), 2 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/sha1.h b/sha1.h
 |  | ||||||
| index a601d96..d9b07f8 100644
 |  | ||||||
| --- a/sha1.h
 |  | ||||||
| +++ b/sha1.h
 |  | ||||||
| @@ -1,11 +1,11 @@
 |  | ||||||
|  /* Declarations of functions and data types used for SHA1 sum |  | ||||||
|     library functions. |  | ||||||
| -   Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2010
 |  | ||||||
| +   Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008
 |  | ||||||
|     Free Software Foundation, Inc. |  | ||||||
|   |  | ||||||
|     This program is free software; you can redistribute it and/or modify it |  | ||||||
|     under the terms of the GNU General Public License as published by the |  | ||||||
| -   Free Software Foundation; either version 3, or (at your option) any
 |  | ||||||
| +   Free Software Foundation; either version 2, or (at your option) any
 |  | ||||||
|     later version. |  | ||||||
|   |  | ||||||
|     This program is distributed in the hope that it will be useful, |  | ||||||
| -- 
 |  | ||||||
| 1.7.11.4 |  | ||||||
| 
 |  | ||||||
| @ -1,46 +0,0 @@ | |||||||
| From e1993023991a6fa6539cc604b4b3d6718833250d Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Lukasz Dorau <lukasz.dorau@intel.com> |  | ||||||
| Date: Fri, 25 May 2012 15:06:41 +0200 |  | ||||||
| Subject: [PATCH] imsm: fix: correct checking volume's degradation |  | ||||||
| 
 |  | ||||||
| We do not check the return value of sysfs_get_ll() now. It is wrong. |  | ||||||
| If reading of the sysfs "degraded" key does not succeed, |  | ||||||
| the "new_degraded" variable will not be initiated |  | ||||||
| and accidentally it can have the value of "degraded" variable. |  | ||||||
| In that case the change of degradation will not be checked. |  | ||||||
| 
 |  | ||||||
| It happens if mdadm is compiled with gcc's "-fstack-protector" option |  | ||||||
| when one tries to stop a volume under reshape (e.g. OLCE). |  | ||||||
| Reshape seems to be finished then (metadata is in normal/clean state) |  | ||||||
| but it is not finished, it is broken and data are corrupted. |  | ||||||
| 
 |  | ||||||
| Now we always check the return value of sysfs_get_ll(). |  | ||||||
| Even if reading of the sysfs "degraded" key does not succeed |  | ||||||
| (rv == -1) the change of degradation will be checked. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  super-intel.c |    6 ++++-- |  | ||||||
|  1 file changed, 4 insertions(+), 2 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-intel.c b/super-intel.c
 |  | ||||||
| index 6c87e20..07ab9ae 100644
 |  | ||||||
| --- a/super-intel.c
 |  | ||||||
| +++ b/super-intel.c
 |  | ||||||
| @@ -10370,8 +10370,10 @@ int check_degradation_change(struct mdinfo *info,
 |  | ||||||
|  			     int degraded) |  | ||||||
|  { |  | ||||||
|  	unsigned long long new_degraded; |  | ||||||
| -	sysfs_get_ll(info, NULL, "degraded", &new_degraded);
 |  | ||||||
| -	if (new_degraded != (unsigned long long)degraded) {
 |  | ||||||
| +	int rv;
 |  | ||||||
| +
 |  | ||||||
| +	rv = sysfs_get_ll(info, NULL, "degraded", &new_degraded);
 |  | ||||||
| +	if ((rv == -1) || (new_degraded != (unsigned long long)degraded)) {
 |  | ||||||
|  		/* check each device to ensure it is still working */ |  | ||||||
|  		struct mdinfo *sd; |  | ||||||
|  		new_degraded = 0; |  | ||||||
| -- 
 |  | ||||||
| 1.7.10.2 |  | ||||||
| 
 |  | ||||||
| @ -1,49 +0,0 @@ | |||||||
| From 4edb8530e889fc7b5e1b5471a0fbfd6c3c116b4a Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Date: Wed, 3 Apr 2013 12:43:42 +1100 |  | ||||||
| Subject: [PATCH] Add updating component_size to manager thread of mdmon |  | ||||||
| 
 |  | ||||||
| Mdmon does not update component_size now. It is wrong because in case |  | ||||||
| of size's expansion component_size is changed by mdadm but mdmon does not |  | ||||||
| reread its new value and uses a wrong, old one. As a result the metadata |  | ||||||
| is incorrect during size's expansion. It contains no information that |  | ||||||
| resync is in progress (there is no checkpoint too). The metadata is |  | ||||||
| as if resync has already been finished but it has not. |  | ||||||
| 
 |  | ||||||
| Component_size will be set to match information in sysfs. This value |  | ||||||
| will be updated by manager thread in manage_member() function. |  | ||||||
| Now mdmon uses the correct, current value of component_size and the |  | ||||||
| correct metadata (containing information about resync and checkpoint) |  | ||||||
| is written. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  managemon.c | 4 ++++ |  | ||||||
|  1 file changed, 4 insertions(+) |  | ||||||
| 
 |  | ||||||
| diff --git a/managemon.c b/managemon.c
 |  | ||||||
| index d155b04..2c55b3c 100644
 |  | ||||||
| --- a/managemon.c
 |  | ||||||
| +++ b/managemon.c
 |  | ||||||
| @@ -444,6 +444,7 @@ static void manage_member(struct mdstat_ent *mdstat,
 |  | ||||||
|  	char buf[64]; |  | ||||||
|  	int frozen; |  | ||||||
|  	struct supertype *container = a->container; |  | ||||||
| +	unsigned long long int component_size = 0;
 |  | ||||||
|   |  | ||||||
|  	if (container == NULL) |  | ||||||
|  		/* Raced with something */ |  | ||||||
| @@ -453,6 +454,9 @@ static void manage_member(struct mdstat_ent *mdstat,
 |  | ||||||
|  	a->info.array.raid_disks = mdstat->raid_disks; |  | ||||||
|  	// MORE |  | ||||||
|   |  | ||||||
| +	if (sysfs_get_ll(&a->info, NULL, "component_size", &component_size) >= 0)
 |  | ||||||
| +		a->info.component_size = component_size << 1;
 |  | ||||||
| +
 |  | ||||||
|  	/* honor 'frozen' */ |  | ||||||
|  	if (sysfs_get_str(&a->info, NULL, "metadata_version", buf, sizeof(buf)) > 0) |  | ||||||
|  		frozen = buf[9] == '-'; |  | ||||||
| -- 
 |  | ||||||
| 1.8.1.4 |  | ||||||
| 
 |  | ||||||
| @ -1,30 +0,0 @@ | |||||||
| From 066e92f017df22c879c455494d2c1743ef7f3aca Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Lukasz Dorau <lukasz.dorau@intel.com> |  | ||||||
| Date: Fri, 16 Nov 2012 17:24:36 +0100 |  | ||||||
| Subject: [PATCH] Create.c: check if freesize is equal 0 |  | ||||||
| 
 |  | ||||||
| "freesize" can be equal 0, particularly after rounding to the chunk's size. |  | ||||||
| Creating should be aborted in such case. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  Create.c | 5 +++++ |  | ||||||
|  1 file changed, 5 insertions(+) |  | ||||||
| 
 |  | ||||||
| diff --git a/Create.c b/Create.c
 |  | ||||||
| index afcf1a5..436bd1d 100644
 |  | ||||||
| --- a/Create.c
 |  | ||||||
| +++ b/Create.c
 |  | ||||||
| @@ -407,6 +407,11 @@
 |  | ||||||
|  				do_default_chunk = 0; |  | ||||||
|  			} |  | ||||||
|  		} |  | ||||||
| +		if (!freesize) {
 |  | ||||||
| +			fprintf(stderr, Name ": no free space left on %s\n", dname);
 |  | ||||||
| +			fail = 1;
 |  | ||||||
| +			continue;
 |  | ||||||
| +		}
 |  | ||||||
|   |  | ||||||
|  		if (size && freesize < size) { |  | ||||||
|  			fprintf(stderr, Name ": %s is smaller than given size." |  | ||||||
| @ -1,54 +0,0 @@ | |||||||
| From 2fdf559d74a48806900b63f1b4504a18dec048a9 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: NeilBrown <neilb@suse.de> |  | ||||||
| Date: Mon, 22 Apr 2013 17:05:33 +1000 |  | ||||||
| Subject: [PATCH] Manage_runstop: call flush_mdmon if O_EXCL fails on stopping |  | ||||||
|  mdmon array. |  | ||||||
| 
 |  | ||||||
| When stopping an mdmon array, at reshape might be being aborted |  | ||||||
| which inhibets O_EXCL.  So if that is possible, call flush_mdmon |  | ||||||
| to make sure mdmon isn't still busy. |  | ||||||
| 
 |  | ||||||
| Reported-by: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  Manage.c | 29 ++++++++++++++++++++++++----- |  | ||||||
|  1 file changed, 24 insertions(+), 5 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/Manage.c b/Manage.c
 |  | ||||||
| index e3d3041..e37f415 100644
 |  | ||||||
| --- a/Manage.c
 |  | ||||||
| +++ b/Manage.c
 |  | ||||||
| @@ -221,8 +222,19 @@ int Manage_runstop(char *devname, int fd, int runstop,
 |  | ||||||
|  		/* Get EXCL access first.  If this fails, then attempting |  | ||||||
|  		 * to stop is probably a bad idea. |  | ||||||
|  		 */ |  | ||||||
| -		close(fd);
 |  | ||||||
| -		fd = open(devname, O_RDONLY|O_EXCL);
 |  | ||||||
| +		mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION);
 |  | ||||||
| +		close(fd);
 |  | ||||||
| +		count = 5;
 |  | ||||||
| +		while (((fd = open(devname, O_RDONLY|O_EXCL)) < 0
 |  | ||||||
| +			|| fd2devnum(fd) != devnum)
 |  | ||||||
| +			&& mdi && !is_subarray(mdi->text_version)
 |  | ||||||
| +			&& mdmon_running(devname2devnum(mdi->sys_name))
 |  | ||||||
| +			&& count) {
 |  | ||||||
| +			if (fd >= 0)
 |  | ||||||
| +				close(fd);
 |  | ||||||
| +			flush_mdmon(mdi->sys_name);
 |  | ||||||
| +			count--;
 |  | ||||||
| +		}
 |  | ||||||
|  		if (fd < 0 || fd2devnum(fd) != devnum) { |  | ||||||
|  			if (fd >= 0) |  | ||||||
|  				close(fd); |  | ||||||
| @@ -237,7 +257,6 @@ int Manage_runstop(char *devname, int fd, int runstop,
 |  | ||||||
|  				devname); |  | ||||||
|  			return 1; |  | ||||||
|  		} |  | ||||||
| -		mdi = sysfs_read(fd, -1, GET_LEVEL|GET_VERSION);
 |  | ||||||
|  		if (mdi && |  | ||||||
|  		    mdi->array.level > 0 && |  | ||||||
|  		    is_subarray(mdi->text_version)) { |  | ||||||
| 
 |  | ||||||
| -- 
 |  | ||||||
| 1.8.3.1 |  | ||||||
| 
 |  | ||||||
| @ -1,73 +0,0 @@ | |||||||
| From 3c309c82699ae3bebc716dbd5abea079dd41184a Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Marcin Tomczak <marcin.tomczak@intel.com> |  | ||||||
| Date: Fri, 9 Nov 2012 15:46:36 +0100 |  | ||||||
| Subject: [PATCH] imsm: Forbid spanning between multiple controllers. |  | ||||||
| 
 |  | ||||||
| Attaching disks to multiple controllers of the same type has been |  | ||||||
| allowed so far. Now spanning between multiple controllers is disallowed |  | ||||||
| at all by IMSM metadata. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com> |  | ||||||
| Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  super-intel.c | 25 ++++++++----------------- |  | ||||||
|  1 file changed, 8 insertions(+), 17 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-intel.c b/super-intel.c
 |  | ||||||
| index 202b83f..4ac9d42 100644
 |  | ||||||
| --- a/super-intel.c
 |  | ||||||
| +++ b/super-intel.c
 |  | ||||||
| @@ -558,20 +558,11 @@ static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device
 |  | ||||||
|  	if (super->hba == NULL) { |  | ||||||
|  		super->hba = alloc_intel_hba(device); |  | ||||||
|  		return 1; |  | ||||||
| -	}
 |  | ||||||
| -
 |  | ||||||
| -	hba = super->hba;
 |  | ||||||
| -	/* Intel metadata allows for all disks attached to the same type HBA.
 |  | ||||||
| -	 * Do not sypport odf HBA types mixing
 |  | ||||||
| -	 */
 |  | ||||||
| -	if (device->type != hba->type)
 |  | ||||||
| +	} else
 |  | ||||||
| +		/* IMSM metadata disallows to attach disks to multiple
 |  | ||||||
| +		 * controllers.
 |  | ||||||
| +		 */
 |  | ||||||
|  		return 2; |  | ||||||
| -
 |  | ||||||
| -	while (hba->next)
 |  | ||||||
| -		hba = hba->next;
 |  | ||||||
| -
 |  | ||||||
| -	hba->next = alloc_intel_hba(device);
 |  | ||||||
| -	return 1;
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  static struct sys_dev* find_disk_attached_hba(int fd, const char *devname) |  | ||||||
| @@ -3073,11 +3064,11 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
 |  | ||||||
|  	 */ |  | ||||||
|  	if (!check_env("IMSM_NO_PLATFORM")) { |  | ||||||
| -		if (!first->hba || !sec->hba ||
 |  | ||||||
| -		    (first->hba->type != sec->hba->type))  {
 |  | ||||||
| +		if (first->hba && sec->hba &&
 |  | ||||||
| +		    strcmp(first->hba->path, sec->hba->path) != 0)  {
 |  | ||||||
|  			fprintf(stderr, |  | ||||||
|  				"HBAs of devices does not match %s != %s\n", |  | ||||||
| -				first->hba ? get_sys_dev_type(first->hba->type) : NULL,
 |  | ||||||
| -				sec->hba ? get_sys_dev_type(sec->hba->type) : NULL);
 |  | ||||||
| +				first->hba ? first->hba->path : NULL,
 |  | ||||||
| +				sec->hba ? sec->hba->path : NULL);
 |  | ||||||
|  			return 3; |  | ||||||
|  		} |  | ||||||
|  	} |  | ||||||
| @@ -3819,7 +3810,7 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de
 |  | ||||||
|  			} |  | ||||||
|   |  | ||||||
|  			fprintf(stderr, ").\n" |  | ||||||
| -				"    Mixing devices attached to different controllers "
 |  | ||||||
| +				"    Mixing devices attached to multiple controllers "
 |  | ||||||
|  				"is not allowed.\n"); |  | ||||||
|  		} |  | ||||||
|  		free_sys_dev(&hba_name); |  | ||||||
| -- 
 |  | ||||||
| 1.7.11.7 |  | ||||||
| 
 |  | ||||||
| @ -1,49 +0,0 @@ | |||||||
| From 79b68f1b48b0967da999945e310aef628c9bca4c Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> |  | ||||||
| Date: Thu, 18 Apr 2013 10:51:37 +0200 |  | ||||||
| Subject: [PATCH] imsm: monitor: do not finish migration if there are no failed |  | ||||||
|  disks |  | ||||||
| 
 |  | ||||||
| Transition from "degraded" to "recovery" made in OROM is slightly different |  | ||||||
| than the same transision in mdadm. Missing disk is not removed from list of |  | ||||||
| raid devices, but just from map. Therefore mdadm should not end migration |  | ||||||
| basing on existence of list of missing disks but should rely on count of |  | ||||||
| failed disks. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> |  | ||||||
| Tested-by: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  super-intel.c | 9 ++++++++- |  | ||||||
|  1 file changed, 8 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-intel.c b/super-intel.c
 |  | ||||||
| index 24016b7..3f15b0f 100644
 |  | ||||||
| --- a/super-intel.c
 |  | ||||||
| +++ b/super-intel.c
 |  | ||||||
| @@ -6886,6 +6886,12 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
 |  | ||||||
|  	if (!super->missing) |  | ||||||
|  		return; |  | ||||||
|   |  | ||||||
| +	/* When orom adds replacement for missing disk it does
 |  | ||||||
| +	 * not remove entry of missing disk, but just updates map with
 |  | ||||||
| +	 * new added disk. So it is not enough just to test if there is
 |  | ||||||
| +	 * any missing disk, we have to look if there are any failed disks
 |  | ||||||
| +	 * in map to stop migration */
 |  | ||||||
| +
 |  | ||||||
|  	dprintf("imsm: mark missing\n"); |  | ||||||
|  	/* end process for initialization and rebuild only |  | ||||||
|  	 */ |  | ||||||
| @@ -6896,7 +6902,8 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
 |  | ||||||
|  		failed = imsm_count_failed(super, dev, MAP_0); |  | ||||||
|  		map_state = imsm_check_degraded(super, dev, failed, MAP_0); |  | ||||||
|   |  | ||||||
| -		end_migration(dev, super, map_state);
 |  | ||||||
| +		if (failed)
 |  | ||||||
| +			end_migration(dev, super, map_state);
 |  | ||||||
|  	} |  | ||||||
|  	for (dl = super->missing; dl; dl = dl->next) |  | ||||||
|  		mark_missing(dev, &dl->disk, dl->index); |  | ||||||
| -- 
 |  | ||||||
| 1.8.1.4 |  | ||||||
| 
 |  | ||||||
| @ -1,54 +0,0 @@ | |||||||
| From fa0d79e2b2642a2f8b04d34dfef866dbabc69e1e Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Samuli Suominen <ssuominen@gentoo.org> |  | ||||||
| Date: Mon, 13 Aug 2012 13:44:22 -0400 |  | ||||||
| Subject: [PATCH] query udev dir via pkg-config |  | ||||||
| 
 |  | ||||||
| Since udev is moving its internal dir around, query it via pkg-config |  | ||||||
| rather than hardcoding the old path.  This should work with new/old |  | ||||||
| versions. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Samuli Suominen <ssuominen@gentoo.org> |  | ||||||
| Signed-off-by: Mike Frysinger <vapier@gentoo.org> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  Makefile | 9 ++++++++- |  | ||||||
|  1 file changed, 8 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/Makefile b/Makefile
 |  | ||||||
| index 72f609e..a3e4027 100644
 |  | ||||||
| --- a/Makefile
 |  | ||||||
| +++ b/Makefile
 |  | ||||||
| @@ -57,6 +57,8 @@ else
 |  | ||||||
|   DEFAULT_METADATA=1.2 |  | ||||||
|  endif |  | ||||||
|   |  | ||||||
| +PKG_CONFIG ?= pkg-config
 |  | ||||||
| +
 |  | ||||||
|  SYSCONFDIR = /etc |  | ||||||
|  CONFFILE = $(SYSCONFDIR)/mdadm.conf |  | ||||||
|  CONFFILE2 = $(SYSCONFDIR)/mdadm/mdadm.conf |  | ||||||
| @@ -96,6 +98,11 @@ MAN4DIR = $(MANDIR)/man4
 |  | ||||||
|  MAN5DIR = $(MANDIR)/man5 |  | ||||||
|  MAN8DIR = $(MANDIR)/man8 |  | ||||||
|   |  | ||||||
| +UDEVDIR := $(shell $(PKG_CONFIG) --variable=udevdir udev 2>/dev/null)
 |  | ||||||
| +ifndef UDEVDIR
 |  | ||||||
| + UDEVDIR = /lib/udev
 |  | ||||||
| +endif
 |  | ||||||
| +
 |  | ||||||
|  OBJS =  mdadm.o config.o policy.o mdstat.o  ReadMe.o util.o maps.o lib.o \ |  | ||||||
|  	Manage.o Assemble.o Build.o \ |  | ||||||
|  	Create.o Detail.o Examine.o Grow.o Monitor.o dlink.o Kill.o Query.o \ |  | ||||||
| @@ -255,7 +262,7 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
 |  | ||||||
|  	$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 |  | ||||||
|   |  | ||||||
|  install-udev: udev-md-raid.rules |  | ||||||
| -	$(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)/lib/udev/rules.d/64-md-raid.rules
 |  | ||||||
| +	$(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)$(UDEVDIR)/rules.d/64-md-raid.rules
 |  | ||||||
|   |  | ||||||
|  uninstall: |  | ||||||
|  	rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 $(DESTDIR)$(MAN8DIR)/mdmon.8 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm |  | ||||||
| 
 |  | ||||||
| -- 
 |  | ||||||
| 1.8.1.4 |  | ||||||
| 
 |  | ||||||
| @ -1,85 +0,0 @@ | |||||||
| From 5141638c54535b4ac80b8481404d868a63a18ecd Mon Sep 17 00:00:00 2001 |  | ||||||
| From: NeilBrown <neilb@suse.de> |  | ||||||
| Date: Tue, 29 Jul 2014 13:48:23 +1000 |  | ||||||
| Subject: [PATCH] Assemble: Only fail auto-assemble in face of mdadm.conf |  | ||||||
|  conflicts. |  | ||||||
| 
 |  | ||||||
| We should never auto-assemble things that conflict with mdadm.conf |  | ||||||
| However explicit assembly requests should be allowed. |  | ||||||
| 
 |  | ||||||
| Reported-by: olovopb |  | ||||||
| Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1070245 |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  Assemble.c | 47 ++++++++++++++++++++++++++--------------------- |  | ||||||
|  1 file changed, 26 insertions(+), 21 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/Assemble.c b/Assemble.c
 |  | ||||||
| index aca28be..cdcdb0f 100644
 |  | ||||||
| --- a/Assemble.c
 |  | ||||||
| +++ b/Assemble.c
 |  | ||||||
| @@ -366,9 +366,6 @@ static int select_devices(struct mddev_dev *devlist,
 |  | ||||||
|  			tmpdev = NULL; |  | ||||||
|  			goto loop; |  | ||||||
|  		} else { |  | ||||||
| -			int rv = 0;
 |  | ||||||
| -			struct mddev_ident *match;
 |  | ||||||
| -
 |  | ||||||
|  			content = *contentp; |  | ||||||
|  			tst->ss->getinfo_super(tst, content, NULL); |  | ||||||
|   |  | ||||||
| @@ -377,25 +374,33 @@ static int select_devices(struct mddev_dev *devlist,
 |  | ||||||
|  					   report_mismatch ? devname : NULL)) |  | ||||||
|  				goto loop; |  | ||||||
|   |  | ||||||
| -			match = conf_match(tst, content, devname,
 |  | ||||||
| -					   report_mismatch ? c->verbose : -1,
 |  | ||||||
| -					   &rv);
 |  | ||||||
| -			if (!match && rv == 2)
 |  | ||||||
| -				goto loop;
 |  | ||||||
| -			if (match && match->devname &&
 |  | ||||||
| -			    strcasecmp(match->devname, "<ignore>") == 0) {
 |  | ||||||
| -				if (report_mismatch)
 |  | ||||||
| -					pr_err("%s is a member of an explicitly ignored array\n",
 |  | ||||||
| -					       devname);
 |  | ||||||
| -				goto loop;
 |  | ||||||
| -			}
 |  | ||||||
| -			if (match && !ident_matches(match, content, tst,
 |  | ||||||
| -						    c->homehost, c->update,
 |  | ||||||
| -						    report_mismatch ? devname : NULL))
 |  | ||||||
| -				/* Array exists  in mdadm.conf but some
 |  | ||||||
| -				 * details don't match, so reject it
 |  | ||||||
| +			if (auto_assem) {
 |  | ||||||
| +				/* Never auto-assemble things that conflict
 |  | ||||||
| +				 * with mdadm.conf in some way
 |  | ||||||
|  				 */ |  | ||||||
| -				goto loop;
 |  | ||||||
| +				struct mddev_ident *match;
 |  | ||||||
| +				int rv = 0;
 |  | ||||||
| +
 |  | ||||||
| +				match = conf_match(tst, content, devname,
 |  | ||||||
| +						   report_mismatch ? c->verbose : -1,
 |  | ||||||
| +						   &rv);
 |  | ||||||
| +				if (!match && rv == 2)
 |  | ||||||
| +					goto loop;
 |  | ||||||
| +				if (match && match->devname &&
 |  | ||||||
| +				    strcasecmp(match->devname, "<ignore>") == 0) {
 |  | ||||||
| +					if (report_mismatch)
 |  | ||||||
| +						pr_err("%s is a member of an explicitly ignored array\n",
 |  | ||||||
| +						       devname);
 |  | ||||||
| +					goto loop;
 |  | ||||||
| +				}
 |  | ||||||
| +				if (match && !ident_matches(match, content, tst,
 |  | ||||||
| +							    c->homehost, c->update,
 |  | ||||||
| +							    report_mismatch ? devname : NULL))
 |  | ||||||
| +					/* Array exists  in mdadm.conf but some
 |  | ||||||
| +					 * details don't match, so reject it
 |  | ||||||
| +					 */
 |  | ||||||
| +					goto loop;
 |  | ||||||
| +			}
 |  | ||||||
|   |  | ||||||
|  			/* should be safe to try an exclusive open now, we |  | ||||||
|  			 * have rejected anything that some other mdadm might |  | ||||||
| -- 
 |  | ||||||
| 1.9.3 |  | ||||||
| 
 |  | ||||||
| @ -1,51 +0,0 @@ | |||||||
| From d13566f9b6ff8377f45cd025a1cd1a58bcb4e857 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Guy Menanteau <menantea@linux.vnet.ibm.com> |  | ||||||
| Date: Mon, 4 Aug 2014 16:53:03 +0200 |  | ||||||
| Subject: [PATCH] DDF: cast print arguments in super-ddf.c |  | ||||||
| 
 |  | ||||||
| mdadm fails to build on ppc64 and ppc64le architectures. |  | ||||||
| ===
 |  | ||||||
| super-ddf.c: In function '_set_config_size': |  | ||||||
| super-ddf.c:2849:4: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=] |  | ||||||
|     pr_err("%s: %x:%x: workspace size 0x%llx too big, ignoring\n", |  | ||||||
|     ^ |  | ||||||
| super-ddf.c:2855:2: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=] |  | ||||||
|   dprintf("%s: %x:%x config_size %llx, DDF structure is %llx blocks\n", |  | ||||||
|   ^ |  | ||||||
| cc1: all warnings being treated as errors |  | ||||||
| <builtin>: recipe for target 'super-ddf.o' failed |  | ||||||
| ===
 |  | ||||||
| 
 |  | ||||||
| Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1125883 |  | ||||||
| Signed-off-by: <menantea@linux.vnet.ibm.com> |  | ||||||
| Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com> |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  super-ddf.c | 6 ++++-- |  | ||||||
|  1 file changed, 4 insertions(+), 2 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-ddf.c b/super-ddf.c
 |  | ||||||
| index 8957c2e..bc0ce2c 100644
 |  | ||||||
| --- a/super-ddf.c
 |  | ||||||
| +++ b/super-ddf.c
 |  | ||||||
| @@ -2847,13 +2847,15 @@ static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
 |  | ||||||
|  		__u64 wsp = cfs - t; |  | ||||||
|  		if (wsp > 1024*1024*2ULL && wsp > dl->size / 16) { |  | ||||||
|  			pr_err("%s: %x:%x: workspace size 0x%llx too big, ignoring\n", |  | ||||||
| -			       __func__, dl->major, dl->minor, wsp);
 |  | ||||||
| +			       __func__, dl->major, dl->minor,
 |  | ||||||
| +			       (unsigned long long)wsp);
 |  | ||||||
|  		} else |  | ||||||
|  			cfs = t; |  | ||||||
|  	} |  | ||||||
|  	pde->config_size = cpu_to_be64(cfs); |  | ||||||
|  	dprintf("%s: %x:%x config_size %llx, DDF structure is %llx blocks\n", |  | ||||||
| -		__func__, dl->major, dl->minor, cfs, dl->size-cfs);
 |  | ||||||
| +		__func__, dl->major, dl->minor,
 |  | ||||||
| +		(unsigned long long)cfs, (unsigned long long)(dl->size-cfs));
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  /* Add a device to a container, either while creating it or while |  | ||||||
| -- 
 |  | ||||||
| 1.9.3 |  | ||||||
| 
 |  | ||||||
| @ -1,38 +0,0 @@ | |||||||
| From 46643e1ad5ece5f1257b2d827e36231df44929a2 Mon Sep 17 00:00:00 2001 |  | ||||||
| From: NeilBrown <neilb@suse.de> |  | ||||||
| Date: Tue, 29 Jul 2014 13:37:42 +1000 |  | ||||||
| Subject: [PATCH] Grow: improve error message is "--grow -n2" used on Linear |  | ||||||
|  arrays. |  | ||||||
| 
 |  | ||||||
| Linear arrays don't respond to setting raid-disks, only to |  | ||||||
| adding a device. |  | ||||||
| 
 |  | ||||||
| Reported-by: mulhern |  | ||||||
| Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1122146 |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.de> |  | ||||||
| ---
 |  | ||||||
|  Grow.c | 7 ++++++- |  | ||||||
|  1 file changed, 6 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/Grow.c b/Grow.c
 |  | ||||||
| index af59347..a9c8589 100644
 |  | ||||||
| --- a/Grow.c
 |  | ||||||
| +++ b/Grow.c
 |  | ||||||
| @@ -1028,7 +1028,12 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
 |  | ||||||
|   |  | ||||||
|  	switch (info->array.level) { |  | ||||||
|  	default: |  | ||||||
| -		return "Cannot understand this RAID level";
 |  | ||||||
| +		return "No reshape is possibly for this RAID level";
 |  | ||||||
| +	case LEVEL_LINEAR:
 |  | ||||||
| +		if (info->delta_disks != UnSet)
 |  | ||||||
| +			return "Only --add is supported for LINEAR, setting --raid-disks is not needed";
 |  | ||||||
| +		else
 |  | ||||||
| +			return "Only --add is supported for LINEAR, other --grow options are not meaningful";
 |  | ||||||
|  	case 1: |  | ||||||
|  		/* RAID1 can convert to RAID1 with different disks, or |  | ||||||
|  		 * raid5 with 2 disks, or |  | ||||||
| -- 
 |  | ||||||
| 1.9.3 |  | ||||||
| 
 |  | ||||||
| @ -1,51 +0,0 @@ | |||||||
| commit 12add44564f195878c3e346e4bbae845dec67db3 |  | ||||||
| Author: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| Date:   Fri Mar 4 16:30:22 2016 -0500 |  | ||||||
| 
 |  | ||||||
|     Grow: Grow_continue_command() remove dead code |  | ||||||
|      |  | ||||||
|     All cases where fd2 is used are completed with a close(fd2), so there |  | ||||||
|     is no need to set fd2 = -1 or check for it before exiting. |  | ||||||
|      |  | ||||||
|     Reviewed-by: NeilBrown <neilb@suse.com> |  | ||||||
|     Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| 
 |  | ||||||
| diff --git a/Grow.c b/Grow.c
 |  | ||||||
| index c4f417e..c4af5c0 100755
 |  | ||||||
| --- a/Grow.c
 |  | ||||||
| +++ b/Grow.c
 |  | ||||||
| @@ -4752,7 +4752,7 @@ int Grow_continue_command(char *devname, int fd,
 |  | ||||||
|  	struct mdinfo *cc = NULL; |  | ||||||
|  	struct mdstat_ent *mdstat = NULL; |  | ||||||
|  	int cfd = -1; |  | ||||||
| -	int fd2 = -1;
 |  | ||||||
| +	int fd2;
 |  | ||||||
|   |  | ||||||
|  	dprintf("Grow continue from command line called for %s\n", |  | ||||||
|  		devname); |  | ||||||
| @@ -4796,8 +4796,6 @@ int Grow_continue_command(char *devname, int fd,
 |  | ||||||
|  				continue; |  | ||||||
|  			err = st->ss->load_super(st, fd2, NULL); |  | ||||||
|  			close(fd2); |  | ||||||
| -			/* invalidate fd2 to avoid possible double close() */
 |  | ||||||
| -			fd2 = -1;
 |  | ||||||
|  			if (err) |  | ||||||
|  				continue; |  | ||||||
|  			break; |  | ||||||
| @@ -4894,7 +4892,6 @@ int Grow_continue_command(char *devname, int fd,
 |  | ||||||
|  		sysfs_init(content, fd2, mdstat->devnm); |  | ||||||
|   |  | ||||||
|  		close(fd2); |  | ||||||
| -		fd2 = -1;
 |  | ||||||
|   |  | ||||||
|  		/* start mdmon in case it is not running |  | ||||||
|  		 */ |  | ||||||
| @@ -4924,8 +4921,6 @@ int Grow_continue_command(char *devname, int fd,
 |  | ||||||
|  	ret_val = Grow_continue(fd, st, content, backup_file, 1, 0); |  | ||||||
|   |  | ||||||
|  Grow_continue_command_exit: |  | ||||||
| -	if (fd2 > -1)
 |  | ||||||
| -		close(fd2);
 |  | ||||||
|  	if (cfd > -1) |  | ||||||
|  		close(cfd); |  | ||||||
|  	st->ss->free_super(st); |  | ||||||
| @ -1,56 +0,0 @@ | |||||||
| From df2647fa5bbe84960dae11531e34bafef549b8ff Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Date: Tue, 17 May 2016 13:24:41 +0200 |  | ||||||
| Subject: [PATCH] IMSM: retry reading sync_completed during reshape |  | ||||||
| 
 |  | ||||||
| The sync_completed after restarting a reshape |  | ||||||
| (for example - after reboot) is set to "delayed" until |  | ||||||
| mdmon changes the state. Mdadm does not wait for that change with |  | ||||||
| old kernels. If this condition occurs - it exits and reshape |  | ||||||
| is not continuing. This patch adds retry of reading sync_complete |  | ||||||
| with a delay. It gives time for mdmon to change the "delayed" state. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  super-intel.c | 17 ++++++++++++----- |  | ||||||
|  1 file changed, 12 insertions(+), 5 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-intel.c b/super-intel.c
 |  | ||||||
| index ba3ee48..7e2860c 100644
 |  | ||||||
| --- a/super-intel.c
 |  | ||||||
| +++ b/super-intel.c
 |  | ||||||
| @@ -10378,6 +10378,7 @@ exit_imsm_reshape_super:
 |  | ||||||
|  int wait_for_reshape_imsm(struct mdinfo *sra, int ndata) |  | ||||||
|  { |  | ||||||
|  	int fd = sysfs_get_fd(sra, NULL, "sync_completed"); |  | ||||||
| +	int retry = 3;
 |  | ||||||
|  	unsigned long long completed; |  | ||||||
|  	/* to_complete : new sync_max position */ |  | ||||||
|  	unsigned long long to_complete = sra->reshape_progress; |  | ||||||
| @@ -10388,11 +10389,17 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 |  | ||||||
|  		return 1; |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
| -	if (sysfs_fd_get_ll(fd, &completed) < 0) {
 |  | ||||||
| -		dprintf("cannot read reshape_position (no reshape in progres)\n");
 |  | ||||||
| -		close(fd);
 |  | ||||||
| -		return 1;
 |  | ||||||
| -	}
 |  | ||||||
| +	do {
 |  | ||||||
| +		if (sysfs_fd_get_ll(fd, &completed) < 0) {
 |  | ||||||
| +			if (!retry) {
 |  | ||||||
| +				dprintf("cannot read reshape_position (no reshape in progres)\n");
 |  | ||||||
| +				close(fd);
 |  | ||||||
| +				return 1;
 |  | ||||||
| +			}
 |  | ||||||
| +			usleep(30000);
 |  | ||||||
| +		} else
 |  | ||||||
| +			break;
 |  | ||||||
| +	} while (retry--);
 |  | ||||||
|   |  | ||||||
|  	if (completed > position_to_set) { |  | ||||||
|  		dprintf("wrong next position to set %llu (%llu)\n", |  | ||||||
| -- 
 |  | ||||||
| 2.5.5 |  | ||||||
| 
 |  | ||||||
| @ -1,31 +0,0 @@ | |||||||
| From 6e6e98746dba7e900f23e92bbb0da01fe7a169da Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Nikhil Kshirsagar <nkshirsa@redhat.com> |  | ||||||
| Date: Fri, 10 Jun 2016 08:50:10 +0530 |  | ||||||
| Subject: [PATCH] The sys_name array in the mdinfo structure is 20 bytes of |  | ||||||
|  storage. |  | ||||||
| 
 |  | ||||||
| Increasing the size of this array to 32 bytes to handle cases with |  | ||||||
| longer device names. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Nikhil Kshirsagar <nkshirsa@redhat.com> |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  mdadm.h | 2 +- |  | ||||||
|  1 file changed, 1 insertion(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/mdadm.h b/mdadm.h
 |  | ||||||
| index 3d6c638..1fd38a3 100755
 |  | ||||||
| --- a/mdadm.h
 |  | ||||||
| +++ b/mdadm.h
 |  | ||||||
| @@ -289,7 +289,7 @@ struct mdinfo {
 |  | ||||||
|  	int container_enough; /* flag external handlers can set to |  | ||||||
|  			       * indicate that subarrays have not enough (-1), |  | ||||||
|  			       * enough to start (0), or all expected disks (1) */ |  | ||||||
| -	char		sys_name[20];
 |  | ||||||
| +	char		sys_name[32];
 |  | ||||||
|  	struct mdinfo *devs; |  | ||||||
|  	struct mdinfo *next; |  | ||||||
|   |  | ||||||
| -- 
 |  | ||||||
| 2.5.5 |  | ||||||
| 
 |  | ||||||
| @ -1,106 +0,0 @@ | |||||||
| commit 8800f85381d0cd9689dee62bbbdafdb359100389 |  | ||||||
| Author: Xiao Ni <xni@redhat.com> |  | ||||||
| Date:   Thu Jun 16 09:41:02 2016 +0800 |  | ||||||
| 
 |  | ||||||
|     MDADM:Check mdinfo->reshape_active more times before calling Grow_continue |  | ||||||
|      |  | ||||||
|     When reshaping a 3 drives raid5 to 4 drives raid5, there is a chance that |  | ||||||
|     it can't start the reshape. If the disks are not enough to have spaces for |  | ||||||
|     relocating the data_offset, it needs to call start_reshape and then run |  | ||||||
|     mdadm --grow --continue by systemd. But mdadm --grow --continue fails |  | ||||||
|     because it checkes that info->reshape_active is 0. |  | ||||||
|      |  | ||||||
|     The info->reshape_active is got from the superblock of underlying devices. |  | ||||||
|     Function start_reshape write reshape to /sys/../sync_action. Before writing |  | ||||||
|     latest superblock to underlying devices, mdadm --grow --continue is called. |  | ||||||
|     There is a chance info->reshape_active is 0. We should wait for superblock |  | ||||||
|     updating more time before calling Grow_continue. |  | ||||||
|      |  | ||||||
|     Signed-off-by: Xiao Ni <xni@redhat.com> |  | ||||||
|     Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| 
 |  | ||||||
| diff --git a/Grow.c b/Grow.c
 |  | ||||||
| index f184d9c..628f0e7 100755
 |  | ||||||
| --- a/Grow.c
 |  | ||||||
| +++ b/Grow.c
 |  | ||||||
| @@ -4788,6 +4788,7 @@ int Grow_continue_command(char *devname, int fd,
 |  | ||||||
|  	dprintf("Grow continue is run for "); |  | ||||||
|  	if (st->ss->external == 0) { |  | ||||||
|  		int d; |  | ||||||
| +		int cnt = 5;
 |  | ||||||
|  		dprintf_cont("native array (%s)\n", devname); |  | ||||||
|  		if (ioctl(fd, GET_ARRAY_INFO, &array.array) < 0) { |  | ||||||
|  			pr_err("%s is not an active md array - aborting\n", devname); |  | ||||||
| @@ -4799,36 +4800,42 @@ int Grow_continue_command(char *devname, int fd,
 |  | ||||||
|  		 * FIXME we should really get what we need from |  | ||||||
|  		 * sysfs |  | ||||||
|  		 */ |  | ||||||
| -		for (d = 0; d < MAX_DISKS; d++) {
 |  | ||||||
| -			mdu_disk_info_t disk;
 |  | ||||||
| -			char *dv;
 |  | ||||||
| -			int err;
 |  | ||||||
| -			disk.number = d;
 |  | ||||||
| -			if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
 |  | ||||||
| -				continue;
 |  | ||||||
| -			if (disk.major == 0 && disk.minor == 0)
 |  | ||||||
| -				continue;
 |  | ||||||
| -			if ((disk.state & (1 << MD_DISK_ACTIVE)) == 0)
 |  | ||||||
| -				continue;
 |  | ||||||
| -			dv = map_dev(disk.major, disk.minor, 1);
 |  | ||||||
| -			if (!dv)
 |  | ||||||
| -				continue;
 |  | ||||||
| -			fd2 = dev_open(dv, O_RDONLY);
 |  | ||||||
| -			if (fd2 < 0)
 |  | ||||||
| -				continue;
 |  | ||||||
| -			err = st->ss->load_super(st, fd2, NULL);
 |  | ||||||
| -			close(fd2);
 |  | ||||||
| -			if (err)
 |  | ||||||
| -				continue;
 |  | ||||||
| -			break;
 |  | ||||||
| -		}
 |  | ||||||
| -		if (d == MAX_DISKS) {
 |  | ||||||
| -			pr_err("Unable to load metadata for %s\n",
 |  | ||||||
| -			       devname);
 |  | ||||||
| -			ret_val = 1;
 |  | ||||||
| -			goto Grow_continue_command_exit;
 |  | ||||||
| -		}
 |  | ||||||
| -		st->ss->getinfo_super(st, content, NULL);
 |  | ||||||
| +		do {
 |  | ||||||
| +			for (d = 0; d < MAX_DISKS; d++) {
 |  | ||||||
| +				mdu_disk_info_t disk;
 |  | ||||||
| +				char *dv;
 |  | ||||||
| +				int err;
 |  | ||||||
| +				disk.number = d;
 |  | ||||||
| +				if (ioctl(fd, GET_DISK_INFO, &disk) < 0)
 |  | ||||||
| +					continue;
 |  | ||||||
| +				if (disk.major == 0 && disk.minor == 0)
 |  | ||||||
| +					continue;
 |  | ||||||
| +				if ((disk.state & (1 << MD_DISK_ACTIVE)) == 0)
 |  | ||||||
| +					continue;
 |  | ||||||
| +				dv = map_dev(disk.major, disk.minor, 1);
 |  | ||||||
| +				if (!dv)
 |  | ||||||
| +					continue;
 |  | ||||||
| +				fd2 = dev_open(dv, O_RDONLY);
 |  | ||||||
| +				if (fd2 < 0)
 |  | ||||||
| +					continue;
 |  | ||||||
| +				err = st->ss->load_super(st, fd2, NULL);
 |  | ||||||
| +				close(fd2);
 |  | ||||||
| +				if (err)
 |  | ||||||
| +					continue;
 |  | ||||||
| +				break;
 |  | ||||||
| +			}
 |  | ||||||
| +			if (d == MAX_DISKS) {
 |  | ||||||
| +				pr_err("Unable to load metadata for %s\n",
 |  | ||||||
| +				       devname);
 |  | ||||||
| +				ret_val = 1;
 |  | ||||||
| +				goto Grow_continue_command_exit;
 |  | ||||||
| +			}
 |  | ||||||
| +			st->ss->getinfo_super(st, content, NULL);
 |  | ||||||
| +			if (!content->reshape_active)
 |  | ||||||
| +				sleep(3);
 |  | ||||||
| +			else
 |  | ||||||
| +				break;
 |  | ||||||
| +		} while (cnt-- > 0);
 |  | ||||||
|  	} else { |  | ||||||
|  		char *container; |  | ||||||
|   |  | ||||||
| @ -1,42 +0,0 @@ | |||||||
| From b2be2b628b6305712c8df0b3a20ddddc0ac410fb Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> |  | ||||||
| Date: Thu, 16 Jun 2016 11:31:36 +0200 |  | ||||||
| Subject: [PATCH 1/2] imsm: add handling of sync_action is equal to 'idle' |  | ||||||
| 
 |  | ||||||
| After resync is stopped sync_action value become 'idle'. |  | ||||||
| We treat this case as normal termination of waiting, not as error. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> |  | ||||||
| Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  super-intel.c | 4 +++- |  | ||||||
|  1 file changed, 3 insertions(+), 1 deletion(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-intel.c b/super-intel.c
 |  | ||||||
| index 7e2860c..7950bef 100644
 |  | ||||||
| --- a/super-intel.c
 |  | ||||||
| +++ b/super-intel.c
 |  | ||||||
| @@ -10423,6 +10423,8 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 |  | ||||||
|  		if (sysfs_get_str(sra, NULL, "sync_action", |  | ||||||
|  				  action, 20) > 0 && |  | ||||||
|  				strncmp(action, "reshape", 7) != 0) { |  | ||||||
| +			if (strncmp(action, "idle", 4) == 0)
 |  | ||||||
| +				break;
 |  | ||||||
|  			close(fd); |  | ||||||
|  			return -1; |  | ||||||
|  		} |  | ||||||
| @@ -10432,9 +10434,9 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 |  | ||||||
|  			return 1; |  | ||||||
|  		} |  | ||||||
|  	} while (completed < position_to_set); |  | ||||||
| +
 |  | ||||||
|  	close(fd); |  | ||||||
|  	return 0; |  | ||||||
| -
 |  | ||||||
|  } |  | ||||||
|   |  | ||||||
|  /******************************************************************************* |  | ||||||
| -- 
 |  | ||||||
| 2.5.5 |  | ||||||
| 
 |  | ||||||
| @ -1,89 +0,0 @@ | |||||||
| From 0febb20c458a488460eadade74a6c283aadaf96a Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> |  | ||||||
| Date: Thu, 16 Jun 2016 11:31:37 +0200 |  | ||||||
| Subject: [PATCH 2/2] imsm: properly handle values of sync_completed |  | ||||||
| 
 |  | ||||||
| The sync_completed can be set to such values: |  | ||||||
| - two numbers of processed sectors and total during synchronization,
 |  | ||||||
| separated with '/'; |  | ||||||
| - 'none' if synchronization process is stopped;
 |  | ||||||
| - 'delayed' if synchronization process is delayed.
 |  | ||||||
| Handle value of sync_completed not only as numbers but |  | ||||||
| also check for 'none' and 'delayed'. |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> |  | ||||||
| Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com> |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  super-intel.c | 36 ++++++++++++++++++++++++++++++++++-- |  | ||||||
|  1 file changed, 34 insertions(+), 2 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-intel.c b/super-intel.c
 |  | ||||||
| index 7950bef..92817e9 100644
 |  | ||||||
| --- a/super-intel.c
 |  | ||||||
| +++ b/super-intel.c
 |  | ||||||
| @@ -10363,6 +10363,33 @@ exit_imsm_reshape_super:
 |  | ||||||
|  	return ret_val; |  | ||||||
|  } |  | ||||||
|   |  | ||||||
| +#define COMPLETED_OK		0
 |  | ||||||
| +#define COMPLETED_NONE		1
 |  | ||||||
| +#define COMPLETED_DELAYED	2
 |  | ||||||
| +
 |  | ||||||
| +static int read_completed(int fd, unsigned long long *val)
 |  | ||||||
| +{
 |  | ||||||
| +	int ret;
 |  | ||||||
| +	char buf[50];
 |  | ||||||
| +
 |  | ||||||
| +	ret = sysfs_fd_get_str(fd, buf, 50);
 |  | ||||||
| +	if (ret < 0)
 |  | ||||||
| +		return ret;
 |  | ||||||
| +
 |  | ||||||
| +	ret = COMPLETED_OK;
 |  | ||||||
| +	if (strncmp(buf, "none", 4) == 0) {
 |  | ||||||
| +		ret = COMPLETED_NONE;
 |  | ||||||
| +	} else if (strncmp(buf, "delayed", 7) == 0) {
 |  | ||||||
| +		ret = COMPLETED_DELAYED;
 |  | ||||||
| +	} else {
 |  | ||||||
| +		char *ep;
 |  | ||||||
| +		*val = strtoull(buf, &ep, 0);
 |  | ||||||
| +		if (ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' '))
 |  | ||||||
| +			ret = -1;
 |  | ||||||
| +	}
 |  | ||||||
| +	return ret;
 |  | ||||||
| +}
 |  | ||||||
| +
 |  | ||||||
|  /******************************************************************************* |  | ||||||
|   * Function:	wait_for_reshape_imsm |  | ||||||
|   * Description:	Function writes new sync_max value and waits until |  | ||||||
| @@ -10417,8 +10444,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
|  	do { |  | ||||||
| +		int rc;
 |  | ||||||
|  		char action[20]; |  | ||||||
|  		int timeout = 3000; |  | ||||||
| +
 |  | ||||||
|  		sysfs_wait(fd, &timeout); |  | ||||||
|  		if (sysfs_get_str(sra, NULL, "sync_action", |  | ||||||
|  				  action, 20) > 0 && |  | ||||||
| @@ -10428,11 +10457,14 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 |  | ||||||
|  			close(fd); |  | ||||||
|  			return -1; |  | ||||||
|  		} |  | ||||||
| -		if (sysfs_fd_get_ll(fd, &completed) < 0) {
 |  | ||||||
| +
 |  | ||||||
| +		rc = read_completed(fd, &completed);
 |  | ||||||
| +		if (rc < 0) {
 |  | ||||||
|  			dprintf("cannot read reshape_position (in loop)\n"); |  | ||||||
|  			close(fd); |  | ||||||
|  			return 1; |  | ||||||
| -		}
 |  | ||||||
| +		} else if (rc == COMPLETED_NONE)
 |  | ||||||
| +			break;
 |  | ||||||
|  	} while (completed < position_to_set); |  | ||||||
|   |  | ||||||
|  	close(fd); |  | ||||||
| -- 
 |  | ||||||
| 2.5.5 |  | ||||||
| 
 |  | ||||||
| @ -1,31 +0,0 @@ | |||||||
| From 977d12d739deedd21ea3ca5a96d0ffd83bd5b4ea Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| Date: Mon, 15 Aug 2016 11:30:39 -0400 |  | ||||||
| Subject: [PATCH] mdadm.h: Fix build problem against newer glibc |  | ||||||
| 
 |  | ||||||
| Newer glibc requires direct include of sys/sysmacros.h in order to |  | ||||||
| access makedev(). |  | ||||||
| 
 |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  mdadm.h | 4 ++++ |  | ||||||
|  1 file changed, 4 insertions(+) |  | ||||||
| 
 |  | ||||||
| diff --git a/mdadm.h b/mdadm.h
 |  | ||||||
| index 1fd38a3..cfa5beb 100755
 |  | ||||||
| --- a/mdadm.h
 |  | ||||||
| +++ b/mdadm.h
 |  | ||||||
| @@ -45,6 +45,10 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 |  | ||||||
|  #include	<errno.h> |  | ||||||
|  #include	<string.h> |  | ||||||
|  #include	<syslog.h> |  | ||||||
| +#ifdef __GLIBC__
 |  | ||||||
| +/* Newer glibc requires sys/sysmacros.h directly for makedev() */
 |  | ||||||
| +#include	<sys/sysmacros.h>
 |  | ||||||
| +#endif
 |  | ||||||
|  #ifdef __dietlibc__ |  | ||||||
|  #include	<strings.h> |  | ||||||
|  /* dietlibc has deprecated random and srandom!! */ |  | ||||||
| -- 
 |  | ||||||
| 2.7.4 |  | ||||||
| 
 |  | ||||||
| @ -1,63 +0,0 @@ | |||||||
| From 942e1cdb4a6a5be02672bc686169c679e775c2be Mon Sep 17 00:00:00 2001 |  | ||||||
| From: NeilBrown <neilb@suse.com> |  | ||||||
| Date: Thu, 18 Feb 2016 15:53:32 +1100 |  | ||||||
| Subject: [PATCH] super-intel: ensure suspended region is removed when reshape |  | ||||||
|  completes. |  | ||||||
| 
 |  | ||||||
| A recent commit removed a call to abort_reshape() when IMSM reshape |  | ||||||
| completed.  An unanticipated result of this is that the suspended |  | ||||||
| region is not cleared as it should be. |  | ||||||
| So after a reshape, a region of the array will cause all IO to block. |  | ||||||
| 
 |  | ||||||
| Re-instate the required updates to suspend_{lo,hi} coped from |  | ||||||
| abort_reshape(). |  | ||||||
| 
 |  | ||||||
| This is caught (sometimes) by the test suite. |  | ||||||
| 
 |  | ||||||
| Also fix a couple of typos found while exploring the code. |  | ||||||
| 
 |  | ||||||
| Reported-by: Ken Moffat <zarniwhoop@ntlworld.com> |  | ||||||
| Cc: Artur Paszkiewicz <artur.paszkiewicz@intel.com> |  | ||||||
| Fixes: 2139b03c2080 ("imsm: don't call abort_reshape() in imsm_manage_reshape()") |  | ||||||
| Signed-off-by: NeilBrown <neilb@suse.com> |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  super-intel.c | 8 ++++++-- |  | ||||||
|  1 file changed, 6 insertions(+), 2 deletions(-) |  | ||||||
| 
 |  | ||||||
| diff --git a/super-intel.c b/super-intel.c
 |  | ||||||
| index 90b7b6d..ff0506d 100644
 |  | ||||||
| --- a/super-intel.c
 |  | ||||||
| +++ b/super-intel.c
 |  | ||||||
| @@ -10465,7 +10465,7 @@ int check_degradation_change(struct mdinfo *info,
 |  | ||||||
|   * Function:	imsm_manage_reshape |  | ||||||
|   * Description:	Function finds array under reshape and it manages reshape |  | ||||||
|   *		process. It creates stripes backups (if required) and sets |  | ||||||
| - *		checheckpoits.
 |  | ||||||
| + *		checkpoints.
 |  | ||||||
|   * Parameters: |  | ||||||
|   *	afd		: Backup handle (nattive) - not used |  | ||||||
|   *	sra		: general array info |  | ||||||
| @@ -10595,7 +10595,7 @@ static int imsm_manage_reshape(
 |  | ||||||
|   |  | ||||||
|  		start = current_position * 512; |  | ||||||
|   |  | ||||||
| -		/* allign reading start to old geometry */
 |  | ||||||
| +		/* align reading start to old geometry */
 |  | ||||||
|  		start_buf_shift = start % old_data_stripe_length; |  | ||||||
|  		start_src = start - start_buf_shift; |  | ||||||
|   |  | ||||||
| @@ -10700,6 +10700,10 @@ static int imsm_manage_reshape(
 |  | ||||||
|  	ret_val = 1; |  | ||||||
|  abort: |  | ||||||
|  	free(buf); |  | ||||||
| +	/* See Grow.c: abort_reshape() for further explanation */
 |  | ||||||
| +	sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL);
 |  | ||||||
| +	sysfs_set_num(sra, NULL, "suspend_hi", 0);
 |  | ||||||
| +	sysfs_set_num(sra, NULL, "suspend_lo", 0);
 |  | ||||||
|   |  | ||||||
|  	return ret_val; |  | ||||||
|  } |  | ||||||
| -- 
 |  | ||||||
| 2.5.0 |  | ||||||
| 
 |  | ||||||
| @ -1,36 +0,0 @@ | |||||||
| From 1dcee1c9cbcf9592275914706b76b1931490092c Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| Date: Wed, 6 Apr 2016 16:13:59 -0400 |  | ||||||
| Subject: [PATCH] super1: Clear memory allocated for superblock + bitmap before |  | ||||||
|  use |  | ||||||
| 
 |  | ||||||
| load_super1() did not clear memory allocated for the superblock + |  | ||||||
| bitmap. This causes issues if the superblock does not contain a bitmap |  | ||||||
| as later checks of bitmap features would rely on the bits being |  | ||||||
| cleared. |  | ||||||
| 
 |  | ||||||
| This bug has been around for a long time, but was only exposed in |  | ||||||
| mdadm-3.4 with the introduction of the clustering code. |  | ||||||
| 
 |  | ||||||
| Reported-by: Jan Stodola <jstodola@redhat.com> |  | ||||||
| Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| ---
 |  | ||||||
|  super1.c | 2 ++ |  | ||||||
|  1 file changed, 2 insertions(+) |  | ||||||
| 
 |  | ||||||
| diff --git a/super1.c b/super1.c
 |  | ||||||
| index d6f3c93..8d5543f 100644
 |  | ||||||
| --- a/super1.c
 |  | ||||||
| +++ b/super1.c
 |  | ||||||
| @@ -2016,6 +2016,8 @@ static int load_super1(struct supertype *st, int fd, char *devname)
 |  | ||||||
|  		return 1; |  | ||||||
|  	} |  | ||||||
|   |  | ||||||
| +	memset(super, 0, SUPER1_SIZE);
 |  | ||||||
| +
 |  | ||||||
|  	if (aread(&afd, super, MAX_SB_SIZE) != MAX_SB_SIZE) { |  | ||||||
|  		if (devname) |  | ||||||
|  			pr_err("Cannot read superblock on %s\n", |  | ||||||
| -- 
 |  | ||||||
| 2.5.5 |  | ||||||
| 
 |  | ||||||
| @ -1,41 +0,0 @@ | |||||||
| commit 1d13b599607e48446273913ce594931ba53df9fd |  | ||||||
| Author: Xiao Ni <xni@redhat.com> |  | ||||||
| Date:   Sat Feb 6 09:18:41 2016 +0800 |  | ||||||
| 
 |  | ||||||
|     Fix some type comparison problems |  | ||||||
|      |  | ||||||
|     As 26714713cd2bad9e0bf7f4669f6cc4659ceaab6c said, 32 bit signed |  | ||||||
|     timestamps will overflow in the year 2038. It already changed the |  | ||||||
|     utime and ctime in struct mdu_array_info_s from int to unsigned |  | ||||||
|     int. So we need to change the values that compared with them to |  | ||||||
|     unsigned int too. |  | ||||||
|      |  | ||||||
|     Signed-off-by : Xiao Ni <xni@redhat.com> |  | ||||||
|     Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> |  | ||||||
| 
 |  | ||||||
| diff --git a/Monitor.c b/Monitor.c
 |  | ||||||
| index f19c2e5..6df80f9 100644
 |  | ||||||
| --- a/Monitor.c
 |  | ||||||
| +++ b/Monitor.c
 |  | ||||||
| @@ -33,7 +33,7 @@
 |  | ||||||
|  struct state { |  | ||||||
|  	char *devname; |  | ||||||
|  	char devnm[32];	/* to sync with mdstat info */ |  | ||||||
| -	long utime;
 |  | ||||||
| +	unsigned int utime;
 |  | ||||||
|  	int err; |  | ||||||
|  	char *spare_group; |  | ||||||
|  	int active, working, failed, spare, raid; |  | ||||||
| diff --git a/util.c b/util.c
 |  | ||||||
| index 970d484..6e7d3fb 100644
 |  | ||||||
| --- a/util.c
 |  | ||||||
| +++ b/util.c
 |  | ||||||
| @@ -1267,7 +1267,7 @@ struct supertype *guess_super_type(int fd, enum guess_types guess_type)
 |  | ||||||
|  	 */ |  | ||||||
|  	struct superswitch  *ss; |  | ||||||
|  	struct supertype *st; |  | ||||||
| -	time_t besttime = 0;
 |  | ||||||
| +	unsigned int besttime = 0;
 |  | ||||||
|  	int bestsuper = -1; |  | ||||||
|  	int i; |  | ||||||
|   |  | ||||||
							
								
								
									
										29
									
								
								mdadm.spec
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								mdadm.spec
									
									
									
									
									
								
							| @ -1,7 +1,7 @@ | |||||||
| Summary:     The mdadm program controls Linux md devices (software RAID arrays) | Summary:     The mdadm program controls Linux md devices (software RAID arrays) | ||||||
| Name:        mdadm | Name:        mdadm | ||||||
| Version:     3.4 | Version:     4.0 | ||||||
| Release:     3%{?dist} | Release:     1%{?dist} | ||||||
| Source:      http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz | Source:      http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz | ||||||
| Source1:     mdmonitor.init | Source1:     mdmonitor.init | ||||||
| Source2:     raid-check | Source2:     raid-check | ||||||
| @ -12,16 +12,6 @@ Source6:     mdmonitor.service | |||||||
| Source7:     mdadm.conf | Source7:     mdadm.conf | ||||||
| Source8:     mdadm_event.conf | Source8:     mdadm_event.conf | ||||||
| 
 | 
 | ||||||
| Patch1:      mdadm-3.4.1-fix-some-type-comparison.patch |  | ||||||
| Patch2:      mdadm-3.4-super-intel-ensure-suspended-region-is-removed-when-.patch |  | ||||||
| Patch3:      mdadm-3.4-super1-Clear-memory-allocated-for-superblock-bitmap-.patch |  | ||||||
| Patch4:      mdadm-3.4-IMSM-retry-reading-sync_completed-during-reshape.patch |  | ||||||
| Patch5:      mdadm-3.4-imsm-add-handling-of-sync_action-is-equal-to-idle.patch |  | ||||||
| Patch6:      mdadm-3.4-imsm-properly-handle-values-of-sync_completed.patch |  | ||||||
| Patch7:      mdadm-3.4-The-sys_name-array-in-the-mdinfo-structure-is-20-byt.patch |  | ||||||
| Patch8:      mdadm-3.4-Grow_continue_command-remove-dead-code.patch |  | ||||||
| Patch9:      mdadm-3.4-check-reshape_active-more-times-before-Grow_continue.patch |  | ||||||
| Patch10:     mdadm-3.4-mdadm.h-Fix-build-problem-against-newer-glibc.patch |  | ||||||
| # Fedora customization patches | # Fedora customization patches | ||||||
| Patch97:     mdadm-3.3-udev.patch | Patch97:     mdadm-3.3-udev.patch | ||||||
| Patch98:     mdadm-2.5.2-static.patch | Patch98:     mdadm-2.5.2-static.patch | ||||||
| @ -50,17 +40,6 @@ file can be used to help with some common tasks. | |||||||
| %prep | %prep | ||||||
| %setup -q | %setup -q | ||||||
| 
 | 
 | ||||||
| %patch1 -p1 -b .comparison |  | ||||||
| %patch2  -p1 -b .stop-reshape |  | ||||||
| %patch3  -p1 -b .clear |  | ||||||
| %patch4  -p1 -b .retry |  | ||||||
| %patch5  -p1 -b .syncaction |  | ||||||
| %patch6  -p1 -b .synccompleted |  | ||||||
| %patch7  -p1 -b .sysname |  | ||||||
| %patch8  -p1 -b .dead |  | ||||||
| %patch9  -p1 -b .before |  | ||||||
| %patch10  -p1 -b .glibc |  | ||||||
| 
 |  | ||||||
| # Fedora customization patches | # Fedora customization patches | ||||||
| %patch97 -p1 -b .udev | %patch97 -p1 -b .udev | ||||||
| %patch98 -p1 -b .static | %patch98 -p1 -b .static | ||||||
| @ -125,6 +104,10 @@ rm -rf %{buildroot} | |||||||
| /etc/libreport/events.d/* | /etc/libreport/events.d/* | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Thu Jan 12 2017 Xiao Ni <xni@redhat.com> - 4.0-1 | ||||||
|  | - Upgrade to mdadm-4.0  | ||||||
|  | - Resolves bz1411555 | ||||||
|  | 
 | ||||||
| * Mon Aug 15 2016 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.4-3 | * Mon Aug 15 2016 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.4-3 | ||||||
| - Fix build against newer glibc (Fedora 26+) | - Fix build against newer glibc (Fedora 26+) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user