From e1422d796fefd6a3ae599507e71efdb922eede02 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 31 Aug 2010 06:50:27 +0000 Subject: nfs3: Dont ref dir fd_t used in hard fh resolution ..because the extra ref was under the mistaken assumption that directory fd_t will be cached even during hard fh resolution and that is not the case. Signed-off-by: Shehjar Tikoo Signed-off-by: Vijay Bellur BUG: 1397 (Cached dir fd_ts are a leakin') URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1397 --- xlators/nfs/server/src/nfs3-helpers.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'xlators/nfs/server/src/nfs3-helpers.c') diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 116d145033a..dae2d6a61fc 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -2704,14 +2704,16 @@ nfs3_fh_resolve_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, cs->resolvedloc.path); nfs_user_root_create (&nfu); - /* This function can be called in a recursive code path, so if another - * directory was opened in an earlier call, we must unref through this - * reference before opening another fd_t. + /* Keep this directory fd_t around till we have either: + * a. found the entry, + * b. exhausted all the entries, + * c. decide to step into a child directory. + * + * This decision is made in nfs3_fh_resolve_check_response. */ - if (cs->resolve_dir_fd) - fd_unref (cs->resolve_dir_fd); - - cs->resolve_dir_fd = fd_ref (fd); + cs->resolve_dir_fd = fd; + gf_log (GF_NFS3, GF_LOG_TRACE, "resolve new fd refed: 0x%lx, ref: %d", + (long)cs->resolve_dir_fd, cs->resolve_dir_fd->refcount); ret = nfs_readdirp (cs->nfsx, cs->vol, &nfu, fd, GF_NFS3_DTPREF, 0, nfs3_fh_resolve_readdir_cbk, cs); -- cgit