Re: [PATCH -next 3/3] md: use interruptible apis in idle/frozen_sync_thread()
From: Song Liu
Date: Tue Jan 30 2024 - 02:35:02 EST
On Mon, Jan 29, 2024 at 11:04 PM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> 在 2024/01/30 14:37, Song Liu 写道:
> > Hi,
> >
> > Sorry for the late reply.
> >
> > The first two patches of the set look good, so I applied them to
> > md-tmp-6.9 branch. However, this one needs a respin.
>
> We are fixing dm-raid regressions, so I'll not send a new version until
> that work is done. :)
Sure. Fixing the regression is more urgent.
> >
> > On Thu, Dec 28, 2023 at 4:58 AM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote:
> >>
> >> From: Yu Kuai <yukuai3@xxxxxxxxxx>
[...]
> > I found prepare_to_stop_sync_thread very hard to reason. Please try to
> > rephrase the comment or refactor the code. Maybe it makes sense to put
> > the following logic and its variations to a separate function:
> >
> > if (prepare_to_stop_sync_thread(mddev, false)) {
> > wait_event(resync_wait, sync_thread_stopped(mddev, NULL));
> > mddev_lock_nointr(mddev);
> > }
>
> I can do this, but there are 5 callers and only two of them can use the
> separate caller. Pehaps something like this?
>
> void stop_sync_thread(struct mddev *mddev, bool wait_sb)
> {
> if (prepare_to_stop_sync_thread(mddev, wait_sb)) {
> wait_event(resync_wait, ...);
> if (!wait_sb) {
> mddev_lock_nointr(mddev);
> return;
> }
> }
>
> if (wait_sb) {
> wait_event(sb_wait, ...);
> mddev_lock_nointr(mddev);
> }
> }
I don't really like this version either. Let's think more about this
after fixing the dm-raid regressions.
Thanks,
Song
>
> int stop_sync_thread_interruptible(struct mddev *mddev, bool check_sync_seq)
> {
> ...
> }