linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH V1] md:Fix name of raid thread when raid takeovered.
Date: Tue, 5 Jun 2012 15:48:51 +1000	[thread overview]
Message-ID: <20120605154851.0664f8fb@notabene.brown> (raw)
In-Reply-To: <201206051337125784360@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

On Tue, 5 Jun 2012 13:37:15 +0800 majianpeng <majianpeng@gmail.com> wrote:

> When raid takeovered, it used old personality to set task->comm[].
> So we add judgement and set corrected task->comm[].
> 
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
>  drivers/md/md.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 1c2f904..6b3ce6e 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -6738,11 +6738,25 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev
>  				 const char *name)
>  {
>  	struct md_thread *thread;
> +	struct md_personality *pers = NULL;
>  
>  	thread = kzalloc(sizeof(struct md_thread), GFP_KERNEL);
>  	if (!thread)
>  		return NULL;
>  
> +	/*
> +	 *When raid takeovered,the mddev->pers was old,so the
> +	 *thread_name is wrong.
> +	 */
> +	if (name == NULL && mddev->level != mddev->new_level) {
> +		spin_lock(&pers_lock);
> +		list_for_each_entry(pers, &pers_list, list)
> +			if (pers->level == mddev->new_level) {
> +				name = pers->name;
> +				break;
> +			}
> +		spin_unlock(&pers_lock);
> +	}
>  	init_waitqueue_head(&thread->wqueue);
>  
>  	thread->run = run;

No, I really don't like that.  It is to focussed on fixing the particular
symptom rather that making the code generally cleaner.

Was there a reason you didn't just change the last arg of md_register_thread
to be the level name instead of NULL??

NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2012-06-05  5:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05  5:37 [PATCH V1] md:Fix name of raid thread when raid takeovered majianpeng
2012-06-05  5:48 ` NeilBrown [this message]
2012-06-05  6:06   ` majianpeng
2012-06-05  6:33     ` NeilBrown
2012-06-27  3:56     ` NeilBrown

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=20120605154851.0664f8fb@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=majianpeng@gmail.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).