Re: [PATCH 06/13] imsm: FIX: update disks status in container_contents()

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

 



On Mon, 10 Jan 2011 12:28:15 +0100 Adam Kwolek <adam.kwolek@xxxxxxxxx> wrote:

> Based on status information disks are added to array during grow (in reshape_array()).
> This information currently is not present and all disks (old and new) were added to md.
> To avoid adding already present disks, disk.state has to be set.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
> ---
> 
>  super-intel.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/super-intel.c b/super-intel.c
> index 9687993..2700401 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -4541,6 +4541,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
>  	for (i = 0; i < mpb->num_raid_devs; i++) {
>  		struct imsm_dev *dev;
>  		struct imsm_map *map;
> +		struct imsm_map *map2;
>  		struct mdinfo *this;
>  		int slot;
>  		char *ep;
> @@ -4551,6 +4552,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
>  
>  		dev = get_imsm_dev(super, i);
>  		map = get_imsm_map(dev, 0);
> +		map2 = get_imsm_map(dev, 1);
>  
>  		/* do not publish arrays that are in the middle of an
>  		 * unsupported migration
> @@ -4632,7 +4634,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
>  			info_d->disk.minor = d->minor;
>  			info_d->disk.raid_disk = slot;
>  			info_d->recovery_start = recovery_start;
> -
> +			if (map2 && (map2->num_members > slot))
> +				info_d->disk.state = (1 << MD_DISK_ACTIVE);
>  			if (info_d->recovery_start == MaxSector)
>  				this->array.working_disks++;
>  


This patch looks a little odd.  It should still be setting disk.state even if
map2 == NULL.

The real problem here is simply that container_content isn't setting
disk.state properly.

I have change the patch to the following which should be closed to correct.

NeilBrown


commit 86e3692b06f255ead5c290288f0fe9318f75440d
Author: Adam Kwolek <adam.kwolek@xxxxxxxxx>
Date:   Wed Jan 12 15:12:44 2011 +1100

    imsm: FIX: update disks status in container_contents()
    
    Based on status information disks are added to array during grow (in reshape_array()).
    This information currently is not present and all disks (old and new) were added to md.
    To avoid adding already present disks, disk.state has to be set.
    
    Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
    Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/super-intel.c b/super-intel.c
index d62e6b7..f158163 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4541,6 +4541,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 	for (i = 0; i < mpb->num_raid_devs; i++) {
 		struct imsm_dev *dev;
 		struct imsm_map *map;
+		struct imsm_map *map2;
 		struct mdinfo *this;
 		int slot;
 		char *ep;
@@ -4551,6 +4552,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 
 		dev = get_imsm_dev(super, i);
 		map = get_imsm_map(dev, 0);
+		map2 = get_imsm_map(dev, 1);
 
 		/* do not publish arrays that are in the middle of an
 		 * unsupported migration
@@ -4632,7 +4634,13 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 			info_d->disk.minor = d->minor;
 			info_d->disk.raid_disk = slot;
 			info_d->recovery_start = recovery_start;
-
+			if (map2) {
+				if (slot < map2->num_members)
+					info_d->disk.state = (1 << MD_DISK_ACTIVE);
+			} else {
+				if (slot < map->num_members)
+					info_d->disk.state = (1 << MD_DISK_ACTIVE);
+			}
 			if (info_d->recovery_start == MaxSector)
 				this->array.working_disks++;
 

--
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