From: Yuanhan Liu <yliu@fridaylinux.org>
To: Bing Zhao <ilovethull@163.com>
Cc: dev@dpdk.org, bing.zhao@hxt-semitech.com
Subject: Re: [dpdk-dev] [PATCH] reset src fd field to -1 in fdset_move of vhost
Date: Fri, 19 Jan 2018 22:37:29 +0800 [thread overview]
Message-ID: <20180119143729.GP29540@yliu-mob> (raw)
In-Reply-To: <20171221091540.8624-1-ilovethull@163.com>
On Thu, Dec 21, 2017 at 05:15:40PM +0800, Bing Zhao wrote:
> In the fdset_move, after copying the fd&rwfds from the src to the dst, the fd should be set to -1. Or else in some cases, there will be a fault missing. E.g:
> Before: 1 -1 3 4 -1 6 7 -1 9 10
> After: 1 10 3 4 9 6 7 -1 9 10
> Then the index7 will be returned correctly for the first time, but if another fd is to be added, it will fail.
Hi,
Have you met a real issue? I'm a bit doubt about that, since the fd array
is also guarded by "pfdset->num", which makes sure we will not access
those invalid entries (i.e. the last 2 entries in above example).
--yliu
> Signed-off-by: Bing Zhao <bing.zhao@hxt-semitech.com>
> ---
> lib/librte_vhost/fd_man.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c
> index 4c6fed418..48594dd7f 100644
> --- a/lib/librte_vhost/fd_man.c
> +++ b/lib/librte_vhost/fd_man.c
> @@ -63,6 +63,7 @@ fdset_move(struct fdset *pfdset, int dst, int src)
> {
> pfdset->fd[dst] = pfdset->fd[src];
> pfdset->rwfds[dst] = pfdset->rwfds[src];
> + pfdset->fd[src].fd = -1;
> }
>
> static void
> --
> 2.11.0.windows.1
>
next prev parent reply other threads:[~2018-01-19 14:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 9:15 Bing Zhao
2018-01-19 14:37 ` Yuanhan Liu [this message]
2018-01-22 7:52 ` Zhao, Bing
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=20180119143729.GP29540@yliu-mob \
--to=yliu@fridaylinux.org \
--cc=bing.zhao@hxt-semitech.com \
--cc=dev@dpdk.org \
--cc=ilovethull@163.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).