887953
From 1454b4a477bf841d6bea610b3bb0b084730d38ab Mon Sep 17 00:00:00 2001
887953
From: Amar Tumballi <amarts@redhat.com>
887953
Date: Fri, 13 Apr 2018 10:28:01 +0530
887953
Subject: [PATCH 534/534] fuse: make sure the send lookup on root instead of
887953
 getattr()
887953
887953
This change was done in https://review.gluster.org/16945. While the
887953
changes added there were required, it was not necessary to remove the
887953
getattr part. As fuse's lookup on root(/) comes as getattr only, this
887953
change is very much required.
887953
887953
The previous fix for this bug was to add the check for revalidation in
887953
lookup when it was sent on root. But I had removed the part where
887953
getattr is coming on root. The removing was not requried to fix the
887953
issue then. Added back this part of the code, to make sure we have
887953
proper validation of root inode in many places like acl, etc.
887953
887953
upstream patch: https://review.gluster.org/#/c/glusterfs/+/19867/
887953
887953
> updates: bz#1437780
887953
> Change-Id: I859c4ee1a3f407465cbf19f8934530848424ff50
887953
> Signed-off-by: Amar Tumballi <amarts@redhat.com>
887953
887953
Change-Id: I85af744e7bd1a52367d85d5a5b07c4bdf409a66d
887953
BUG: 1668327
887953
Signed-off-by: N Balachandran <nbalacha@redhat.com>
887953
Reviewed-on: https://code.engineering.redhat.com/gerrit/164663
887953
Tested-by: RHGS Build Bot <nigelb@redhat.com>
887953
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
887953
---
887953
 xlators/mount/fuse/src/fuse-bridge.c | 20 ++++++++++++++++++++
887953
 1 file changed, 20 insertions(+)
887953
887953
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
887953
index 175e1b8..ffc1013 100644
887953
--- a/xlators/mount/fuse/src/fuse-bridge.c
887953
+++ b/xlators/mount/fuse/src/fuse-bridge.c
887953
@@ -1311,6 +1311,7 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
887953
         fuse_private_t         *priv = NULL;
887953
 #endif
887953
         fuse_state_t *state;
887953
+        int ret = -1;
887953
 
887953
         GET_STATE (this, finh, state);
887953
 #if FUSE_KERNEL_MINOR_VERSION >= 9
887953
@@ -1318,6 +1319,25 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg,
887953
         if (priv->proto_minor >= 9 && fgi->getattr_flags & FUSE_GETATTR_FH)
887953
                 state->fd = fd_ref ((fd_t *)fgi->fh);
887953
 #endif
887953
+        if (finh->nodeid == 1) {
887953
+                state->gfid[15] = 1;
887953
+
887953
+                ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL);
887953
+                if (ret < 0) {
887953
+                        gf_log ("glusterfs-fuse", GF_LOG_WARNING,
887953
+                                "%"PRIu64": GETATTR on / (fuse_loc_fill() failed)",
887953
+                                finh->unique);
887953
+                        send_fuse_err (this, finh, ENOENT);
887953
+                        free_fuse_state (state);
887953
+                        return;
887953
+                }
887953
+
887953
+                fuse_gfid_set (state);
887953
+
887953
+                FUSE_FOP (state, fuse_root_lookup_cbk, GF_FOP_LOOKUP,
887953
+                          lookup, &state->loc, state->xdata);
887953
+                return;
887953
+        }
887953
 
887953
         if (state->fd)
887953
                 fuse_resolve_fd_init (state, &state->resolve, state->fd);
887953
-- 
887953
1.8.3.1
887953