All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>, Shay Drory <shayd@nvidia.com>,
	<linux-rdma@vger.kernel.org>
Subject: Re: [PATCH rdma-rc 3/5] IB/umad: Return EPOLLERR in case of when device disassociated
Date: Tue, 12 Jan 2021 15:25:24 -0400	[thread overview]
Message-ID: <20210112192524.GA17254@nvidia.com> (raw)
In-Reply-To: <20201213132940.345554-4-leon@kernel.org>

On Sun, Dec 13, 2020 at 03:29:38PM +0200, Leon Romanovsky wrote:
> 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.

Grammar:

    Currently, polling a umad device will always work, even if the device was
    disassociated. A disassociated device should immediately return EPOLLERR
    from poll() and EIO from any read()/write(). Otherwise userspace is
    endlessly hung on poll() with no idea that the device has been removed
    from the system.
    

> 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
> +++ 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;

This also needs to trigger the recv_wait when agents_dead is set in
ib_umad_kill_port()

Jason

  reply	other threads:[~2021-01-12 19:26 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 ` [PATCH rdma-rc 3/5] IB/umad: Return EPOLLERR " Leon Romanovsky
2021-01-12 19:25   ` Jason Gunthorpe [this message]
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=20210112192524.GA17254@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.