diff options
Diffstat (limited to 'xlators/mount')
-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 a9f542455f7..1d06cfff1cc 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 289b857b651..952d46055d3 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: |