Revert "tap: setting error appropriately when calling net_init_tap_one()"
commitd9b33018a0da51eddceb48c42345cfb351065f3e
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Thu, 21 Sep 2023 09:37:59 +0000 (21 18:37 +0900)
committerJason Wang <jasowang@redhat.com>
Fri, 29 Mar 2024 06:59:07 +0000 (29 14:59 +0800)
treee463c58b4efea233d5017d6f75a2831377cf57ac
parentdecfde6b0e56d3872ec1a5acfafd30c0886fb847
Revert "tap: setting error appropriately when calling net_init_tap_one()"

This reverts commit 46d4d36d0bf2b24b205f2f604f0905db80264eef.

The reverted commit changed to emit warnings instead of errors when
vhost is requested but vhost initialization fails if vhostforce option
is not set.

However, vhostforce is not meant to ignore vhost errors. It was once
introduced as an option to commit 5430a28fe4 ("vhost: force vhost off
for non-MSI guests") to force enabling vhost for non-MSI guests, which
will have worse performance with vhost. The option was deprecated with
commit 1e7398a140 ("vhost: enable vhost without without MSI-X") and
changed to behave identical with the vhost option for compatibility.

Worse, commit bf769f742c ("virtio: del net client if net_init_tap_one
failed") changed to delete the client when vhost fails even when the
failure only results in a warning. The leads to an assertion failure
for the -netdev command line option.

The reverted commit was intended to avoid that the vhost initialization
failure won't result in a corrupted netdev. This problem should have
been fixed by deleting netdev when the initialization fails instead of
ignoring the failure with an arbitrary option. Fortunately, commit
bf769f742c ("virtio: del net client if net_init_tap_one failed"),
mentioned earlier, implements this behavior.

Restore the correct semantics and fix the assertion failure for the
-netdev command line option by reverting the problematic commit.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
include/net/vhost_net.h
net/tap.c