linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: NeilBrown <neilb@suse.de>
Cc: agk <agk@redhat.com>, linux-raid <linux-raid@vger.kernel.org>,
	dm-devel <dm-devel@redhat.com>
Subject: Re: Re: [PATCH 0/3] Add a new func to handle with clearing up for stoping dm-raid.
Date: Mon, 19 Nov 2012 08:36:53 +0800	[thread overview]
Message-ID: <201211190836499417920@gmail.com> (raw)
In-Reply-To: 20121119104953.359f60ed@notabene.brown

>On Thu, 15 Nov 2012 16:46:54 +0800 majianpeng <majianpeng@gmail.com> wrote:
>
>> Because dm-raid call md_stop to clear up,but md_stop can't clear up completely.
>> So add a new func to do.
>> 
>> Jianpeng Ma (3):
>>   md:Add a func 'dm_md_stop' for dm-raid to clear up md resource.
>>   dm: When stoping dm-raid, it call dm_md_stop rather than md_stop to
>>     do clear-up work.
>>   md: Remove EXPORT_SYMBOL_GPL(md_stop).
>> 
>>  drivers/md/dm-raid.c |    4 ++--
>>  drivers/md/md.c      |   10 +++++++++-
>>  drivers/md/md.h      |    1 +
>>  3 files changed, 12 insertions(+), 3 deletions(-)
>> 
>
>You don't really need 3 patches for this one little change.
>
>I've applied the following.
>
>Thanks for the report.
>
>NeilBrown
>
>From 4ba69e1a88480249918ed2df8be0896be6ba7952 Mon Sep 17 00:00:00 2001
>From: NeilBrown <neilb@suse.de>
>Date: Mon, 19 Nov 2012 10:47:48 +1100
>Subject: [PATCH] md: make sure everything is freed when dm-raid stops an
> array.
>
>md_stop() would stop an array, but not free various attached
>data structures.
>For internal arrays, these are freed later in do_md_stop() or
>mddev_put(), but they don't apply for dm-raid arrays.
>So get md_stop() to free them, and only all it from dm-raid.
>For internal arrays we now call __md_stop.
>
>Reported-by: majianpeng <majianpeng@gmail.com>
>Signed-off-by: NeilBrown <neilb@suse.de>
>
>diff --git a/drivers/md/md.c b/drivers/md/md.c
>index 98e1484..71df3c2 100644
>--- a/drivers/md/md.c
>+++ b/drivers/md/md.c
>@@ -5294,7 +5294,7 @@ void md_stop_writes(struct mddev *mddev)
> }
> EXPORT_SYMBOL_GPL(md_stop_writes);
> 
>-void md_stop(struct mddev *mddev)
>+void __md_stop(struct mddev *mddev)
> {
> 	mddev->ready = 0;
> 	mddev->pers->stop(mddev);
>@@ -5304,6 +5304,18 @@ void md_stop(struct mddev *mddev)
> 	mddev->pers = NULL;
> 	clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
> }
>+
>+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);
>+	if (mddev->bio_set)
>+		bioset_free(mddev->bio_set);
>+}
>+
> EXPORT_SYMBOL_GPL(md_stop);
> 
> static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
>@@ -5364,7 +5376,7 @@ static int do_md_stop(struct mddev * mddev, int mode,
> 			set_disk_ro(disk, 0);
> 
> 		__md_stop_writes(mddev);
>-		md_stop(mddev);
>+		__md_stop(mddev);
> 		mddev->queue->merge_bvec_fn = NULL;
> 		mddev->queue->backing_dev_info.congested_fn = NULL;
> 
>
Thanks! 
Jianpeng

      reply	other threads:[~2012-11-19  0:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15  8:46 [PATCH 0/3] Add a new func to handle with clearing up for stoping dm-raid majianpeng
2012-11-18 23:49 ` NeilBrown
2012-11-19  0:36   ` majianpeng [this message]

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=201211190836499417920@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).