diff options
author | Vijay Bellur <vijay@gluster.com> | 2011-08-08 05:40:38 -0700 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-08-08 05:40:38 -0700 |
commit | 05e3dcc9b131145b9fb5283af361cf2ad79db8e5 (patch) | |
tree | 77a15a4cc050bbe1d1ea6dd7fe1d6f1ee182812f | |
parent | a279af40f11a437fabc5b59234e677282bea246b (diff) |
Revert "fuse: fix inode-leaks in fuse_lookup_and_resume codepath."v3.1.6qa7
This reverts commit b53d76e392f0b88a7d135f099fe52ae933050719.
-rw-r--r-- | xlators/mount/fuse/src/fuse-helpers.c | 7 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-resolve.c | 36 |
2 files changed, 12 insertions, 31 deletions
diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index a9f542455..1d06cfff1 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -68,15 +68,14 @@ fuse_resolve_wipe (fuse_resolve_t *resolve) comp = resolve->components; if (comp) { +/* int i = 0; for (i = 0; comp[i].basename; i++) { - if (comp[i].inode) { + if (comp[i].inode) inode_unref (comp[i].inode); - comp[i].inode = NULL; - } } - +*/ GF_FREE ((void *)resolve->components); } } diff --git a/xlators/mount/fuse/src/fuse-resolve.c b/xlators/mount/fuse/src/fuse-resolve.c index 289b857b6..952d46055 100644 --- a/xlators/mount/fuse/src/fuse-resolve.c +++ b/xlators/mount/fuse/src/fuse-resolve.c @@ -242,13 +242,15 @@ fuse_resolve_deep_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } if (i != 0) { + inode_ref (inode); /* no linking for root inode */ link_inode = inode_link (inode, resolve->deep_loc.parent, resolve->deep_loc.name, buf); - components[i].inode = link_inode; + components[i].inode = inode_ref (link_inode); link_inode = NULL; } - + inode_ref (resolve->deep_loc.parent); + inode_ref (inode); loc_wipe (&resolve->deep_loc); i++; /* next component */ @@ -294,6 +296,9 @@ fuse_resolve_path_deep (fuse_state_t *state) /* start from the root */ active_xl = fuse_active_subvol (state->this); + resolve->deep_loc.inode = inode_ref (active_xl->itable->root); + resolve->deep_loc.path = gf_strdup ("/"); + resolve->deep_loc.name = ""; for (i = 1; components[i].basename; i++) { *(components[i].basename - 1) = '/'; @@ -301,7 +306,7 @@ fuse_resolve_path_deep (fuse_state_t *state) components[i].basename); if (!inode) break; - components[i].inode = inode; + components[i].inode = inode_ref (inode); } if (!components[i].basename) @@ -365,18 +370,8 @@ fuse_resolve_path_simple (fuse_state_t *state) goto out; } - if (components[ino_idx].inode) { - if (state->loc_now->inode) { - inode_unref (state->loc_now->inode); - } - + if (components[ino_idx].inode) state->loc_now->inode = inode_ref (components[ino_idx].inode); - } - - if (state->loc_now->parent) { - inode_unref (state->loc_now->parent); - } - state->loc_now->parent = inode_ref (components[par_idx].inode); ret = 0; @@ -418,10 +413,6 @@ fuse_resolve_entry_simple (fuse_state_t *state) } /* expected @parent was found from the inode cache */ - if (state->loc_now->parent) { - inode_unref (state->loc_now->parent); - } - state->loc_now->parent = inode_ref (parent); inode = inode_grep (active_xl->itable, parent, resolve->bname); @@ -434,11 +425,6 @@ fuse_resolve_entry_simple (fuse_state_t *state) ret = 0; - if (state->loc_now->inode) { - inode_unref (state->loc_now->inode); - state->loc_now->inode = NULL; - } - state->loc_now->inode = inode_ref (inode); out: @@ -497,10 +483,6 @@ fuse_resolve_inode_simple (fuse_state_t *state) ret = 0; - if (state->loc_now->inode) { - inode_unref (state->loc_now->inode); - } - state->loc_now->inode = inode_ref (inode); out: |