diff options
-rw-r--r-- | drivers/infiniband/core/uverbs.h | 4 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 9 |
2 files changed, 6 insertions, 7 deletions
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index c75eb6c9bd49..2cad8b4b5292 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h | |||
@@ -81,13 +81,13 @@ struct ib_uverbs_device { | |||
81 | 81 | ||
82 | struct ib_uverbs_event_file { | 82 | struct ib_uverbs_event_file { |
83 | struct kref ref; | 83 | struct kref ref; |
84 | struct file *file; | ||
85 | struct ib_uverbs_file *uverbs_file; | 84 | struct ib_uverbs_file *uverbs_file; |
86 | spinlock_t lock; | 85 | spinlock_t lock; |
87 | int is_async; | ||
88 | wait_queue_head_t poll_wait; | 86 | wait_queue_head_t poll_wait; |
89 | struct fasync_struct *async_queue; | 87 | struct fasync_struct *async_queue; |
90 | struct list_head event_list; | 88 | struct list_head event_list; |
89 | int is_async; | ||
90 | int is_closed; | ||
91 | }; | 91 | }; |
92 | 92 | ||
93 | struct ib_uverbs_file { | 93 | struct ib_uverbs_file { |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 7c2ac3905582..63335da42744 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -352,7 +352,7 @@ static int ib_uverbs_event_close(struct inode *inode, struct file *filp) | |||
352 | struct ib_uverbs_event *entry, *tmp; | 352 | struct ib_uverbs_event *entry, *tmp; |
353 | 353 | ||
354 | spin_lock_irq(&file->lock); | 354 | spin_lock_irq(&file->lock); |
355 | file->file = NULL; | 355 | file->is_closed = 1; |
356 | list_for_each_entry_safe(entry, tmp, &file->event_list, list) { | 356 | list_for_each_entry_safe(entry, tmp, &file->event_list, list) { |
357 | if (entry->counter) | 357 | if (entry->counter) |
358 | list_del(&entry->obj_list); | 358 | list_del(&entry->obj_list); |
@@ -390,7 +390,7 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) | |||
390 | return; | 390 | return; |
391 | 391 | ||
392 | spin_lock_irqsave(&file->lock, flags); | 392 | spin_lock_irqsave(&file->lock, flags); |
393 | if (!file->file) { | 393 | if (file->is_closed) { |
394 | spin_unlock_irqrestore(&file->lock, flags); | 394 | spin_unlock_irqrestore(&file->lock, flags); |
395 | return; | 395 | return; |
396 | } | 396 | } |
@@ -423,7 +423,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file, | |||
423 | unsigned long flags; | 423 | unsigned long flags; |
424 | 424 | ||
425 | spin_lock_irqsave(&file->async_file->lock, flags); | 425 | spin_lock_irqsave(&file->async_file->lock, flags); |
426 | if (!file->async_file->file) { | 426 | if (!file->async_file->is_closed) { |
427 | spin_unlock_irqrestore(&file->async_file->lock, flags); | 427 | spin_unlock_irqrestore(&file->async_file->lock, flags); |
428 | return; | 428 | return; |
429 | } | 429 | } |
@@ -509,6 +509,7 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file, | |||
509 | ev_file->uverbs_file = uverbs_file; | 509 | ev_file->uverbs_file = uverbs_file; |
510 | ev_file->async_queue = NULL; | 510 | ev_file->async_queue = NULL; |
511 | ev_file->is_async = is_async; | 511 | ev_file->is_async = is_async; |
512 | ev_file->is_closed = 0; | ||
512 | 513 | ||
513 | *fd = get_unused_fd(); | 514 | *fd = get_unused_fd(); |
514 | if (*fd < 0) { | 515 | if (*fd < 0) { |
@@ -522,8 +523,6 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file, | |||
522 | goto err_fd; | 523 | goto err_fd; |
523 | } | 524 | } |
524 | 525 | ||
525 | ev_file->file = filp; | ||
526 | |||
527 | /* | 526 | /* |
528 | * fops_get() can't fail here, because we're coming from a | 527 | * fops_get() can't fail here, because we're coming from a |
529 | * system call on a uverbs file, which will already have a | 528 | * system call on a uverbs file, which will already have a |