linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1] md:Fix name of raid thread when raid takeovered.
@ 2012-06-05  5:37 majianpeng
  2012-06-05  5:48 ` NeilBrown
  0 siblings, 1 reply; 5+ messages in thread
From: majianpeng @ 2012-06-05  5:37 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid

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;
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-27  3:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-05  5:37 [PATCH V1] md:Fix name of raid thread when raid takeovered majianpeng
2012-06-05  5:48 ` NeilBrown
2012-06-05  6:06   ` majianpeng
2012-06-05  6:33     ` NeilBrown
2012-06-27  3:56     ` NeilBrown

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).