Re: [PATCH RESEND] md: allow to set the fail_fast on RAID1/RAID10

From: Song Liu
Date: Tue Oct 12 2021 - 04:18:00 EST


On Tue, Oct 12, 2021 at 1:07 AM Li Feng <fengli@xxxxxxxxxx> wrote:
>
> Xiao Ni <xni@xxxxxxxxxx> 于2021年10月12日周二 下午2:58写道:
> >
> > On Mon, Oct 11, 2021 at 5:42 PM Li Feng <fengli@xxxxxxxxxx> wrote:
> > >
> > > Xiao Ni <xni@xxxxxxxxxx> 于2021年10月11日周一 下午3:49写道:
> > > >
> > > > Hi all
> > > >
> > > > Now the per device sysfs interface file state can change failfast. Do
> > > > we need a new file for failfast?
> > > >
> > > > I did a test. The steps are:
> > > >
> > > > mdadm -CR /dev/md0 -l1 -n2 /dev/sdb /dev/sdc --assume-clean
> > > > cd /sys/block/md0/md/dev-sdb
> > > > echo failfast > state
> > > > cat state
> > > > in_sync,failfast
> > >
> > > This works, will it be persisted to disk?
> > >
> >
> > mdadm --detail /dev/md0 can show the failfast information. So it
> > should be written in superblock.
> > But I don't find how md does this. I'm looking at this.
> >
> Yes, I have tested that it has been persisted, but don't understand who does it.

I think this is not guaranteed to be persistent:

[root@eth50-1 ~]# cat /sys/block/md127/md/rd1/state
in_sync,failfast
[root@eth50-1 ~]# echo -failfast > /sys/block/md127/md/rd1/state
[root@eth50-1 ~]# cat /sys/block/md127/md/rd1/state
in_sync
[root@eth50-1 ~]# mdadm --stop /dev/md*
mdadm: /dev/md does not appear to be an md device
mdadm: stopped /dev/md127
[root@eth50-1 ~]# mdadm -As
mdadm: /dev/md/0_0 has been started with 4 drives.
[root@eth50-1 ~]# cat /sys/block/md127/md/rd1/state
in_sync,failfast

How about we fix state_store to make sure it is always persistent?

Thanks,
Song