From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH] vhost-net: defer f->private_data until setup succeeds Date: Thu, 24 Dec 2009 08:06:50 +0200 Message-ID: <20091224060650.GA26128@redhat.com> References: <20091222190228.GB2095@sequoia.sous-sol.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: rusty@rustcorp.com.au, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org To: Chris Wright Return-path: Received: from mx1.redhat.com ([209.132.183.28]:14682 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753446AbZLXGJv (ORCPT ); Thu, 24 Dec 2009 01:09:51 -0500 Content-Disposition: inline In-Reply-To: <20091222190228.GB2095@sequoia.sous-sol.org> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Dec 22, 2009 at 11:02:28AM -0800, Chris Wright wrote: > Trivial change, just for readability. The filp is not installed on > failure, so the current code is not incorrect (also vhost_dev_init > currently has no failure case). This just treats setting f->private_data > as something with global scope (sure, true only after fd_install). > > Signed-off-by: Chris Wright Acked-by: Michael S. Tsirkin > --- > drivers/vhost/net.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index 22d5fef..0697ab2 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -326,7 +326,6 @@ static int vhost_net_open(struct inode *inode, struct file *f) > int r; > if (!n) > return -ENOMEM; > - f->private_data = n; > n->vqs[VHOST_NET_VQ_TX].handle_kick = handle_tx_kick; > n->vqs[VHOST_NET_VQ_RX].handle_kick = handle_rx_kick; > r = vhost_dev_init(&n->dev, n->vqs, VHOST_NET_VQ_MAX); > @@ -338,6 +337,9 @@ static int vhost_net_open(struct inode *inode, struct file *f) > vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT); > vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN); > n->tx_poll_state = VHOST_NET_POLL_DISABLED; > + > + f->private_data = n; > + > return 0; > } >