From 590ae48c65a60c93c2e5407e3f663cef3daacc55 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 19 Jul 2017 23:08:05 +0530 Subject: glusterfsd: allow subdir mount Changes: 1. Take subdir mount option in client (mount.gluster / glusterfsd) 2. Pass the subdir mount to server-handshake (from client-handshake) 3. Handle subdir-mount dir's lookup in server-first-lookup and handle all fops resolution accordingly with proper gfid of subdir 4. Change the auth/addr module to handle the multiple subdir entries in option, and valid parsing. How to use the feature: `# mount -t glusterfs $hostname:/$volname/$subdir /$mount_point` Or `# mount -t glusterfs $hostname:/$volname -osubdir_mount=$subdir /$mount_point` Option can be set like: `# gluster volume set auth.allow "/subdir1(192.168.1.*),/(192.168.10.*),/subdir2(192.168.8.*)"` Updates #175 Change-Id: I7ea57f76ddbe6c3862cfe02e13f89e8a39719e11 Signed-off-by: Amar Tumballi Reviewed-on: https://review.gluster.org/17141 Smoke: Gluster Build System Reviewed-by: Shyamsundar Ranganathan CentOS-regression: Gluster Build System --- xlators/protocol/client/src/client-handshake.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'xlators/protocol/client') diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index a36f6e435a7..b6dc0797dd9 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -1137,13 +1137,20 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m if (op_ret < 0) { gf_msg (this->name, GF_LOG_ERROR, op_errno, PC_MSG_SETVOLUME_FAIL, - "SETVOLUME on remote-host failed"); + "SETVOLUME on remote-host failed: %s", remote_error); + errno = op_errno; if (remote_error && (strcmp ("Authentication failed", remote_error) == 0)) { auth_fail = _gf_true; op_ret = 0; } + if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount) { + /* A case of subdir not being present at the moment, + ride on auth_fail framework to notify the error */ + auth_fail = _gf_true; + op_ret = 0; + } if (op_errno == ESTALE) { ret = client_notify_dispatch (this, GF_EVENT_VOLFILE_MODIFIED, @@ -1377,6 +1384,18 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) "'volfile-checksum'"); } + if (this->ctx->cmd_args.subdir_mount) { + ret = dict_set_str (options, "subdir-mount", + this->ctx->cmd_args.subdir_mount); + if (ret) { + gf_log (THIS->name, GF_LOG_ERROR, + "Failed to set subdir_mount"); + /* It makes sense to fail, as per the CLI, we + should be doing a subdir_mount */ + goto fail; + } + } + ret = dict_set_int16 (options, "clnt-lk-version", client_get_lk_ver (conf)); if (ret < 0) { -- cgit