[<prev] [next>] [day] [month] [year] [list]
Message-ID: <3cf9d371-50e4-76a0-4024-64eca22befdf@i-love.sakura.ne.jp>
Date: Tue, 17 Aug 2021 19:18:09 +0900
From: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To: Hillf Danton <hdanton@...a.com>
Cc: Christoph Hellwig <hch@....de>,
Greg KH <gregkh@...uxfoundation.org>,
Desmond Cheong Zhi Xi <desmondcheongzx@...il.com>,
linux-kernel@...r.kernel.org,
linux-block <linux-block@...r.kernel.org>
Subject: Re: [PATCH v3] block: genhd: don't call probe function with
major_names_lock held
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.
Powered by blists - more mailing lists