diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2015-06-12 15:12:05 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-07-02 02:15:54 -0700 |
commit | c1a8ae20bd055227921d199b952582eca4104f67 (patch) | |
tree | 8e56a6c2c4da95d00212408e25171c7e0c800e9b /xlators/mount | |
parent | e7f2547f89dbcd90cdb3714f63620a36bdc2ef3a (diff) |
libgfapi: send explicit lookups on inodes linked in readdirp
If the inode is linked via readdirp, then the consuners of gfapi which are using
handles (got either in lookup or readdirp) might not send an explicit lookup on
that object again (ex: NFS, samba, USS). If there is a replicate volume where
the replicas of the object are not in sync, then readdirp followed by fops might
lead data being served from the subvolume which is not in sync with latest
data. And since lookup is needed to trigger self-heal on that object the
consumers might keep getting wrong data until an explicit lookup is not done.
Fuse handles this situation by sending an explicit lookup by itself (fuse
xlator) on those inodes which are linked via readdirp, whenever a fop comes on
that inode.
The same procedure is done in gfapi as well to address this situation.
Thanks to shyam(srangana@redhat.com) for valuable inputs
Change-Id: I64f0591495dddc1dea7f8dc319f2558a7e342871
BUG: 1236009
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.org/11236
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/mount')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 35 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-resolve.c | 8 |
2 files changed, 4 insertions, 39 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 84efd6ca510..b67a60a76b1 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -63,39 +63,6 @@ fuse_forget_cbk (xlator_t *this, inode_t *inode) return 0; } -void -fuse_inode_set_need_lookup (inode_t *inode, xlator_t *this) -{ - uint64_t need_lookup = 1; - - if (!inode || !this) - return; - - inode_ctx_set (inode, this, &need_lookup); - - return; -} - - -gf_boolean_t -fuse_inode_needs_lookup (inode_t *inode, xlator_t *this) -{ - uint64_t need_lookup = 0; - gf_boolean_t ret = _gf_false; - - if (!inode || !this) - return ret; - - inode_ctx_get (inode, this, &need_lookup); - if (need_lookup) - ret = _gf_true; - need_lookup = 0; - inode_ctx_set (inode, this, &need_lookup); - - return ret; -} - - fuse_fd_ctx_t * __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd) { @@ -2787,7 +2754,7 @@ fuse_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, feo->nodeid = inode_to_fuse_nodeid (linked_inode); - fuse_inode_set_need_lookup (linked_inode, this); + inode_set_need_lookup (linked_inode, this); inode_unref (linked_inode); diff --git a/xlators/mount/fuse/src/fuse-resolve.c b/xlators/mount/fuse/src/fuse-resolve.c index 979a89f4b31..48ebf536141 100644 --- a/xlators/mount/fuse/src/fuse-resolve.c +++ b/xlators/mount/fuse/src/fuse-resolve.c @@ -21,8 +21,6 @@ int fuse_migrate_fd (xlator_t *this, fd_t *fd, xlator_t *old_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) { @@ -224,7 +222,7 @@ fuse_resolve_parent_simple (fuse_state_t *state) parent = resolve->parhint; if (parent->table == state->itable) { - if (fuse_inode_needs_lookup (parent, THIS)) + if (inode_needs_lookup (parent, THIS)) return 1; /* no graph switches since */ @@ -253,7 +251,7 @@ fuse_resolve_parent_simple (fuse_state_t *state) /* non decisive result - parent missing */ return 1; } - if (fuse_inode_needs_lookup (parent, THIS)) { + if (inode_needs_lookup (parent, THIS)) { inode_unref (parent); return 1; } @@ -312,7 +310,7 @@ fuse_resolve_inode_simple (fuse_state_t *state) inode = inode_find (state->itable, resolve->gfid); if (inode) { - if (!fuse_inode_needs_lookup (inode, THIS)) + if (!inode_needs_lookup (inode, THIS)) goto found; /* inode was linked through readdirplus */ inode_unref (inode); |