Re: [PATCH 2/3] imsm: FIX: 'UT 09imsm-assemble' fails

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

 



On Wed, 2011-12-14 at 16:07 +0100, Adam Kwolek wrote: 
> Problem was introduced by patch (2011-06-08):
>    getinfo_super now clears the 'info' structure before filling it in.
> 
> Field update private is not managed here and pointer associated outside
> is cleaned up.
> Add code for field update_private cleaning preservation.
> In places where in patch
>   'getinfo_super now clears the 'info' structure before filling it in.'
> cleaning structure was removed, cleaning update_private field was added
> as getinfo_super() cannot be responsible for this pointer management.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
> ---
> 
>  Assemble.c    |    2 ++
>  Incremental.c |    3 +++
>  super-intel.c |    9 +++++++++
>  3 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/Assemble.c b/Assemble.c
> index fac2bad..c8b538f 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -422,6 +422,7 @@ int Assemble(struct supertype *st, char *mddev,
>  					int uuid[4];
>  
>  					content = &info;
> +					info.update_private = NULL
>  					tst->ss->getinfo_super(tst, content, NULL);
>  
>  					if (!parse_uuid(ident->container, uuid) ||
> @@ -485,6 +486,7 @@ int Assemble(struct supertype *st, char *mddev,
>  		} else {
>  
>  			content = &info;
> +			info.update_private = NULL
>  			tst->ss->getinfo_super(tst, content, NULL);
>  
>  			if (!ident_matches(ident, content, tst,
> diff --git a/Incremental.c b/Incremental.c
> index d3724a4..112a1ec 100644
> --- a/Incremental.c
> +++ b/Incremental.c
> @@ -205,6 +205,7 @@ int Incremental(char *devname, int verbose, int runstop,
>  	}
>  	close (dfd); dfd = -1;
>  
> +	info.update_private = NULL
>  	st->ss->getinfo_super(st, &info, NULL);
>  
>  	/* 3/ Check if there is a match in mdadm.conf */
> @@ -404,6 +405,7 @@ int Incremental(char *devname, int verbose, int runstop,
>  				goto out_unlock;
>  			}
>  			close(dfd2);
> +			info.update_private = NULL
>  			st2->ss->getinfo_super(st2, &info2, NULL);
>  			st2->ss->free_super(st2);
>  			if (info.array.level != info2.array.level ||
> @@ -1382,6 +1384,7 @@ static int Incremental_container(struct supertype *st, char *devname,
>  	int ra_blocked = 0;
>  	int ra_all = 0;
>  
> +	info.update_private = NULL
>  	st->ss->getinfo_super(st, &info, NULL);
>  
>  	if ((runstop > 0 && info.container_enough >= 0) ||
> diff --git a/super-intel.c b/super-intel.c
> index e1073ef..5e1d278 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -2365,8 +2365,13 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
>  	char *devname;
>  	unsigned int component_size_alligment;
>  	int map_disks = info->array.raid_disks;
> +	void *update_private_saver = info->update_private;
>  
>  	memset(info, 0, sizeof(*info));
> +	/* preserve pointer cleanup, as someone elese is pointer owner
> +	 */

Comment formatting and typo.


> +	info->update_private = update_private_saver;
> +
>  	if (prev_map)
>  		map_to_analyse = prev_map;
>  
> @@ -2601,12 +2606,16 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
>  	int max_enough = -1;
>  	int i;
>  	struct imsm_super *mpb;
> +	void *update_private_saver = info->update_private;
>  
>  	if (super->current_vol >= 0) {
>  		getinfo_super_imsm_volume(st, info, map);
>  		return;
>  	}
>  	memset(info, 0, sizeof(*info));
> +	/* preserve pointer cleanup, as someone elese is pointer owner
> +	 */

Comment formatting and typo...

-PWM


> +	info->update_private = update_private_saver;
>  
>  	/* Set raid_disks to zero so that Assemble will always pull in valid
>  	 * spares
> 
> --
> 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


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