From: Li Nan <linan666@huaweicloud.com>
To: Yu Kuai <yukuai1@huaweicloud.com>,
linan666@huaweicloud.com, song@kernel.org, neilb@suse.com,
mariusz.tkaczyk@linux.intel.com, shli@fb.com
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com,
"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v5 7/8] md: sync blockdev before stopping raid or setting readonly
Date: Fri, 2 Feb 2024 17:26:36 +0800 [thread overview]
Message-ID: <c73fc514-78c1-20c6-b543-d8e7cd16f200@huaweicloud.com> (raw)
In-Reply-To: <8f6a305f-75ed-f103-4a52-9e88699d9289@huaweicloud.com>
在 2024/2/2 10:12, Yu Kuai 写道:
> Hi,
>
> 在 2024/02/01 14:34, linan666@huaweicloud.com 写道:
>> From: Li Nan <linan122@huawei.com>
>>
>> Commit a05b7ea03d72 ("md: avoid crash when stopping md array races
>> with closing other open fds.") added sync_block before stopping raid and
>> setting readonly. Later in commit 260fa034ef7a ("md: avoid deadlock when
>> dirty buffers during md_stop.") it is moved to ioctl. array_state_store()
>> was ignored. Add sync blockdev to array_state_store() now.
>
> You're not just adding sync_blockdev() here. Please rewrite the tittle
> and commit message.
>
>>
>> Signed-off-by: Li Nan <linan122@huawei.com>
>> ---
>> drivers/md/md.c | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 4c7a0225f77d..86becf0015f5 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -4493,6 +4493,16 @@ array_state_store(struct mddev *mddev, const char
>> *buf, size_t len)
>> case broken: /* cannot be set */
>> case bad_word:
>> return -EINVAL;
>> + case clear:
>> + case readonly:
>> + case inactive:
>> + case read_auto:
>> + if (!mddev->pers || !md_is_rdwr(mddev))
>> + break;
>> + err = mddev_set_closing_and_sync_blockdev(mddev);
>
> In this context, mddev->openers should be zero, and such check is in
> do_md_stop() and md_set_readonly():
>
Yeah, the checks in do_md_stop() and md_set_readonly() can be removed after
this patch. However, 'mddev->open_metux' is used to protect MD_CLOSING and
'mddev->openers', it can be removed in these functions, too.
I will fix it later. Thanks for your review.
> if (atomic_read(&mddev->openers) > !!bdev).
>
> Thanks,
> Kuai
>
--
Thanks,
Nan
next prev parent reply other threads:[~2024-02-02 9:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 6:33 [PATCH v5 0/8] bugfix of MD_CLOSING and clean up md_ioctl() linan666
2024-02-01 6:33 ` [PATCH v5 1/8] md: merge the check of capabilities into md_ioctl_valid() linan666
2024-02-02 1:17 ` Yu Kuai
2024-02-01 6:33 ` [PATCH v5 2/8] md: changed the switch of RAID_VERSION to if linan666
2024-02-02 1:19 ` Yu Kuai
2024-02-01 6:33 ` [PATCH v5 3/8] md: clean up invalid BUG_ON in md_ioctl linan666
2024-02-02 1:20 ` Yu Kuai
2024-02-01 6:34 ` [PATCH v5 4/8] md: return directly before setting did_set_md_closing linan666
2024-02-02 1:24 ` Yu Kuai
2024-02-01 6:34 ` [PATCH v5 5/8] md: Don't clear MD_CLOSING when the raid is about to stop linan666
2024-02-02 1:26 ` Yu Kuai
2024-02-01 6:34 ` [PATCH v5 6/8] md: factor out a helper to sync mddev linan666
2024-02-01 6:34 ` [PATCH v5 7/8] md: sync blockdev before stopping raid or setting readonly linan666
2024-02-02 2:12 ` Yu Kuai
2024-02-02 9:26 ` Li Nan [this message]
2024-02-01 6:34 ` [PATCH v5 8/8] md: check mddev->pers before calling md_set_readonly() linan666
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=c73fc514-78c1-20c6-b543-d8e7cd16f200@huaweicloud.com \
--to=linan666@huaweicloud.com \
--cc=houtao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=mariusz.tkaczyk@linux.intel.com \
--cc=neilb@suse.com \
--cc=shli@fb.com \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).