From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Shay Drory <shayd@nvidia.com>, linux-rdma@vger.kernel.org
Subject: [PATCH rdma-rc 3/5] IB/umad: Return EPOLLERR in case of when device disassociated
Date: Sun, 13 Dec 2020 15:29:38 +0200 [thread overview]
Message-ID: <20201213132940.345554-4-leon@kernel.org> (raw)
In-Reply-To: <20201213132940.345554-1-leon@kernel.org>
From: Shay Drory <shayd@nvidia.com>
Currently, polling a umad device will always works, even if the device
was disassociated. Hence, returning EPOLLERR if device was
disassociated.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/core/user_mad.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index b671d4aede77..6681e9cf8a18 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -653,10 +653,14 @@ static __poll_t ib_umad_poll(struct file *filp, struct poll_table_struct *wait)
/* we will always be able to post a MAD send */
__poll_t mask = EPOLLOUT | EPOLLWRNORM;
+ mutex_lock(&file->mutex);
poll_wait(filp, &file->recv_wait, wait);
if (!list_empty(&file->recv_list))
mask |= EPOLLIN | EPOLLRDNORM;
+ if (file->agents_dead)
+ mask = EPOLLERR;
+ mutex_unlock(&file->mutex);
return mask;
}
--
2.29.2
next prev parent reply other threads:[~2020-12-13 13:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-13 13:29 [PATCH rdma-rc 0/5] Fixes to v5.10 Leon Romanovsky
2020-12-13 13:29 ` [PATCH rdma-rc 1/5] RDMA/mlx5: Fix MR cache memory leak Leon Romanovsky
2020-12-13 13:29 ` [PATCH rdma-rc 2/5] IB/umad: Return EIO in case of when device disassociated Leon Romanovsky
2020-12-13 13:29 ` Leon Romanovsky [this message]
2021-01-12 19:25 ` [PATCH rdma-rc 3/5] IB/umad: Return EPOLLERR " Jason Gunthorpe
2020-12-13 13:29 ` [PATCH rdma-rc 4/5] RDMA/cma: Don't overwrite sgid_attr after device is released Leon Romanovsky
2020-12-14 19:26 ` Jason Gunthorpe
2020-12-15 5:23 ` Leon Romanovsky
2020-12-13 13:29 ` [PATCH rdma-rc 5/5] RDMA/ucma: Fix memory leak of connection request Leon Romanovsky
2020-12-14 15:34 ` Jason Gunthorpe
2020-12-14 19:27 ` [PATCH rdma-rc 0/5] Fixes to v5.10 Jason Gunthorpe
2020-12-15 5:25 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201213132940.345554-4-leon@kernel.org \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=shayd@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).