21ab4e
From 3eff3dcb1b0a0a4ce67214ce238fdd2082f26593 Mon Sep 17 00:00:00 2001
21ab4e
From: Amar Tumballi <amarts@redhat.com>
21ab4e
Date: Mon, 23 Oct 2017 21:17:52 +0200
21ab4e
Subject: [PATCH 627/631] protocol/server: fix the comparision logic in case of
21ab4e
 subdir mount
21ab4e
21ab4e
without the fix, the stat entry on a file would return inode==1 for
21ab4e
many files, in case of subdir mount
21ab4e
21ab4e
This happened with the confusion of return value of 'gf_uuid_compare()',
21ab4e
it is more like strcmp, instead of a gf_boolean return value, and hence
21ab4e
resulted in the bug.
21ab4e
21ab4e
> Upstream:
21ab4e
> URL: https://review.gluster.org/#/c/18558/
21ab4e
>
21ab4e
21ab4e
Also fixes the bz1501714
21ab4e
21ab4e
Change-Id: I31b8cbd95eaa3af5ff916a969458e8e4020c86bb
21ab4e
BUG: 1505473
21ab4e
Signed-off-by: Amar Tumballi <amarts@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/121726
21ab4e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/protocol/server/src/server-common.c | 60 ++++++++++++++---------------
21ab4e
 1 file changed, 30 insertions(+), 30 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/protocol/server/src/server-common.c b/xlators/protocol/server/src/server-common.c
21ab4e
index 100b19884..999eb1421 100644
21ab4e
--- a/xlators/protocol/server/src/server-common.c
21ab4e
+++ b/xlators/protocol/server/src/server-common.c
21ab4e
@@ -12,22 +12,22 @@
21ab4e
 void
21ab4e
 server_post_stat (server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf)
21ab4e
 {
21ab4e
-        if (state->client->subdir_mount) {
21ab4e
-                if (gf_uuid_compare (stbuf->ia_gfid,
21ab4e
-                                     state->client->subdir_gfid)) {
21ab4e
-                        /* This is very important as when we send iatt of
21ab4e
-                           root-inode, fuse/client expect the gfid to be 1,
21ab4e
-                           along with inode number. As for subdirectory mount,
21ab4e
-                           we use inode table which is shared by everyone, but
21ab4e
-                           make sure we send fops only from subdir and below,
21ab4e
-                           we have to alter inode gfid and send it to client */
21ab4e
-                        uuid_t gfid = {0,};
21ab4e
-
21ab4e
-                        gfid[15] = 1;
21ab4e
-                        stbuf->ia_ino = 1;
21ab4e
-                        gf_uuid_copy (stbuf->ia_gfid, gfid);
21ab4e
-                }
21ab4e
+        if (state->client->subdir_mount &&
21ab4e
+            !gf_uuid_compare (stbuf->ia_gfid,
21ab4e
+                              state->client->subdir_gfid)) {
21ab4e
+                /* This is very important as when we send iatt of
21ab4e
+                   root-inode, fuse/client expect the gfid to be 1,
21ab4e
+                   along with inode number. As for subdirectory mount,
21ab4e
+                   we use inode table which is shared by everyone, but
21ab4e
+                   make sure we send fops only from subdir and below,
21ab4e
+                   we have to alter inode gfid and send it to client */
21ab4e
+                uuid_t gfid = {0,};
21ab4e
+
21ab4e
+                gfid[15] = 1;
21ab4e
+                stbuf->ia_ino = 1;
21ab4e
+                gf_uuid_copy (stbuf->ia_gfid, gfid);
21ab4e
         }
21ab4e
+
21ab4e
         gf_stat_from_iatt (&rsp->stat, stbuf);
21ab4e
 }
21ab4e
 
21ab4e
@@ -185,22 +185,22 @@ void
21ab4e
 server_post_fstat (server_state_t *state, gfs3_fstat_rsp *rsp,
21ab4e
                    struct iatt *stbuf)
21ab4e
 {
21ab4e
-        if (state->client->subdir_mount) {
21ab4e
-                if (gf_uuid_compare (stbuf->ia_gfid,
21ab4e
-                                     state->client->subdir_gfid)) {
21ab4e
-                        /* This is very important as when we send iatt of
21ab4e
-                           root-inode, fuse/client expect the gfid to be 1,
21ab4e
-                           along with inode number. As for subdirectory mount,
21ab4e
-                           we use inode table which is shared by everyone, but
21ab4e
-                           make sure we send fops only from subdir and below,
21ab4e
-                           we have to alter inode gfid and send it to client */
21ab4e
-                        uuid_t gfid = {0,};
21ab4e
-
21ab4e
-                        gfid[15] = 1;
21ab4e
-                        stbuf->ia_ino = 1;
21ab4e
-                        gf_uuid_copy (stbuf->ia_gfid, gfid);
21ab4e
-                }
21ab4e
+        if (state->client->subdir_mount &&
21ab4e
+            !gf_uuid_compare (stbuf->ia_gfid,
21ab4e
+                              state->client->subdir_gfid)) {
21ab4e
+                /* This is very important as when we send iatt of
21ab4e
+                   root-inode, fuse/client expect the gfid to be 1,
21ab4e
+                   along with inode number. As for subdirectory mount,
21ab4e
+                   we use inode table which is shared by everyone, but
21ab4e
+                   make sure we send fops only from subdir and below,
21ab4e
+                   we have to alter inode gfid and send it to client */
21ab4e
+                uuid_t gfid = {0,};
21ab4e
+
21ab4e
+                gfid[15] = 1;
21ab4e
+                stbuf->ia_ino = 1;
21ab4e
+                gf_uuid_copy (stbuf->ia_gfid, gfid);
21ab4e
         }
21ab4e
+
21ab4e
         gf_stat_from_iatt (&rsp->stat, stbuf);
21ab4e
 }
21ab4e
 
21ab4e
-- 
21ab4e
2.13.6
21ab4e