summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/syncop.c
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2014-01-27 00:58:45 -0800
committerAnand Avati <avati@redhat.com>2014-02-13 11:19:33 -0800
commit3571066deedfe858ef37f09d6ad2160e5dd7b803 (patch)
tree091a19547d889a41dff6b6fa980f546f15324f0a /libglusterfs/src/syncop.c
parent7b4d6e3ec61e9cb0b9d0ffa0aef2117b96e63f65 (diff)
syncops: add support for custom PID
AFR self-heal needs to issue syncops with special PID. Extend the custom UID/GID support to include custom PIDs Change-Id: I736c0e177f862b029f203acc87f9eb46c8cb839b BUG: 1021686 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/6888 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'libglusterfs/src/syncop.c')
-rw-r--r--libglusterfs/src/syncop.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 7e78d4f6e9d..9705a7d5452 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -169,6 +169,46 @@ out:
return ret;
}
+int
+syncopctx_setfspid (void *pid)
+{
+ struct syncopctx *opctx = NULL;
+ int ret = 0;
+
+ /* In args check */
+ if (!pid) {
+ ret = -1;
+ errno = EINVAL;
+ goto out;
+ }
+
+ opctx = syncopctx_getctx ();
+
+ /* alloc for this thread the first time */
+ if (!opctx) {
+ opctx = GF_CALLOC (1, sizeof (*opctx), gf_common_mt_syncopctx);
+ if (!opctx) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = syncopctx_setctx (opctx);
+ if (ret != 0) {
+ GF_FREE (opctx);
+ opctx = NULL;
+ goto out;
+ }
+ }
+
+out:
+ if (opctx && pid) {
+ opctx->pid = *(pid_t *)pid;
+ opctx->valid |= SYNCOPCTX_PID;
+ }
+
+ return ret;
+}
+
static void
__run (struct synctask *task)
{