|
|
d1681e |
From 0f3a3c9ed32fec80f1b88cc649a98bcdcc234b6a Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Amar Tumballi <amarts@redhat.com>
|
|
|
d1681e |
Date: Sun, 22 Oct 2017 12:41:38 +0530
|
|
|
d1681e |
Subject: [PATCH 39/74] protocol/client: handle the subdir handshake properly
|
|
|
d1681e |
for add-brick
|
|
|
d1681e |
|
|
|
d1681e |
There should be different way we handle handshake in case of subdir
|
|
|
d1681e |
mount for the first time, and in case of subsequent graph changes.
|
|
|
d1681e |
|
|
|
d1681e |
> Upstream
|
|
|
d1681e |
> URL: https://review.gluster.org/#/c/18550/
|
|
|
d1681e |
>
|
|
|
d1681e |
|
|
|
d1681e |
Change-Id: I2a7ba836433bb0a0f4a861809e2bb0d7fbc4da54
|
|
|
d1681e |
Signed-off-by: Amar Tumballi <amarts@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/121725
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
tests/features/subdir-mount.t | 31 +++++++++++++++++++++-----
|
|
|
d1681e |
xlators/protocol/client/src/client-handshake.c | 10 ++++++++-
|
|
|
d1681e |
2 files changed, 35 insertions(+), 6 deletions(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/tests/features/subdir-mount.t b/tests/features/subdir-mount.t
|
|
|
d1681e |
index ab7ef35..1742f86 100644
|
|
|
d1681e |
--- a/tests/features/subdir-mount.t
|
|
|
d1681e |
+++ b/tests/features/subdir-mount.t
|
|
|
d1681e |
@@ -82,17 +82,38 @@ TEST $CLI volume stop $V0
|
|
|
d1681e |
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
|
|
|
d1681e |
-# /subdir2 has not allowed IP
|
|
|
d1681e |
-TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M1
|
|
|
d1681e |
-TEST stat $M1
|
|
|
d1681e |
-
|
|
|
d1681e |
TEST $GFS --subdir-mount /subdir1/subdir1.1/subdir1.2 -s $H0 --volfile-id $V0 $M2
|
|
|
d1681e |
TEST stat $M2
|
|
|
d1681e |
|
|
|
d1681e |
+# mount shouldn't fail even after add-brick
|
|
|
d1681e |
+TEST $CLI volume add-brick $V0 replica 2 $H0:$B0/${V0}{5,6};
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Give time for client process to get notified and use the new
|
|
|
d1681e |
+# volfile after add-brick
|
|
|
d1681e |
+sleep 1
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Existing mount should still be active
|
|
|
d1681e |
+mount_inode=$(stat --format "%i" "$M2")
|
|
|
d1681e |
+TEST test "$mount_inode" == "1"
|
|
|
d1681e |
+
|
|
|
d1681e |
+TEST umount $M2
|
|
|
d1681e |
+
|
|
|
d1681e |
+# because the subdir is not yet 'healed', below should fail.
|
|
|
d1681e |
+TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M2
|
|
|
d1681e |
+mount_inode=$(stat --format "%i" "$M2")
|
|
|
d1681e |
+TEST test "$mount_inode" != "1"
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Allow the heal to complete
|
|
|
d1681e |
+TEST stat $M0/subdir1/subdir1.1/subdir1.2/subdir1.2_file;
|
|
|
d1681e |
+TEST stat $M0/subdir2/
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Now the mount should succeed
|
|
|
d1681e |
+TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M1
|
|
|
d1681e |
+TEST stat $M1
|
|
|
d1681e |
+
|
|
|
d1681e |
# umount $M1 / $M2
|
|
|
d1681e |
TEST umount $M0
|
|
|
d1681e |
TEST umount $M1
|
|
|
d1681e |
-TEST umount $M2
|
|
|
d1681e |
|
|
|
d1681e |
|
|
|
d1681e |
TEST $CLI volume stop $V0;
|
|
|
d1681e |
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
|
|
|
d1681e |
index b6dc079..aee6b3a 100644
|
|
|
d1681e |
--- a/xlators/protocol/client/src/client-handshake.c
|
|
|
d1681e |
+++ b/xlators/protocol/client/src/client-handshake.c
|
|
|
d1681e |
@@ -1079,10 +1079,14 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
|
|
|
d1681e |
int32_t op_errno = 0;
|
|
|
d1681e |
gf_boolean_t auth_fail = _gf_false;
|
|
|
d1681e |
uint32_t lk_ver = 0;
|
|
|
d1681e |
+ glusterfs_ctx_t *ctx = NULL;
|
|
|
d1681e |
|
|
|
d1681e |
frame = myframe;
|
|
|
d1681e |
this = frame->this;
|
|
|
d1681e |
conf = this->private;
|
|
|
d1681e |
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
|
|
|
d1681e |
+ ctx = this->ctx;
|
|
|
d1681e |
+ GF_VALIDATE_OR_GOTO (this->name, ctx, out);
|
|
|
d1681e |
|
|
|
d1681e |
if (-1 == req->rpc_status) {
|
|
|
d1681e |
gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
|
|
|
d1681e |
@@ -1145,9 +1149,13 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
|
|
|
d1681e |
auth_fail = _gf_true;
|
|
|
d1681e |
op_ret = 0;
|
|
|
d1681e |
}
|
|
|
d1681e |
- if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount) {
|
|
|
d1681e |
+ if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount &&
|
|
|
d1681e |
+ (ctx->graph_id <= 1)) {
|
|
|
d1681e |
/* A case of subdir not being present at the moment,
|
|
|
d1681e |
ride on auth_fail framework to notify the error */
|
|
|
d1681e |
+ /* Make sure this case is handled only in the new
|
|
|
d1681e |
+ graph, so mount may fail in this case. In case
|
|
|
d1681e |
+ of 'add-brick' etc, we need to continue retry */
|
|
|
d1681e |
auth_fail = _gf_true;
|
|
|
d1681e |
op_ret = 0;
|
|
|
d1681e |
}
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|