Re: [PATCH v3] block: genhd: don't call probe function with major_names_lock held

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

 



On 2021/08/17 17:10, Hillf Danton wrote:
> See if it is safe to kfree(lo) after removing it from idr, with the
> deadlock dissolved.

It is not safe to call loop_remove() after idr_remove(). Please see HIDDEN_LOOP_DEVICE magic
in "[PATCH] loop: break loop_ctl_mutex into loop_idr_spinlock and loop_removal_mutex".

> 
> --- x/drivers/block/loop.c
> +++ y/drivers/block/loop.c
> @@ -2459,7 +2459,9 @@ static int loop_control_remove(int idx)
>  	mutex_unlock(&lo->lo_mutex);
>  
>  	idr_remove(&loop_index_idr, lo->lo_number);
> +	mutex_unlock(&loop_ctl_mutex);
>  	loop_remove(lo);
> +	return 0;
>  out_unlock_ctrl:
>  	mutex_unlock(&loop_ctl_mutex);
>  	return ret;
> --
> 

"[PATCH] loop: break loop_ctl_mutex into loop_idr_spinlock and loop_removal_mutex" can be a further
improvement after "[PATCH v3] block: genhd: don't call probe function with major_names_lock held".

I really would like to apply "[PATCH v3] block: genhd: don't call probe function with major_names_lock held" first.



[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