diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index bc2fa4e85f0cac87a7949a3b472ff2f35504dced..d4451959456189c037977f0504f01c516fb0fd41 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -228,8 +228,8 @@ static void nbd_put(struct nbd_device *nbd) if (refcount_dec_and_mutex_lock(&nbd->refs, &nbd_index_mutex)) { idr_remove(&nbd_index_idr, nbd->index); - mutex_unlock(&nbd_index_mutex); nbd_dev_remove(nbd); + mutex_unlock(&nbd_index_mutex); } }