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