linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "majianpeng" <majianpeng@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: [PATCH] md:Fix name of raid thread when raid takeovered
Date: Thu, 31 May 2012 15:41:22 +0800	[thread overview]
Message-ID: <201205311541185787676@gmail.com> (raw)

When raid takeovered, it used old personality to set task->comm.

Signed-off-by: majianpeng <majianpeng@gmail.com>
---
 drivers/md/md.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1c2f904..93e20ea 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -32,6 +32,7 @@
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include <linux/sched.h>
 #include <linux/kthread.h>
 #include <linux/blkdev.h>
 #include <linux/sysctl.h>
@@ -3513,6 +3514,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
 	long level;
 	void *priv;
 	struct md_rdev *rdev;
+	char *tmp;
 
 	if (mddev->pers == NULL) {
 		if (len == 0)
@@ -3674,6 +3676,19 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
 		del_timer_sync(&mddev->safemode_timer);
 	}
 	pers->run(mddev);
+	/*
+	 * when raid takeover using old personality,so mddev->thread->tsk
+	 * name is wrong.
+	 * if kzalloc error, only using wrong name.
+	 */
+	len = strlen(mdname(mddev)) + strlen(mddev->pers->name);
+	tmp = kzalloc(len + 2, GFP_KERNEL);
+	if (tmp) {
+		sprintf(tmp, "%s_%s", mdname(mddev), mddev->pers->name);
+		set_task_comm(mddev->thread->tsk, tmp);
+		kfree(tmp);
+	}
+
 	set_bit(MD_CHANGE_DEVS, &mddev->flags);
 	mddev_resume(mddev);
 	sysfs_notify(&mddev->kobj, NULL, "level");
-- 
1.7.5.4

 				
--------------
majianpeng
2012-05-31


             reply	other threads:[~2012-05-31  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31  7:41 majianpeng [this message]
2012-06-04  3:48 ` [PATCH] md:Fix name of raid thread when raid takeovered NeilBrown
2012-06-04  5:36   ` majianpeng
2012-06-04  7:10     ` 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=201205311541185787676@gmail.com \
    --to=majianpeng@gmail.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).