md-cluster: fix safemode_delay value when converting to clustered bitmap
authorZhao Heming <heming.zhao@suse.com>
Mon, 20 Jul 2020 18:08:52 +0000 (02:08 +0800)
committerSong Liu <songliubraving@fb.com>
Wed, 22 Jul 2020 00:30:12 +0000 (17:30 -0700)
commit7c9d5c54fb72d92fe3fd7d3a3eb58b5200e454c4
tree391a5e5f83425a594929b68c082d8f3df78c3953
parent3b5408b98e4db62b322f8516a0d08f95f197c42f
md-cluster: fix safemode_delay value when converting to clustered bitmap

When array convert to clustered bitmap, the safe_mode_delay doesn't
clean and vice versa. the /sys/block/mdX/md/safe_mode_delay keep original
value after changing bitmap type. In safe_delay_store(), the code forbids
setting mddev->safemode_delay when array is clustered. So in cluster-md
env, the expected safemode_delay value should be 0.

Reproducible steps:
```
node1 # mdadm --zero-superblock /dev/sd{b,c,d}
node1 # mdadm -C /dev/md0 -b internal -e 1.2 -n 2 -l mirror /dev/sdb /dev/sdc
node1 # cat /sys/block/md0/md/safe_mode_delay
0.204
node1 # mdadm -G /dev/md0 -b none
node1 # mdadm --grow /dev/md0 --bitmap=clustered
node1 # cat /sys/block/md0/md/safe_mode_delay
0.204  <== doesn't change, should ZERO for cluster-md

node1 # mdadm --zero-superblock /dev/sd{b,c,d}
node1 # mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sdb /dev/sdc
node1 # cat /sys/block/md0/md/safe_mode_delay
0.000
node1 # mdadm -G /dev/md0 -b none
node1 # cat /sys/block/md0/md/safe_mode_delay
0.000  <== doesn't change, should default value
```

Reviewed-by: NeilBrown <neilb@suse.de>
Signed-off-by: Zhao Heming <heming.zhao@suse.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
drivers/md/md.c