Re: Re: [PATCH V1] md:Fix name of raid thread when raid takeovered.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On  Mon, 4 Jun 2012 22:49:02 -0700, neil wrote:
>On Tue, 5 Jun 2012 13:37:15 +0800 majianpeng <majianpeng@xxxxxxxxx> 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@xxxxxxxxx>
>> ---
>>  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??
>
No.I first wanted to corrected in which call md_register_thread.But I found it will take some codes.
So i think corrected this function may better.
>NeilBrown
>
>


--------------
majianpeng?韬{.n?????%??檩??w?{.n???{炳盯w???塄}?财??j:+v??????2??璀??摺?囤??z夸z罐?+?????w棹f



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux