Re: [PATCH v3] mdadm/Detail: show correct state for cluster-md array

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

 



On 7/28/20 11:48 PM, Zhao Heming wrote:
> After kernel md module commit 480523feae581, in md-cluster env,
> mddev->in_sync always zero, it will make array.state never set
> up MD_SB_CLEAN. it causes "mdadm -D /dev/mdX" show state 'active'
> all the time.
> 
> bitmap.c: add a new API IsBitmapDirty() to support inquiry bitmap
> dirty or clean.
> 
> Signed-off-by: Zhao Heming <heming.zhao@xxxxxxxx>
> ---
> v3:
> - Detail.c: fix error logic: v2 code didn't check bitmap when dv is null.
> v2:
> - Detail.c: change to read only one device.
> - bitmap.c: modify IsBitmapDirty() to check all bitmap on the selected device.
> 
> ---
>  Detail.c | 20 +++++++++++++++++++-
>  bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  mdadm.h  |  1 +
>  3 files changed, 75 insertions(+), 1 deletion(-)
> 
> diff --git a/Detail.c b/Detail.c
> index 24eeba0..a69e5ac 100644
> --- a/Detail.c
> +++ b/Detail.c
> @@ -495,8 +495,26 @@ int Detail(char *dev, struct context *c)
>  							  sra->array_state);
>  				else
>  					arrayst = "clean";
> -			} else
> +			} else {
>  				arrayst = "active";
> +				if (array.state & (1<<MD_SB_CLUSTERED)) {
> +					for (d = 0; d < max_disks * 2; d++) {
> +						char *dv;
> +						mdu_disk_info_t disk = disks[d];
> +
> +						if (d >= array.raid_disks * 2 &&
> +							disk.major == 0 && disk.minor == 0)
> +							continue;
> +						if ((d & 1) && disk.major == 0 && disk.minor == 0)
> +							continue;
> +						dv = map_dev_preferred(disk.major, disk.minor, 0,
> +												c->prefer);
> +						if (!dv) continue;

Minor nit here, never ever put if() < bleh on the same line.

Thanks,
Jes




[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