From: Shaohua Li <shli@kernel.org>
To: Guoqing Jiang <gqjiang@suse.com>
Cc: linux-raid@vger.kernel.org, shli@fb.com, neilb@suse.de
Subject: Re: [PATCH 07/14] md: move bitmap_destroy before __md_stop
Date: Tue, 28 Feb 2017 10:20:09 -0800 [thread overview]
Message-ID: <20170228182009.zfsi2epb24ihjudp@kernel.org> (raw)
In-Reply-To: <1487906124-20107-8-git-send-email-gqjiang@suse.com>
On Fri, Feb 24, 2017 at 11:15:17AM +0800, Guoqing Jiang wrote:
> Since we have switched to sync way to handle METADATA_UPDATED
> msg for md-cluster, then process_metadata_update is depended
> on mddev->thread->wqueue.
>
> With the new change, clustered raid could possible hang if
> array received a METADATA_UPDATED msg after array unregistered
> mddev->thread, so we need to stop clustered raid earlier
> than before.
>
> And this change should be safe for non-clustered raid since
> all writes are stopped before the destroy. Also in md_run,
> we activate the personality (pers->run()) before activating
> the bitmap (bitmap_create()). So it is pleasingly symmetric
> to stop the bitmap (bitmap_destroy()) before stopping the
> personality (__md_stop() calls pers->free()).
There is no patch 6. So I can't judge the purpose of the patch.
The patch changed behaviors. We only destroy bitmap with mode == 0, now we do it
even for mode == 2. Please specify why it's safe. The __md_stop will wait for
behind writes for example only with bitmap set, but the patch makes us not do
the wait.
> Reviewed-by: NeilBrown <neilb@suse.com>
> Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
> ---
> drivers/md/md.c | 28 +++++++++++++++-------------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 6e910d99c9c1..7bcc757386e1 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -5582,8 +5582,8 @@ void md_stop(struct mddev *mddev)
> /* stop the array and free an attached data structures.
> * This is called from dm-raid
> */
> - __md_stop(mddev);
> bitmap_destroy(mddev);
> + __md_stop(mddev);
> if (mddev->bio_set)
> bioset_free(mddev->bio_set);
> }
> @@ -5696,6 +5696,20 @@ static int do_md_stop(struct mddev *mddev, int mode,
> set_disk_ro(disk, 0);
>
> __md_stop_writes(mddev);
> +
> + /*
> + * Destroy bitmap after all writes are stopped
> + */
> + bitmap_destroy(mddev);
> + if (mddev->bitmap_info.file) {
> + struct file *f = mddev->bitmap_info.file;
> + spin_lock(&mddev->lock);
> + mddev->bitmap_info.file = NULL;
> + spin_unlock(&mddev->lock);
> + fput(f);
> + }
> + mddev->bitmap_info.offset = 0;
> +
> __md_stop(mddev);
> mddev->queue->backing_dev_info.congested_fn = NULL;
>
> @@ -5720,19 +5734,7 @@ static int do_md_stop(struct mddev *mddev, int mode,
> */
> if (mode == 0) {
> pr_info("md: %s stopped.\n", mdname(mddev));
> -
> - bitmap_destroy(mddev);
> - if (mddev->bitmap_info.file) {
> - struct file *f = mddev->bitmap_info.file;
> - spin_lock(&mddev->lock);
> - mddev->bitmap_info.file = NULL;
> - spin_unlock(&mddev->lock);
> - fput(f);
> - }
> - mddev->bitmap_info.offset = 0;
> -
> export_array(mddev);
> -
> md_clean(mddev);
> if (mddev->hold_active == UNTIL_STOP)
> mddev->hold_active = 0;
> --
> 2.6.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-02-28 18:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 3:15 [PATCH 00/14] the latest changes for md-cluster Guoqing Jiang
2017-02-24 3:15 ` [PATCH 01/14] md-cluster: remove unnecessary header files Guoqing Jiang
2017-02-28 18:03 ` Shaohua Li
2017-03-01 2:47 ` Guoqing Jiang
2017-02-24 3:15 ` [PATCH 02/14] md-cluster: free md_cluster_info if node leave cluster Guoqing Jiang
2017-02-24 3:15 ` [PATCH 03/14] md-cluster: remove useless memset from gather_all_resync_info Guoqing Jiang
2017-02-24 3:15 ` [PATCH 04/14] md-cluster: add mddev into struct md_cluster_info Guoqing Jiang
2017-02-28 18:06 ` Shaohua Li
2017-03-01 2:49 ` Guoqing Jiang
2017-02-24 3:15 ` [PATCH 05/14] md-cluster: add new parameter for lock_token Guoqing Jiang
2017-02-28 18:07 ` Shaohua Li
2017-03-01 2:48 ` Guoqing Jiang
2017-02-24 3:15 ` [PATCH 07/14] md: move bitmap_destroy before __md_stop Guoqing Jiang
2017-02-28 18:20 ` Shaohua Li [this message]
2017-03-01 3:46 ` Guoqing Jiang
2017-02-24 3:15 ` [PATCH 08/14] md-cluster: set MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD before unregister thread Guoqing Jiang
2017-02-28 18:22 ` Shaohua Li
2017-02-24 3:15 ` [PATCH 09/14] md-cluster: set MD_CLUSTER_HOLDING_MUTEX_FOR_RECVD in metadata_update_start Guoqing Jiang
2017-02-28 18:24 ` Shaohua Li
2017-03-01 2:58 ` Guoqing Jiang
2017-02-24 3:15 ` [PATCH 10/14] md-cluster: add CHANGE_CAPACITY message type Guoqing Jiang
2017-02-24 3:15 ` [PATCH 11/14] md-cluster: introduce cluster_check_sync_size Guoqing Jiang
2017-02-28 19:05 ` Shaohua Li
2017-03-01 3:11 ` Guoqing Jiang
2017-02-24 3:15 ` [PATCH 12/14] md/bitmap: replace redundant codes with get_bitmap_from_slot Guoqing Jiang
2017-02-28 19:06 ` Shaohua Li
2017-02-24 3:15 ` [PATCH 13/14] md: move funcs from pers->resize to update_size Guoqing Jiang
2017-02-24 3:15 ` [PATCH 14/14] md-cluster: add the support for resize Guoqing Jiang
2017-02-28 19:25 ` Shaohua Li
2017-03-01 3:28 ` Guoqing Jiang
2017-02-28 19:27 ` [PATCH 00/14] the latest changes for md-cluster Shaohua Li
2017-03-01 3:50 ` Guoqing Jiang
2017-03-01 2:02 ` [PATCH 06/14] md-cluster: use sync way to handle METADATA_UPDATED msg Guoqing Jiang
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=20170228182009.zfsi2epb24ihjudp@kernel.org \
--to=shli@kernel.org \
--cc=gqjiang@suse.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=shli@fb.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 NNTP newsgroup(s).