• Zhao Heming's avatar
    md-cluster: fix safemode_delay value when converting to clustered bitmap · 7c9d5c54
    Zhao Heming authored
    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: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarZhao Heming <heming.zhao@suse.com>
    Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
    7c9d5c54
md.c 258 KB