vhost: fix race for connection fd
authorHuawei Xie <huawei.xie@intel.com>
Tue, 30 Jun 2015 09:20:47 +0000 (17:20 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 30 Jun 2015 15:49:07 +0000 (17:49 +0200)
commit3670686ab99f00a1914492fa7c9a223bda325c27
tree7def1ca008ad470f52b2b8cd8e02e82a8a5c9c07
parent88211243e4d137f9f0db2e4d2a37eab6ade2bd2e
vhost: fix race for connection fd

In the event handler of connection fd, the connection fd could be possibly
closed. The event dispatch loop would then try to remove the fd from fdset.
Between these two actions, another thread might register a new listenfd
reusing the val of just closed fd, so we couldn't call fdset_del which would
wrongly clean up the new listenfd. A new function fdset_del_slot is provided
to cleanup the fd at the specified location.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
lib/librte_vhost/vhost_user/fd_man.c