From ae084046cce12a1ce707b5d141f092b4c011e1b3 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 > Reviewed-At: https://review.gluster.org/17141/ Change-Id: I7ea57f76ddbe6c3862cfe02e13f89e8a39719e11 Signed-off-by: Amar Tumballi Reviewed-on: https://review.gluster.org/17968 Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Shyamsundar Ranganathan --- libglusterfs/src/client_t.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/client_t.c') diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index 62cfbc422f8..eda1c465827 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -159,7 +159,8 @@ gf_client_clienttable_destroy (clienttable_t *clienttable) * as long as ref.bind is > 0 client should be alive. */ client_t * -gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid) +gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid, + char *subdir_mount) { client_t *client = NULL; cliententry_t *cliententry = NULL; @@ -204,6 +205,8 @@ gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid) } client->this = this; + if (subdir_mount != NULL) + client->subdir_mount = gf_strdup (subdir_mount); LOCK_INIT (&client->scratch_ctx.lock); @@ -373,11 +376,16 @@ client_destroy (client_t *client) list_for_each_entry (gtrav, &client->this->ctx->graphs, list) { gf_client_destroy_recursive (gtrav->top, client); } + + if (client->subdir_inode) + inode_unref (client->subdir_inode); + GF_FREE (client->auth.data); GF_FREE (client->auth.username); GF_FREE (client->auth.passwd); GF_FREE (client->scratch_ctx.ctx); GF_FREE (client->client_uid); + GF_FREE (client->subdir_mount); GF_FREE (client); out: return; @@ -788,6 +796,12 @@ gf_client_dump_fdtables (xlator_t *this) client->client_uid); } + if (client->subdir_mount) { + gf_proc_dump_build_key (key, "conn", + "%d.subdir", count); + gf_proc_dump_write (key, "%s", + client->subdir_mount); + } gf_proc_dump_build_key (key, "conn", "%d.ref", count); gf_proc_dump_write (key, GF_PRI_ATOMIC, -- cgit