diff options
Diffstat (limited to 'xlators')
| -rw-r--r-- | xlators/features/marker/src/marker.c | 29 | ||||
| -rw-r--r-- | xlators/features/marker/src/marker.h | 16 | 
2 files changed, 39 insertions, 6 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 6b89cfa91b8..89da0893295 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -31,6 +31,8 @@  #include "marker-common.h"  #include "byte-order.h" +#define _GF_UID_GID_CHANGED 1 +  void  fini (xlator_t *this); @@ -1021,8 +1023,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); +        //Reset frame uid and gid if set. +        if (cookie == (void *) _GF_UID_GID_CHANGED) +                MARKER_RESET_UID_GID (frame, frame->root, local);          lock.l_type   = F_UNLCK;          lock.l_whence = SEEK_SET; @@ -1094,9 +1097,7 @@ marker_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  /* 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; +                MARKER_SET_UID_GID (frame, local, frame->root);                  STACK_WIND (frame, marker_rename_release_oldp_lock,                              FIRST_CHILD(this), @@ -1147,6 +1148,10 @@ marker_do_rename (call_frame_t *frame, void *cookie, xlator_t *this,          local = frame->local;          oplocal = local->oplocal; +        //Reset frame uid and gid if set. +        if (cookie == (void *) _GF_UID_GID_CHANGED) +                MARKER_RESET_UID_GID (frame, frame->root, local); +          if ((op_ret < 0) && (op_errno != ENOATTR)) {                  local->err = op_errno;                  gf_log (this->name, GF_LOG_WARNING, @@ -1196,6 +1201,10 @@ marker_get_newpath_contribution (call_frame_t *frame, void *cookie,          local = frame->local;          oplocal = local->oplocal; +        //Reset frame uid and gid if set. +        if (cookie == (void *) _GF_UID_GID_CHANGED) +                MARKER_RESET_UID_GID (frame, frame->root, local); +          if ((op_ret < 0) && (op_errno != ENOATTR)) {                  local->err = op_errno;                  gf_log (this->name, GF_LOG_WARNING, @@ -1223,6 +1232,11 @@ marker_get_newpath_contribution (call_frame_t *frame, void *cookie,                          goto err;                  } +                /* getxattr requires uid and gid to be 0, +                 * reset them in the callback. +                 */ +                MARKER_SET_UID_GID (frame, local, frame->root); +                  STACK_WIND (frame, marker_do_rename,                              FIRST_CHILD(this),                              FIRST_CHILD(this)->fops->getxattr, &local->loc, @@ -1268,6 +1282,11 @@ marker_get_oldpath_contribution (call_frame_t *frame, void *cookie,                  goto quota_err;          } +        /* getxattr requires uid and gid to be 0, +         * reset them in the callback. +         */ +        MARKER_SET_UID_GID (frame, local, frame->root); +          STACK_WIND (frame, marker_get_newpath_contribution, FIRST_CHILD(this),                      FIRST_CHILD(this)->fops->getxattr, &oplocal->loc,                      contri_key); diff --git a/xlators/features/marker/src/marker.h b/xlators/features/marker/src/marker.h index c8c77502465..1fc57057c9b 100644 --- a/xlators/features/marker/src/marker.h +++ b/xlators/features/marker/src/marker.h @@ -64,7 +64,7 @@ enum {                  }                                                \          } while (0) -#define MARKER_SET_UID_GID(dest, src)           \ +#define _MARKER_SET_UID_GID(dest, src)          \          do {                                    \                  if (src->uid != -1 &&           \                      src->gid != -1) {           \ @@ -73,6 +73,20 @@ enum {                  }                               \          } while (0) +#define MARKER_SET_UID_GID(frame, dest, src)                    \ +        do {                                                    \ +                _MARKER_SET_UID_GID (dest, src);                \ +                frame->root->uid = 0;                           \ +                frame->root->gid = 0;                           \ +                frame->cookie = (void *) _GF_UID_GID_CHANGED;   \ +        } while (0) + +#define MARKER_RESET_UID_GID(frame, dest, src)                  \ +        do {                                                    \ +                _MARKER_SET_UID_GID (dest, src);                \ +                frame->cookie = NULL;                           \ +        } while (0) +  struct marker_local{          uint32_t        timebuf[2];          pid_t           pid;  | 
