|
@@ -352,7 +352,7 @@ static int ib_uverbs_event_close(struct inode *inode, struct file *filp)
|
|
struct ib_uverbs_event *entry, *tmp;
|
|
struct ib_uverbs_event *entry, *tmp;
|
|
|
|
|
|
spin_lock_irq(&file->lock);
|
|
spin_lock_irq(&file->lock);
|
|
- file->file = NULL;
|
|
|
|
|
|
+ file->is_closed = 1;
|
|
list_for_each_entry_safe(entry, tmp, &file->event_list, list) {
|
|
list_for_each_entry_safe(entry, tmp, &file->event_list, list) {
|
|
if (entry->counter)
|
|
if (entry->counter)
|
|
list_del(&entry->obj_list);
|
|
list_del(&entry->obj_list);
|
|
@@ -390,7 +390,7 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)
|
|
return;
|
|
return;
|
|
|
|
|
|
spin_lock_irqsave(&file->lock, flags);
|
|
spin_lock_irqsave(&file->lock, flags);
|
|
- if (!file->file) {
|
|
|
|
|
|
+ if (file->is_closed) {
|
|
spin_unlock_irqrestore(&file->lock, flags);
|
|
spin_unlock_irqrestore(&file->lock, flags);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -423,7 +423,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file,
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
spin_lock_irqsave(&file->async_file->lock, flags);
|
|
spin_lock_irqsave(&file->async_file->lock, flags);
|
|
- if (!file->async_file->file) {
|
|
|
|
|
|
+ if (!file->async_file->is_closed) {
|
|
spin_unlock_irqrestore(&file->async_file->lock, flags);
|
|
spin_unlock_irqrestore(&file->async_file->lock, flags);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -509,6 +509,7 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
|
|
ev_file->uverbs_file = uverbs_file;
|
|
ev_file->uverbs_file = uverbs_file;
|
|
ev_file->async_queue = NULL;
|
|
ev_file->async_queue = NULL;
|
|
ev_file->is_async = is_async;
|
|
ev_file->is_async = is_async;
|
|
|
|
+ ev_file->is_closed = 0;
|
|
|
|
|
|
*fd = get_unused_fd();
|
|
*fd = get_unused_fd();
|
|
if (*fd < 0) {
|
|
if (*fd < 0) {
|
|
@@ -522,8 +523,6 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
|
|
goto err_fd;
|
|
goto err_fd;
|
|
}
|
|
}
|
|
|
|
|
|
- ev_file->file = filp;
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* fops_get() can't fail here, because we're coming from a
|
|
* fops_get() can't fail here, because we're coming from a
|
|
* system call on a uverbs file, which will already have a
|
|
* system call on a uverbs file, which will already have a
|