On 2019/10/10 21:56, Josef Bacik wrote:
On Thu, Sep 19, 2019 at 11:44:27AM +0530, xiubli@xxxxxxxxxx wrote:
From: Xiubo Li <xiubli@xxxxxxxxxx>
1. nbd_put takes the mutex and drops nbd->ref to 0. It then does
idr_remove and drops the mutex.
2. nbd_genl_connect takes the mutex. idr_find/idr_for_each fails
to find an existing device, so it does nbd_dev_add.
3. just before the nbd_put could call nbd_dev_remove or not finished
totally, but if nbd_dev_add try to add_disk, we can hit:
debugfs: Directory 'nbd1' with parent 'block' already present!
This patch will make sure all the disk add/remove stuff are done
by holding the nbd_index_mutex lock.
Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
Reported-by: Mike Christie <mchristi@xxxxxxxxxx>
Sorry, don't know how I missed this.
Many thanks.
Xiubo
Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
Thanks,
Josef