diff options
Diffstat (limited to 'xlators/mount/fuse/src/fuse-resolve.c')
| -rw-r--r-- | xlators/mount/fuse/src/fuse-resolve.c | 701 |
1 files changed, 422 insertions, 279 deletions
diff --git a/xlators/mount/fuse/src/fuse-resolve.c b/xlators/mount/fuse/src/fuse-resolve.c index 755e2f429..8565ce0e4 100644 --- a/xlators/mount/fuse/src/fuse-resolve.c +++ b/xlators/mount/fuse/src/fuse-resolve.c @@ -1,22 +1,12 @@ /* - Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com> - This file is part of GlusterFS. - - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. -*/ + Copyright (c) 2010-2012 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ #ifndef _CONFIG_H #define _CONFIG_H #include "config.h" @@ -30,7 +20,13 @@ fuse_resolve_all (fuse_state_t *state); int fuse_resolve_continue (fuse_state_t *state); int fuse_resolve_entry_simple (fuse_state_t *state); int fuse_resolve_inode_simple (fuse_state_t *state); +int fuse_migrate_fd (xlator_t *this, fd_t *fd, xlator_t *old_subvol, + xlator_t *new_subvol); +fuse_fd_ctx_t * +fuse_fd_ctx_get (xlator_t *this, fd_t *fd); + +gf_boolean_t fuse_inode_needs_lookup (inode_t *inode, xlator_t *this); static int fuse_resolve_loc_touchup (fuse_state_t *state) @@ -46,8 +42,11 @@ fuse_resolve_loc_touchup (fuse_state_t *state) if (!loc->path) { if (loc->parent && resolve->bname) { ret = inode_path (loc->parent, resolve->bname, &path); + uuid_copy (loc->pargfid, loc->parent->gfid); + loc->name = resolve->bname; } else if (loc->inode) { ret = inode_path (loc->inode, NULL, &path); + uuid_copy (loc->gfid, loc->inode->gfid); } if (ret) gf_log (THIS->name, GF_LOG_TRACE, @@ -60,10 +59,10 @@ fuse_resolve_loc_touchup (fuse_state_t *state) int -fuse_resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, - struct iatt *buf, dict_t *xattr, - struct iatt *postparent) +fuse_resolve_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, inode_t *inode, + struct iatt *buf, dict_t *xattr, + struct iatt *postparent) { fuse_state_t *state = NULL; fuse_resolve_t *resolve = NULL; @@ -77,23 +76,20 @@ fuse_resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, STACK_DESTROY (frame->root); if (op_ret == -1) { - gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG : - GF_LOG_WARNING), + gf_log (this->name, (op_errno == ENOENT) + ? GF_LOG_DEBUG : GF_LOG_WARNING, "%s/%s: failed to resolve (%s)", uuid_utoa (resolve_loc->pargfid), resolve_loc->name, strerror (op_errno)); + resolve->op_ret = -1; + resolve->op_errno = op_errno; goto out; } link_inode = inode_link (inode, resolve_loc->parent, resolve_loc->name, buf); - if (!link_inode) - goto out; - - inode_lookup (link_inode); - - inode_unref (link_inode); + state->loc_now->inode = link_inode; out: loc_wipe (resolve_loc); @@ -104,55 +100,85 @@ out: int +fuse_resolve_entry (fuse_state_t *state) +{ + fuse_resolve_t *resolve = NULL; + loc_t *resolve_loc = NULL; + + resolve = state->resolve_now; + resolve_loc = &resolve->resolve_loc; + + resolve_loc->parent = inode_ref (state->loc_now->parent); + uuid_copy (resolve_loc->pargfid, state->loc_now->pargfid); + resolve_loc->name = resolve->bname; + resolve_loc->inode = inode_new (state->itable); + + inode_path (resolve_loc->parent, resolve_loc->name, + (char **) &resolve_loc->path); + + FUSE_FOP (state, fuse_resolve_entry_cbk, GF_FOP_LOOKUP, + lookup, resolve_loc, NULL); + + return 0; +} + + +int fuse_resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, struct iatt *buf, - dict_t *xattr, struct iatt *postparent) + int op_ret, int op_errno, inode_t *inode, + struct iatt *buf, dict_t *xattr, struct iatt *postparent) { fuse_state_t *state = NULL; fuse_resolve_t *resolve = NULL; inode_t *link_inode = NULL; - loc_t *resolve_loc = NULL; + loc_t *loc_now = NULL; state = frame->root->state; resolve = state->resolve_now; - resolve_loc = &resolve->resolve_loc; + loc_now = state->loc_now; STACK_DESTROY (frame->root); if (op_ret == -1) { - gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG : - GF_LOG_WARNING), + gf_log (this->name, (op_errno == ENOENT) + ? GF_LOG_DEBUG : GF_LOG_WARNING, "%s: failed to resolve (%s)", - uuid_utoa (resolve_loc->gfid), strerror (op_errno)); + uuid_utoa (resolve->resolve_loc.gfid), + strerror (op_errno)); loc_wipe (&resolve->resolve_loc); + + /* resolve->op_ret can have 3 values: 0, -1, -2. + * 0 : resolution was successful. + * -1: parent inode could not be resolved. + * -2: entry (inode corresponding to path) could not be resolved + */ + + if (uuid_is_null (resolve->gfid)) { + resolve->op_ret = -1; + } else { + resolve->op_ret = -2; + } + + resolve->op_errno = op_errno; goto out; } - loc_wipe (resolve_loc); + loc_wipe (&resolve->resolve_loc); link_inode = inode_link (inode, NULL, NULL, buf); if (!link_inode) goto out; - inode_lookup (link_inode); - - if (uuid_is_null (resolve->pargfid)) { - inode_unref (link_inode); - goto out; - } + if (!uuid_is_null (resolve->gfid)) { + loc_now->inode = link_inode; + goto out; + } - resolve_loc->parent = link_inode; - uuid_copy (resolve_loc->pargfid, resolve_loc->parent->gfid); - - resolve_loc->name = resolve->bname; - - resolve_loc->inode = inode_new (state->itable); - inode_path (resolve_loc->parent, resolve_loc->name, - (char **) &resolve_loc->path); + loc_now->parent = link_inode; + uuid_copy (loc_now->pargfid, link_inode->gfid); - FUSE_FOP (state, fuse_resolve_gfid_entry_cbk, GF_FOP_LOOKUP, - lookup, &resolve->resolve_loc, NULL); + fuse_resolve_entry (state); return 0; out: @@ -173,245 +199,436 @@ fuse_resolve_gfid (fuse_state_t *state) if (!uuid_is_null (resolve->pargfid)) { uuid_copy (resolve_loc->gfid, resolve->pargfid); - resolve_loc->inode = inode_new (state->itable); - ret = inode_path (resolve_loc->inode, NULL, - (char **)&resolve_loc->path); } else if (!uuid_is_null (resolve->gfid)) { uuid_copy (resolve_loc->gfid, resolve->gfid); - resolve_loc->inode = inode_new (state->itable); - ret = inode_path (resolve_loc->inode, NULL, - (char **)&resolve_loc->path); } + + /* inode may already exist in case we are looking up an inode which was + linked through readdirplus */ + resolve_loc->inode = inode_find (state->itable, resolve_loc->gfid); + if (!resolve_loc->inode) + resolve_loc->inode = inode_new (state->itable); + ret = loc_path (resolve_loc, NULL); + if (ret <= 0) { gf_log (THIS->name, GF_LOG_WARNING, - "failed to get the path from inode %s", + "failed to get the path for inode %s", uuid_utoa (resolve->gfid)); } FUSE_FOP (state, fuse_resolve_gfid_cbk, GF_FOP_LOOKUP, - lookup, &resolve->resolve_loc, NULL); + lookup, resolve_loc, NULL); return 0; } +/* + * Return value: + * 0 - resolved parent and entry (as necessary) + * -1 - resolved parent but not entry (though necessary) + * 1 - resolved neither parent nor entry + */ + int -fuse_resolve_continue (fuse_state_t *state) +fuse_resolve_parent_simple (fuse_state_t *state) { - fuse_resolve_t *resolve = NULL; - int ret = 0; + fuse_resolve_t *resolve = NULL; + loc_t *loc = NULL; + inode_t *parent = NULL; + inode_t *inode = NULL; resolve = state->resolve_now; + loc = state->loc_now; + + loc->name = resolve->bname; + + parent = resolve->parhint; + if (parent->table == state->itable) { + if (fuse_inode_needs_lookup (parent, THIS)) + return 1; + + /* no graph switches since */ + loc->parent = inode_ref (parent); + uuid_copy (loc->pargfid, parent->gfid); + loc->inode = inode_grep (state->itable, parent, loc->name); + + /* nodeid for root is 1 and we blindly take the latest graph's + * table->root as the parhint and because of this there is + * ambiguity whether the entry should have existed or not, and + * we took the conservative approach of assuming entry should + * have been there even though it need not have (bug #804592). + */ + if ((loc->inode == NULL) + && __is_root_gfid (parent->gfid)) { + /* non decisive result - entry missing */ + return -1; + } - resolve->op_ret = 0; - resolve->op_errno = 0; + /* decisive result - resolution success */ + return 0; + } - /* TODO: should we handle 'fd' here ? */ - if (!uuid_is_null (resolve->pargfid)) - ret = fuse_resolve_entry_simple (state); - else if (!uuid_is_null (resolve->gfid)) - ret = fuse_resolve_inode_simple (state); - if (ret) - gf_log (THIS->name, GF_LOG_DEBUG, - "return value of resolve_*_simple %d", ret); + parent = inode_find (state->itable, resolve->pargfid); + if (!parent) { + /* non decisive result - parent missing */ + return 1; + } + if (fuse_inode_needs_lookup (parent, THIS)) { + inode_unref (parent); + return 1; + } + + loc->parent = parent; + uuid_copy (loc->pargfid, resolve->pargfid); + + inode = inode_grep (state->itable, parent, loc->name); + if (inode) { + loc->inode = inode; + /* decisive result - resolution success */ + return 0; + } + + /* non decisive result - entry missing */ + return -1; +} - fuse_resolve_loc_touchup (state); - fuse_resolve_all (state); +int +fuse_resolve_parent (fuse_state_t *state) +{ + int ret = 0; + + ret = fuse_resolve_parent_simple (state); + if (ret > 0) { + fuse_resolve_gfid (state); + return 0; + } + + if (ret < 0) { + fuse_resolve_entry (state); + return 0; + } + + fuse_resolve_continue (state); return 0; } -/* - Check if the requirements are fulfilled by entries in the inode cache itself - Return value: - <= 0 - simple resolution was decisive and complete (either success or failure) - > 0 - indecisive, need to perform deep resolution -*/ - int -fuse_resolve_entry_simple (fuse_state_t *state) +fuse_resolve_inode_simple (fuse_state_t *state) { fuse_resolve_t *resolve = NULL; - inode_t *parent = NULL; - inode_t *inode = NULL; - int ret = 0; + loc_t *loc = NULL; + inode_t *inode = NULL; resolve = state->resolve_now; + loc = state->loc_now; + + inode = resolve->hint; + if (inode->table == state->itable) + inode_ref (inode); + else + inode = inode_find (state->itable, resolve->gfid); + + if (inode) { + if (!fuse_inode_needs_lookup (inode, THIS)) + goto found; + /* inode was linked through readdirplus */ + inode_unref (inode); + } + + return 1; +found: + loc->inode = inode; + return 0; +} - parent = inode_find (state->itable, resolve->pargfid); - if (!parent) { - /* simple resolution is indecisive. need to perform - deep resolution */ - resolve->op_ret = -1; - resolve->op_errno = ENOENT; - ret = 1; - goto out; - } - /* expected @parent was found from the inode cache */ - if (state->loc_now->parent) { - inode_unref (state->loc_now->parent); +int +fuse_resolve_inode (fuse_state_t *state) +{ + int ret = 0; + + ret = fuse_resolve_inode_simple (state); + + if (ret > 0) { + fuse_resolve_gfid (state); + return 0; } - state->loc_now->parent = inode_ref (parent); + fuse_resolve_continue (state); + + return 0; +} + - inode = inode_grep (state->itable, parent, resolve->bname); - if (!inode) { - resolve->op_ret = -1; - resolve->op_errno = ENOENT; - ret = 1; +int +fuse_migrate_fd_task (void *data) +{ + int ret = -1; + fuse_state_t *state = NULL; + fd_t *basefd = NULL, *oldfd = NULL; + fuse_fd_ctx_t *basefd_ctx = NULL; + xlator_t *old_subvol = NULL; + + state = data; + if (state == NULL) { goto out; } - ret = 0; + basefd = state->fd; - if (state->loc_now->inode) { - inode_unref (state->loc_now->inode); - state->loc_now->inode = NULL; + basefd_ctx = fuse_fd_ctx_get (state->this, basefd); + + LOCK (&basefd->lock); + { + oldfd = basefd_ctx->activefd ? basefd_ctx->activefd : basefd; + fd_ref (oldfd); } + UNLOCK (&basefd->lock); - state->loc_now->inode = inode_ref (inode); - uuid_copy (state->loc_now->gfid, resolve->gfid); + old_subvol = oldfd->inode->table->xl; -out: - if (parent) - inode_unref (parent); + ret = fuse_migrate_fd (state->this, basefd, old_subvol, + state->active_subvol); + + LOCK (&basefd->lock); + { + if (ret < 0) { + basefd_ctx->migration_failed = 1; + } else { + basefd_ctx->migration_failed = 0; + } + } + UNLOCK (&basefd->lock); + + ret = 0; - if (inode) - inode_unref (inode); +out: + if (oldfd) + fd_unref (oldfd); return ret; } -int -fuse_resolve_entry (fuse_state_t *state) +static inline int +fuse_migrate_fd_error (xlator_t *this, fd_t *fd) { - int ret = 0; - loc_t *loc = NULL; - - loc = state->loc_now; + fuse_fd_ctx_t *fdctx = NULL; + char error = 0; - ret = fuse_resolve_entry_simple (state); - if (ret > 0) { - loc_wipe (loc); - fuse_resolve_gfid (state); - return 0; + fdctx = fuse_fd_ctx_get (this, fd); + if (fdctx != NULL) { + if (fdctx->migration_failed) { + error = 1; + } } - if (ret == 0) - fuse_resolve_loc_touchup (state); - - fuse_resolve_all (state); - - return 0; + return error; } +#define FUSE_FD_GET_ACTIVE_FD(activefd, basefd) \ + do { \ + LOCK (&basefd->lock); \ + { \ + activefd = basefd_ctx->activefd ? \ + basefd_ctx->activefd : basefd; \ + if (activefd != basefd) { \ + fd_ref (activefd); \ + } \ + } \ + UNLOCK (&basefd->lock); \ + \ + if (activefd == basefd) { \ + fd_ref (activefd); \ + } \ + } while (0); -int -fuse_resolve_inode_simple (fuse_state_t *state) + +static int +fuse_resolve_fd (fuse_state_t *state) { - fuse_resolve_t *resolve = NULL; - inode_t *inode = NULL; - int ret = 0; + fuse_resolve_t *resolve = NULL; + fd_t *basefd = NULL, *activefd = NULL; + xlator_t *active_subvol = NULL, *this = NULL; + int ret = 0; + char fd_migration_error = 0; + fuse_fd_ctx_t *basefd_ctx = NULL; resolve = state->resolve_now; - inode = inode_find (state->itable, resolve->gfid); - if (!inode) { - resolve->op_ret = -1; - resolve->op_errno = ENOENT; - ret = 1; - goto out; + this = state->this; + + basefd = resolve->fd; + basefd_ctx = fuse_fd_ctx_get (this, basefd); + if (basefd_ctx == NULL) { + gf_log (state->this->name, GF_LOG_WARNING, + "fdctx is NULL for basefd (ptr:%p inode-gfid:%s), " + "resolver erroring out with errno EINVAL", + basefd, uuid_utoa (basefd->inode->gfid)); + resolve->op_ret = -1; + resolve->op_errno = EINVAL; + goto resolve_continue; } - ret = 0; + FUSE_FD_GET_ACTIVE_FD (activefd, basefd); + + active_subvol = activefd->inode->table->xl; + + fd_migration_error = fuse_migrate_fd_error (state->this, basefd); + if (fd_migration_error) { + resolve->op_ret = -1; + resolve->op_errno = EBADF; + } else if (state->active_subvol != active_subvol) { + ret = synctask_new (state->this->ctx->env, fuse_migrate_fd_task, + NULL, NULL, state); + + fd_migration_error = fuse_migrate_fd_error (state->this, + basefd); + fd_unref (activefd); + + FUSE_FD_GET_ACTIVE_FD (activefd, basefd); + active_subvol = activefd->inode->table->xl; + + if ((ret == -1) || fd_migration_error + || (state->active_subvol != active_subvol)) { + if (ret == -1) { + gf_log (state->this->name, GF_LOG_WARNING, + "starting sync-task to migrate " + "basefd (ptr:%p inode-gfid:%s) failed " + "(old-subvolume:%s-%d " + "new-subvolume:%s-%d)", + basefd, + uuid_utoa (basefd->inode->gfid), + active_subvol->name, + active_subvol->graph->id, + state->active_subvol->name, + state->active_subvol->graph->id); + } else { + gf_log (state->this->name, GF_LOG_WARNING, + "fd migration of basefd " + "(ptr:%p inode-gfid:%s) failed " + "(old-subvolume:%s-%d " + "new-subvolume:%s-%d)", + basefd, + uuid_utoa (basefd->inode->gfid), + active_subvol->name, + active_subvol->graph->id, + state->active_subvol->name, + state->active_subvol->graph->id); + } + + resolve->op_ret = -1; + resolve->op_errno = EBADF; + } else { + gf_log (state->this->name, GF_LOG_DEBUG, + "basefd (ptr:%p inode-gfid:%s) migrated " + "successfully in resolver " + "(old-subvolume:%s-%d new-subvolume:%s-%d)", + basefd, uuid_utoa (basefd->inode->gfid), + active_subvol->name, active_subvol->graph->id, + state->active_subvol->name, + state->active_subvol->graph->id); + } + } - if (state->loc_now->inode) { - inode_unref (state->loc_now->inode); + if ((resolve->op_ret == -1) && (resolve->op_errno == EBADF)) { + gf_log ("fuse-resolve", GF_LOG_WARNING, + "migration of basefd (ptr:%p inode-gfid:%s) " + "did not complete, failing fop with EBADF " + "(old-subvolume:%s-%d new-subvolume:%s-%d)", basefd, + uuid_utoa (basefd->inode->gfid), + active_subvol->name, active_subvol->graph->id, + state->active_subvol->name, + state->active_subvol->graph->id); } - state->loc_now->inode = inode_ref (inode); - uuid_copy (state->loc_now->gfid, resolve->gfid); + if (activefd != basefd) { + state->fd = fd_ref (activefd); + fd_unref (basefd); + } -out: - if (inode) - inode_unref (inode); + /* state->active_subvol = active_subvol; */ - return ret; +resolve_continue: + if (activefd != NULL) { + fd_unref (activefd); + } + + fuse_resolve_continue (state); + + return 0; } int -fuse_resolve_inode (fuse_state_t *state) +fuse_gfid_set (fuse_state_t *state) { - int ret = 0; - loc_t *loc = NULL; + int ret = 0; - loc = state->loc_now; + if (uuid_is_null (state->gfid)) + goto out; - ret = fuse_resolve_inode_simple (state); + if (!state->xdata) + state->xdata = dict_new (); - if (ret > 0) { - loc_wipe (loc); - fuse_resolve_gfid (state); - return 0; + if (!state->xdata) { + ret = -1; + goto out; } - if (ret == 0) - fuse_resolve_loc_touchup (state); - - fuse_resolve_all (state); - - return 0; + ret = dict_set_static_bin (state->xdata, "gfid-req", + state->gfid, sizeof (state->gfid)); +out: + return ret; } -static int -fuse_resolve_fd (fuse_state_t *state) + +int +fuse_resolve_entry_init (fuse_state_t *state, fuse_resolve_t *resolve, + ino_t par, char *name) { - fuse_resolve_t *resolve = NULL; - fd_t *fd = NULL; - int ret = 0; - uint64_t tmp_fd_ctx = 0; - char *path = NULL; - char *name = NULL; + inode_t *parent = NULL; - resolve = state->resolve_now; + parent = fuse_ino_to_inode (par, state->this); + uuid_copy (resolve->pargfid, parent->gfid); + resolve->parhint = parent; + resolve->bname = gf_strdup (name); - fd = resolve->fd; + return 0; +} - ret = fd_ctx_get (fd, state->this, &tmp_fd_ctx); - if (!ret) { - state->fd = (fd_t *)(long)tmp_fd_ctx; - fd_ref (state->fd); - fuse_resolve_all (state); - goto out; - } - ret = inode_path (fd->inode, 0, &path); - if (ret <= 0) - gf_log ("", GF_LOG_WARNING, - "failed to do inode-path on fd %d %s", ret, path); +int +fuse_resolve_inode_init (fuse_state_t *state, fuse_resolve_t *resolve, + ino_t ino) +{ + inode_t *inode = NULL; - name = strrchr (path, '/'); - if (name) - name++; + inode = fuse_ino_to_inode (ino, state->this); + uuid_copy (resolve->gfid, inode->gfid); + resolve->hint = inode; - resolve->path = path; - resolve->bname = gf_strdup (name); + return 0; +} - state->loc_now = &state->loc; -out: - return 0; +int +fuse_resolve_fd_init (fuse_state_t *state, fuse_resolve_t *resolve, + fd_t *fd) +{ + resolve->fd = fd_ref (fd); + + return 0; } static int fuse_resolve (fuse_state_t *state) - { +{ fuse_resolve_t *resolve = NULL; resolve = state->resolve_now; @@ -422,17 +639,13 @@ fuse_resolve (fuse_state_t *state) } else if (!uuid_is_null (resolve->pargfid)) { - fuse_resolve_entry (state); + fuse_resolve_parent (state); } else if (!uuid_is_null (resolve->gfid)) { fuse_resolve_inode (state); } else { - - resolve->op_ret = 0; - resolve->op_errno = EINVAL; - fuse_resolve_all (state); } @@ -445,17 +658,10 @@ fuse_resolve_done (fuse_state_t *state) { fuse_resume_fn_t fn = NULL; - if (state->resolve.op_ret || state->resolve2.op_ret) { - send_fuse_err (state->this, state->finh, - state->resolve.op_errno); - free_fuse_state (state); - goto out; - } fn = state->resume_fn; - if (fn) - fn (state); -out: + fn (state); + return 0; } @@ -495,87 +701,24 @@ fuse_resolve_all (fuse_state_t *state) int -fuse_gfid_set (fuse_state_t *state) +fuse_resolve_continue (fuse_state_t *state) { - int ret = 0; - - if (uuid_is_null (state->gfid)) - goto out; - - if (!state->dict) - state->dict = dict_new (); + fuse_resolve_loc_touchup (state); - if (!state->dict) { - ret = -1; - goto out; - } + fuse_resolve_all (state); - ret = dict_set_static_bin (state->dict, "gfid-req", - state->gfid, sizeof (state->gfid)); -out: - return ret; + return 0; } int fuse_resolve_and_resume (fuse_state_t *state, fuse_resume_fn_t fn) { - xlator_t *inode_xl = NULL; - xlator_t *active_xl = NULL; - fuse_gfid_set (state); state->resume_fn = fn; - active_xl = fuse_active_subvol (state->this); - inode_xl = fuse_state_subvol (state); - if (!inode_xl && state->loc.parent) - inode_xl = state->loc.parent->table->xl; - - /* If inode or fd is already in new graph, goto resume */ - if (inode_xl == active_xl) { - /* Lets move to resume if there is no other inode to check */ - if (!(state->loc2.parent || state->loc2.inode)) - goto resume; - - inode_xl = NULL; - /* We have to make sure both inodes we are - working on are in same inode table */ - if (state->loc2.inode) - inode_xl = state->loc2.inode->table->xl; - if (!inode_xl && state->loc2.parent) - inode_xl = state->loc2.parent->table->xl; - - if (inode_xl == active_xl) - goto resume; - } - - - /* If the resolve is for 'fd' and its open with 'write' flag - set, don't switch to new graph yet */ - - /* TODO: fix it later */ - /* if (state->fd && ((state->fd->flags & O_RDWR) || - (state->fd->flags & O_WRONLY))) - */ - if (state->fd) - goto resume; - - /* - if (state->fd) { - state->resolve.fd = state->fd; - state->fd = NULL; // TODO: we may need a 'fd_unref()' here, not very sure' - } - */ - - /* now we have to resolve the inode to 'itable' */ - state->itable = active_xl->itable; - fuse_resolve_all (state); return 0; -resume: - fn (state); - - return 0; } |
