diff options
author | Ravishankar N <ravishankar@redhat.com> | 2019-03-14 18:41:11 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2019-03-29 11:08:32 +0000 |
commit | 4e7afab231e22fc740e2d8a39fd7eaefd1fa9f2f (patch) | |
tree | 12fdbd0f5a6622535b7bb6813ea72eabf1b0a2a3 | |
parent | cba59f6cb7fe4e2b9e6b7e7f35c9d659b5fa5450 (diff) |
gfapi: add function to set client-pid
This api offers the ability to set the pid of a client to a particular
value, identical to how gluster fuse clients provide the --client-pid
option. This is an internal API to be used by gluster processes only. See
https://lists.gluster.org/pipermail/gluster-devel/2019-March/055925.html
for more details. Currently glfsheal is the only proposed consumer.
updates: bz#1693155
Change-Id: I0620be2127d79d69cdd57cffb29bba44e6e5da1f
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
(cherry picked from commit 08d502c3b05c6f7831bb4cc764bd458b405a99b1)
-rw-r--r-- | api/src/gfapi.aliases | 1 | ||||
-rw-r--r-- | api/src/gfapi.map | 4 | ||||
-rw-r--r-- | api/src/glfs-internal.h | 6 | ||||
-rw-r--r-- | api/src/glfs.c | 15 |
4 files changed, 26 insertions, 0 deletions
diff --git a/api/src/gfapi.aliases b/api/src/gfapi.aliases index 25e2d74e196..09c0fd8f648 100644 --- a/api/src/gfapi.aliases +++ b/api/src/gfapi.aliases @@ -172,6 +172,7 @@ _pub_glfs_upcall_lease_get_lease_type _glfs_upcall_lease_get_lease_type$GFAPI_4. _priv_glfs_statx _glfs_statx$GFAPI_6.0 _priv_glfs_iatt_from_statx _glfs_iatt_from_statx$GFAPI_6.0 +_priv_glfs_setfspid _glfs_setfspid$GFAPI_6.1 _pub_glfs_read_async _glfs_read_async$GFAPI_6.0 _pub_glfs_write_async _glfs_write_async$GFAPI_6.0 diff --git a/api/src/gfapi.map b/api/src/gfapi.map index bb201c780ec..b97a614c13d 100644 --- a/api/src/gfapi.map +++ b/api/src/gfapi.map @@ -267,3 +267,7 @@ GFAPI_6.0 { glfs_fsetattr; } GFAPI_PRIVATE_6.0; +GFAPI_PRIVATE_6.1 { + global: + glfs_setfspid; +} GFAPI_6.0; diff --git a/api/src/glfs-internal.h b/api/src/glfs-internal.h index 40bbb8a9834..55401b2910e 100644 --- a/api/src/glfs-internal.h +++ b/api/src/glfs-internal.h @@ -702,4 +702,10 @@ void glfs_iatt_from_statx(struct iatt *, const struct glfs_stat *) GFAPI_PRIVATE(glfs_iatt_from_statx, 6.0); +/* + * This API is a per thread setting, similar to glfs_setfs{u/g}id, because of + * the call to syncopctx_setfspid. + */ +int +glfs_setfspid(struct glfs *, pid_t) GFAPI_PRIVATE(glfs_setfspid, 6.1); #endif /* !_GLFS_INTERNAL_H */ diff --git a/api/src/glfs.c b/api/src/glfs.c index b741f6e8b46..f4a8e082f51 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -1461,6 +1461,21 @@ invalid_fs: GFAPI_SYMVER_PRIVATE_DEFAULT(glfs_ipc, 3.12.0); +int +priv_glfs_setfspid(struct glfs *fs, pid_t pid) +{ + cmd_args_t *cmd_args = NULL; + int ret = 0; + + cmd_args = &fs->ctx->cmd_args; + cmd_args->client_pid = pid; + cmd_args->client_pid_set = 1; + ret = syncopctx_setfspid(&pid); + + return ret; +} +GFAPI_SYMVER_PRIVATE_DEFAULT(glfs_setfspid, 6.1); + void pub_glfs_free(void *ptr) { |