Re: [RFC] Assemble: mask FAILFAST and WRITEMOSTLY flags when finding the most recent device

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

 



On Tue, Nov 06 2018, Gioh Kim wrote:

> From: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxx>
>
> If devices[].i.disk.state has MD_DISK_FAILFAST or MD_DISK_WRITEMOSTLY
> flag, it cannot be the most recent device. Both flags should be masked
> before checking the state.
>
> Signed-off-by: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxx>
> ---
>  Assemble.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Assemble.c b/Assemble.c
> index f39c9e1..9f75c68 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -578,6 +578,7 @@ static int load_devices(struct devs *devices, char *devmap,
>  		struct supertype *tst;
>  		int i;
>  		int dfd;
> +		int disk_state;
>  
>  		if (tmpdev->used != 1)
>  			continue;
> @@ -711,7 +712,9 @@ static int load_devices(struct devs *devices, char *devmap,
>  		devices[devcnt].i.disk.major = major(stb.st_rdev);
>  		devices[devcnt].i.disk.minor = minor(stb.st_rdev);
>  
> -		if (devices[devcnt].i.disk.state == 6) {
> +		disk_state = devices[devcnt].i.disk.state & ~((1<<MD_DISK_FAILFAST) |
> +							      (1<<MD_DISK_WRITEMOSTLY));
> +		if (disk_state == ((1<<MD_DISK_ACTIVE) | (1<<MD_DISK_SYNC))) {

Reviewed-by: NeilBrown <neilb@xxxxxxxx>

Thanks,
NeilBrown


>  			if (most_recent < 0 ||
>  			    devices[devcnt].i.events
>  			    > devices[most_recent].i.events) {
> -- 
> 2.14.1

Attachment: signature.asc
Description: PGP signature


[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