diff options
-rw-r--r-- | drivers/vhost/net.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index cd36f5ff2255..0868569d7124 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -519,13 +519,12 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) | |||
519 | 519 | ||
520 | /* start polling new socket */ | 520 | /* start polling new socket */ |
521 | oldsock = vq->private_data; | 521 | oldsock = vq->private_data; |
522 | if (sock == oldsock) | 522 | if (sock != oldsock){ |
523 | goto done; | 523 | vhost_net_disable_vq(n, vq); |
524 | rcu_assign_pointer(vq->private_data, sock); | ||
525 | vhost_net_enable_vq(n, vq); | ||
526 | } | ||
524 | 527 | ||
525 | vhost_net_disable_vq(n, vq); | ||
526 | rcu_assign_pointer(vq->private_data, sock); | ||
527 | vhost_net_enable_vq(n, vq); | ||
528 | done: | ||
529 | if (oldsock) { | 528 | if (oldsock) { |
530 | vhost_net_flush_vq(n, index); | 529 | vhost_net_flush_vq(n, index); |
531 | fput(oldsock->file); | 530 | fput(oldsock->file); |