From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44554 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyqYx-0006ru-JL for qemu-devel@nongnu.org; Sun, 13 Mar 2011 15:02:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PyqYw-0001HM-Fb for qemu-devel@nongnu.org; Sun, 13 Mar 2011 15:02:47 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:33984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PyqYv-0001H3-O8 for qemu-devel@nongnu.org; Sun, 13 Mar 2011 15:02:46 -0400 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp02.in.ibm.com (8.14.4/8.13.1) with ESMTP id p2DJ2hhe016221 for ; Mon, 14 Mar 2011 00:32:43 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2DJ2gZg4321370 for ; Mon, 14 Mar 2011 00:32:42 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2DJ2gJ4001030 for ; Mon, 14 Mar 2011 06:02:42 +1100 From: "Aneesh Kumar K. V" Subject: Re: [Qemu-devel] [PATCH -V3 6/8] hw/9pfs: Add directory reclaim support In-Reply-To: References: <1299347533-17047-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1299347533-17047-6-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Date: Mon, 14 Mar 2011 00:32:40 +0530 Message-ID: <871v2arghb.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Sun, 13 Mar 2011 16:42:56 +0000, Stefan Hajnoczi wr= ote: > On Sat, Mar 5, 2011 at 5:52 PM, Aneesh Kumar K.V > wrote: > > Signed-off-by: Aneesh Kumar K.V > > --- > > =C2=A0hw/9pfs/virtio-9p.c | =C2=A0 21 +++++++++++++++++++-- > > =C2=A01 files changed, 19 insertions(+), 2 deletions(-) > > > > diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c > > index 1fa7256..293a562 100644 > > --- a/hw/9pfs/virtio-9p.c > > +++ b/hw/9pfs/virtio-9p.c > > @@ -142,7 +142,12 @@ static int v9fs_do_open(V9fsState *s, V9fsString *= path, int flags) > > > > =C2=A0static DIR *v9fs_do_opendir(V9fsState *s, V9fsString *path) > > =C2=A0{ > > - =C2=A0 =C2=A0return s->ops->opendir(&s->ctx, path->data); > > + =C2=A0 =C2=A0DIR *dir; > > + =C2=A0 =C2=A0dir =3D s->ops->opendir(&s->ctx, path->data); > > + =C2=A0 =C2=A0if (dirfd(dir) > P9_FD_RECLAIM_THRES) { > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0v9fs_reclaim_fd(s); > > + =C2=A0 =C2=A0} >=20 > dirfd(NULL) will crash so we need to check !dir first: >=20 Will add the check -aneesh