[PATCH 09/34] FIX: get updated information from metadata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Metadata is not modified by metadata preparation handler.
It has to be read again from array.
There is 2 read required:
1. before 'for' entry to get updated information after reshape_super() call
2. inside 'for' loop to get updated information for every processed array
  (it can happen /i.e. imsm case/ that container operation is a set of array operations
   and information in metadata is changed after every loop).

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 Grow.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Grow.c b/Grow.c
index 9e0a51d..5d73365 100644
--- a/Grow.c
+++ b/Grow.c
@@ -2083,6 +2083,8 @@ int reshape_container(char *container, int cfd, char *devname,
 		      int quiet)
 {
 	struct mdinfo *cc;
+	struct mdinfo *cc_fresh = NULL;
+
 	if (reshape_super(st, info->component_size, info->new_level,
 			  info->new_layout, info->new_chunk,
 			  info->array.raid_disks + info->delta_disks,
@@ -2091,6 +2093,14 @@ int reshape_container(char *container, int cfd, char *devname,
 
 	sync_metadata(st);
 
+	/* ping monitor to be sure that update is on disk
+	 */
+	ping_monitor(container);
+
+	/* reload metadata to get updated information
+	 */
+	st->ss->load_container(st, cfd, NULL);
+
 	cc = st->ss->container_content(st, NULL);
 
 	if (!cc)
@@ -2106,7 +2116,6 @@ int reshape_container(char *container, int cfd, char *devname,
 	case 0: /* child */
 		break;
 	}
-
 	/* For each member array, we need to perform the reshape */
 	for (; cc; cc = cc->next) {
 		int rv;
@@ -2128,12 +2137,18 @@ int reshape_container(char *container, int cfd, char *devname,
 		if (!adev)
 			adev = cc->text_version;
 
-		rv = reshape_array(container, fd, adev, st, cc, force,
+		sysfs_free(cc_fresh);
+		st->ss->load_container(st, cfd, NULL);
+		cc_fresh = st->ss->container_content(st, subarray);
+		rv = reshape_array(container, fd, adev, st,
+				   cc_fresh, force,
 				   backup_file, quiet, 1);
 		close(fd);
 		if (rv)
 			break;
 	}
+	sysfs_free(cc_fresh);
+	sysfs_free(cc);
 	exit(0);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux