On Sun, 13 Mar 2011 16:42:56 +0000, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Sat, Mar 5, 2011 at 5:52 PM, Aneesh Kumar K.V > <aneesh.ku...@linux.vnet.ibm.com> wrote: > > Signed-off-by: Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com> > > --- > > hw/9pfs/virtio-9p.c | 21 +++++++++++++++++++-- > > 1 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) > > > > static DIR *v9fs_do_opendir(V9fsState *s, V9fsString *path) > > { > > - return s->ops->opendir(&s->ctx, path->data); > > + DIR *dir; > > + dir = s->ops->opendir(&s->ctx, path->data); > > + if (dirfd(dir) > P9_FD_RECLAIM_THRES) { > > + v9fs_reclaim_fd(s); > > + } > > dirfd(NULL) will crash so we need to check !dir first: >
Will add the check -aneesh