All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: song@kernel.org, linux-raid@vger.kernel.org,
	AceLan Kao <acelan@gmail.com>, "yukuai (C)" <yukuai3@huawei.com>,
	"yangerkun@huawei.com" <yangerkun@huawei.com>
Subject: Re: [PATCH v2] md: do not _put wrong device in md_seq_next
Date: Tue, 12 Sep 2023 15:40:11 +0200	[thread overview]
Message-ID: <20230912154011.00007399@linux.intel.com> (raw)
In-Reply-To: <5a71d6a0-c971-1e28-110d-a6ad2f81cda0@huaweicloud.com>

On Tue, 12 Sep 2023 21:25:24 +0800
Yu Kuai <yukuai1@huaweicloud.com> wrote:

> Hi,
> 
> 在 2023/09/12 21:01, Mariusz Tkaczyk 写道:
> > During working on changes proposed by Kuai [1], I determined that
> > mddev->active is continusly decremented for array marked by MD_CLOSING.
> > It brought me to md_seq_next() changed by [2]. I determined the regression
> > here, if mddev_get() fails we updated mddev pointer and as a result we
> > _put failed device.  
> 
> This mddev is decremented while there is another mddev increased, that's
> why AceLan said that single array can't reporduce the problem.
> 
> And because mddev->active is leaked, then del_gendisk() will never be
> called for the mddev while closing the array, that's why user will
> always see this array, cause infiniate loop open -> stop array -> close
> for systemd-shutdown.

Ohh, I see the scenario now...
First array can be successfully stopped. We marked MD_DELETED and proceed
with scheduling wq but in the middle of that md_seq_next() increased active for
other array and decrement active for the one with MD_DELETED.
For this next array we are unable to reach active == 0 anymore.

Song, let me know if you need description like that in commit message.

Thanks!
Mariusz

  reply	other threads:[~2023-09-12 13:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 13:01 [PATCH v2] md: do not _put wrong device in md_seq_next Mariusz Tkaczyk
2023-09-12 13:25 ` Yu Kuai
2023-09-12 13:40   ` Mariusz Tkaczyk [this message]
2023-09-12 20:24     ` Song Liu
2023-09-12 22:49 ` Song Liu
2023-09-13  8:26   ` Mariusz Tkaczyk
2023-09-13 16:22     ` Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230912154011.00007399@linux.intel.com \
    --to=mariusz.tkaczyk@linux.intel.com \
    --cc=acelan@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.