…Do you think the nbd->config_lock mutex here is useless?
+++ b/drivers/block/nbd.cCan an other function call order become relevant for the unlocking of these mutexes?
@@ -2011,12 +2011,20 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
index);
return -EINVAL;
}
+ mutex_lock(&nbd->config_lock);
if (!refcount_inc_not_zero(&nbd->refs)) {
mutex_unlock(&nbd_index_mutex);
+ mutex_unlock(&nbd->config_lock);
Sure.
printk(KERN_ERR "nbd: device at index %d is going down\n",May such an error message be moved into the lock scope?
index);
OK, I will improve it in V2 patch.
return -EINVAL;How do you think about to connect the code from this if branch
}
+ if (!nbd->recv_workq) {
+ mutex_unlock(&nbd->config_lock);
+ mutex_unlock(&nbd_index_mutex);
+ return -EINVAL;
+ }
with a jump target like “unlock” so that such statements would be shareable
for the desired exception handling?
+ mutex_unlock(&nbd->config_lock);
mutex_unlock(&nbd_index_mutex);
if (!refcount_inc_not_zero(&nbd->config_refs)) {
nbd_put(nbd);
Regards,
Markus
.