Re: [PATCH 1/7] block: drop the duplicate check in elv_register

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

 



On 10/30/22 4:07 AM, Christoph Hellwig wrote:
> We have less than a handful of elevators, and if someone adds a duplicate
> one it simply will never be found but other be harmless.

That isn't quite parseable...

> diff --git a/block/elevator.c b/block/elevator.c
> index d26aa787e29f0..ef9af17293ffb 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -545,13 +545,7 @@ int elv_register(struct elevator_type *e)
>  			return -ENOMEM;
>  	}
>  
> -	/* register, don't allow duplicate names */
>  	spin_lock(&elv_list_lock);
> -	if (elevator_find(e->elevator_name, 0)) {
> -		spin_unlock(&elv_list_lock);
> -		kmem_cache_destroy(e->icq_cache);
> -		return -EBUSY;
> -	}
>  	list_add_tail(&e->list, &elv_list);
>  	spin_unlock(&elv_list_lock);

What's the idea behind this? Yes it'll be harmless and list ordering
will dictate which one will be found, leaving the other(s) dead, but why
not catch this upfront? I agree likelihood of this ever happening to be
tiny, but seems like a good idea to catch and return BUSY for this case.

-- 
Jens Axboe



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux