Skip to content

handle polling errors in vhost/vhost_net

Jason Wang lkml netdev 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest3 patches 4 repliesIn review
  2. v63 patches 8 repliesSuperseded
  3. v53 patches 4 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v43 patches2 repliesSuperseded
v32 patches10 repliesSuperseded
v23 patches2 repliesSuperseded
v12 patches7 repliesSuperseded

Changes in v7 from the cover letter

- don't use RCU to protect the tfile->detached.

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vhost_net: correct error handling in vhost_net_set_backend()drivers/vhost/net.c+11 -50 replies
2/3vhost_net: handle polling errors when setting backenddrivers/vhost/net.c drivers/vhost/vhost.c drivers/vhost/vhost.h+34 -131 reply
3/3tuntap: allow polling/writing/reading when detacheddrivers/net/tun.c+16 -91 reply

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchMichael S. TsirkinWanlong Gao
SeriesT-b
1/3
2/3A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH V7 0/3] handle polling errors in vhost/vhost_net

This is an update version of last version to fix the handling of polling errors in vhost/vhost_net.

Currently, vhost and vhost_net ignore polling errors which can lead kernel crashing when it tries to remove itself from waitqueue after the polling failure. Fix this by:

- examing the POLLERR when setting backend and report erros to userspace
- let tun always add to waitqueue in .poll() after the queue is created even if it was detached.

Changes from V6:
- don't use RCU to protect the tfile->detached.

Changes from V5:
- use rcu_dereference() instead of the wrong rtnl_dereference() in data path
- test with CONFIG_PROVE_RCU

Changes from V4:
- check the detached state by tfile->detached and protect it by RCU

Changes from V3:
- make a smaller patch that doesn't touch the whole polling state and only check the polliner errors in backend setting.
- add a patch that allows tuntap to do polling/reading/writing when detached which could simplify the work of its user.

Changes from v2:
- check poll->wqh instead of the wrong assumption about POLLERR and waitqueue
- drop the whole tx polling state check since it was replaced by the wqh checking
- drop the buggy tuntap patch

Changes from v1:
- restore the state before the ioctl when vhost_init_used() fails
- log the error when meet polling errors in the data path
- don't put into waitqueue when tun_chr_poll() return POLLERR

Jason Wang (3):
vhost_net: correct error handling in vhost_net_set_backend()
vhost_net: handle polling errors when setting backend
tuntap: allow polling/writing/reading when detached

 drivers/net/tun.c     |   25 ++++++++++++++++---------
 drivers/vhost/net.c   |   41 ++++++++++++++++++++++++++++-------------
 drivers/vhost/vhost.c |   18 +++++++++++++++---
 drivers/vhost/vhost.h |    2 +-
 4 files changed, 60 insertions(+), 26 deletions(-)