aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-06-28 16:11:49 +0000
committerRoland Dreier <rolandd@cisco.com>2006-11-09 11:35:56 -0800
commitb58c5ac0b7d0f2dfbcf3ecff76ac18829e993102 (patch)
tree27b818207cb2f57a8ae9b3b4d1ee493eae78fa4a
parent797b990884e2a695111c4f5f6bd4aa0f9e67e5eb (diff)
downloadlibibverbs-b58c5ac0b7d0f2dfbcf3ecff76ac18829e993102.tar.gz
Free context before closing associated file descriptors
Free context before closing associated file descriptors. This can avoid some problems acquiring mmap_sem when there is still memory to be released by the kernel. Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--src/device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c
index be16ea8..120507a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -118,13 +118,13 @@ int ibv_close_device(struct ibv_context *context)
{
int i;
+ context->device->ops.free_context(context);
+
close(context->async_fd);
for (i = 0; i < context->num_comp; ++i)
close(context->cq_fd[i]);
close(context->cmd_fd);
- context->device->ops.free_context(context);
-
return 0;
}