aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/ucm.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index ee51d79a7ad5..2586a3ee8eba 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -407,29 +407,18 @@ static ssize_t ib_ucm_event(struct ib_ucm_file *file,
407 407
408 mutex_lock(&file->file_mutex); 408 mutex_lock(&file->file_mutex);
409 while (list_empty(&file->events)) { 409 while (list_empty(&file->events)) {
410 mutex_unlock(&file->file_mutex);
410 411
411 if (file->filp->f_flags & O_NONBLOCK) { 412 if (file->filp->f_flags & O_NONBLOCK)
412 result = -EAGAIN; 413 return -EAGAIN;
413 break;
414 }
415 414
416 if (signal_pending(current)) { 415 if (wait_event_interruptible(file->poll_wait,
417 result = -ERESTARTSYS; 416 !list_empty(&file->events)))
418 break; 417 return -ERESTARTSYS;
419 }
420 418
421 prepare_to_wait(&file->poll_wait, &wait, TASK_INTERRUPTIBLE);
422
423 mutex_unlock(&file->file_mutex);
424 schedule();
425 mutex_lock(&file->file_mutex); 419 mutex_lock(&file->file_mutex);
426
427 finish_wait(&file->poll_wait, &wait);
428 } 420 }
429 421
430 if (result)
431 goto done;
432
433 uevent = list_entry(file->events.next, struct ib_ucm_event, file_list); 422 uevent = list_entry(file->events.next, struct ib_ucm_event, file_list);
434 423
435 if (ib_ucm_new_cm_id(uevent->resp.event)) { 424 if (ib_ucm_new_cm_id(uevent->resp.event)) {