summaryrefslogtreecommitdiffstats
path: root/xlators/mount/fuse/src/fuse-bridge.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2018-04-13 10:28:01 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-05-07 19:41:41 +0000
commit4b046827b99480e0cfabeaa75e593db13445176e (patch)
tree10131cfd255ef0fec834b3a507bd9ecaf5ff7499 /xlators/mount/fuse/src/fuse-bridge.c
parent4da244caccd38a77de5428b6954f565219ef0719 (diff)
fuse: make sure the send lookup on root instead of getattr()
This change was done in https://review.gluster.org/16945. While the changes added there were required, it was not necessary to remove the getattr part. As fuse's lookup on root(/) comes as getattr only, this change is very much required. The previous fix for this bug was to add the check for revalidation in lookup when it was sent on root. But I had removed the part where getattr is coming on root. The removing was not requried to fix the issue then. Added back this part of the code, to make sure we have proper validation of root inode in many places like acl, etc. updates: bz#1437780 Change-Id: I859c4ee1a3f407465cbf19f8934530848424ff50 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/mount/fuse/src/fuse-bridge.c')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 322b4deeffa..ed70f82f745 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -968,6 +968,7 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
fuse_private_t *priv = NULL;
#endif
fuse_state_t *state;
+ int ret = -1;
GET_STATE (this, finh, state);
#if FUSE_KERNEL_MINOR_VERSION >= 9
@@ -975,6 +976,25 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
if (priv->proto_minor >= 9 && fgi->getattr_flags & FUSE_GETATTR_FH)
state->fd = fd_ref ((fd_t *)fgi->fh);
#endif
+ if (finh->nodeid == 1) {
+ state->gfid[15] = 1;
+
+ ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL);
+ if (ret < 0) {
+ gf_log ("glusterfs-fuse", GF_LOG_WARNING,
+ "%"PRIu64": GETATTR on / (fuse_loc_fill() failed)",
+ finh->unique);
+ send_fuse_err (this, finh, ENOENT);
+ free_fuse_state (state);
+ return;
+ }
+
+ fuse_gfid_set (state);
+
+ FUSE_FOP (state, fuse_root_lookup_cbk, GF_FOP_LOOKUP,
+ lookup, &state->loc, state->xdata);
+ return;
+ }
if (state->fd)
fuse_resolve_fd_init (state, &state->resolve, state->fd);