diff options
author | Anand Avati <avati@redhat.com> | 2012-12-04 22:35:58 -0800 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-02-13 09:31:33 -0800 |
commit | 1ffb2558fb4bb896883ad71497bac0cc13df4f18 (patch) | |
tree | 573a9663976238f2cab42bd33b1d2c046ed7d905 /libglusterfs/src/syncop.h | |
parent | 311a5df884c0d2320dd43191e6e6ba0a033eb683 (diff) |
synctask: implement setuid-like SYNCTASK_SETID()
synctasks can now call SYNCTASK_SETID(uid,gid) to set the effective
uid/gid of the frame with which the FOP will be performed.
Once called, the uid/gid is set either till the end of the synctask
or till the next call of SYNCTASK_SETID()
Change-Id: I7eb74f7c473099bcae39310d2ab353d58f8eb2ba
BUG: 884597
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4269
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <sgowda@redhat.com>
Diffstat (limited to 'libglusterfs/src/syncop.h')
-rw-r--r-- | libglusterfs/src/syncop.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 6e900e8d0d9..6b63a7d1585 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -59,6 +59,9 @@ struct synctask { int slept; int ret; + uid_t uid; + gid_t gid; + ucontext_t ctx; struct syncproc *proc; @@ -170,6 +173,11 @@ struct syncargs { else \ frame = create_frame (THIS, THIS->ctx->pool); \ \ + if (task) { \ + frame->root->uid = task->uid; \ + frame->root->gid = task->gid; \ + } \ + \ __yawn (stb); \ \ STACK_WIND_COOKIE (frame, cbk, (void *)stb, subvol, \ @@ -195,6 +203,9 @@ int synctask_new (struct syncenv *, synctask_fn_t, synctask_cbk_t, call_frame_t* void synctask_wake (struct synctask *task); void synctask_yield (struct synctask *task); +int synctask_setid (struct synctask *task, uid_t uid, gid_t gid); +#define SYNCTASK_SETID(uid, gid) synctask_setid (synctask_get(), uid, gid); + int syncop_lookup (xlator_t *subvol, loc_t *loc, dict_t *xattr_req, /* out */ struct iatt *iatt, dict_t **xattr_rsp, struct iatt *parent); |