diff options
author | Junaid <junaid@gluster.com> | 2011-07-25 14:59:25 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-29 01:18:30 -0700 |
commit | bc16882a04baaac214f1b41598827038e8872363 (patch) | |
tree | 50cc6590cb37f2679e582d85470d13b6bc1ef977 | |
parent | bed25e47ee047d2f3af1120ee66f17147171bd6e (diff) |
features/marker-quota: Perform removexattr with frame uid and gid set to root.
Change-Id: Iabd8ff835c76d828e4af50ce4941d2ff86797eee
BUG: 3194
Reviewed-on: http://review.gluster.com/98
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <raghavendra@gluster.com>
-rw-r--r-- | xlators/features/marker/src/marker.c | 10 | ||||
-rw-r--r-- | xlators/features/marker/src/marker.h | 13 |
2 files changed, 23 insertions, 0 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index b4cf50800..3edbd7da0 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -1018,6 +1018,9 @@ marker_rename_release_oldp_lock (call_frame_t *frame, void *cookie, local->err = op_errno; } + //Reset frame uid and gid if reset. + MARKER_SET_UID_GID (frame->root, local); + lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; @@ -1085,6 +1088,13 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto quota_err; } + /* Removexattr requires uid and gid to be 0, + * reset them in the callback. + */ + MARKER_SET_UID_GID (local, frame->root); + frame->root->uid = 0; + frame->root->gid = 0; + STACK_WIND (frame, marker_rename_release_oldp_lock, FIRST_CHILD(this), FIRST_CHILD(this)->fops->removexattr, &local->loc, diff --git a/xlators/features/marker/src/marker.h b/xlators/features/marker/src/marker.h index a5a435e3b..3e1990278 100644 --- a/xlators/features/marker/src/marker.h +++ b/xlators/features/marker/src/marker.h @@ -47,6 +47,8 @@ enum { _local->pid = _frame->root->pid; \ memset (&_local->loc, 0, sizeof (loc_t)); \ _local->ref = 1; \ + _local->uid = -1; \ + _local->gid = -1; \ LOCK_INIT (&_local->lock); \ _local->oplocal = NULL; \ } while (0) @@ -62,12 +64,23 @@ enum { } \ } while (0) +#define MARKER_SET_UID_GID(dest, src) \ + do { \ + if (src->uid != -1 && \ + src->gid != -1) { \ + dest->uid = src->uid; \ + dest->gid = src->gid; \ + } \ + } while (0) + struct marker_local{ uint32_t timebuf[2]; pid_t pid; loc_t loc; loc_t parent_loc; loc_t *next_lock_on; + uid_t uid; + gid_t gid; int32_t ref; int32_t ia_nlink; gf_lock_t lock; |