On 3/26/2015 1:46 AM, Bart Van Assche wrote:
On 03/25/2015 02:19 PM, Somnath Kotur wrote:
+static void ib_device_complete_cb(struct kref *kref)
+{
+    struct ib_device *device = container_of(kref, struct ib_device,
+                        refcount);
+
+    if (device->reg_state >= IB_DEV_UNREGISTERING)
+        complete(&device->free);
+}

@@ -355,6 +393,9 @@ void ib_unregister_device(struct ib_device *device)

      ib_device_unregister_sysfs(device);

+    ib_device_put(device);
+    wait_for_completion(&device->free);

Why is it necessary here to wait until the last reference is gone ? Why
doesn't ib_device_complete_cb() free any memory ?


IMHO, ib_unregister_device should be a blocking call. The caller would like to be certain that any usage of the IB device is completed before it frees other resources/memory it allocated.

Bart.


Matan
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to