Branch 'uidmap' - scripts/cfs_start_volume.py xlators/features

Kaleb KEITHLEY kkeithle at fedoraproject.org
Tue Jun 7 14:05:34 UTC 2011


 scripts/cfs_start_volume.py             |   18 -
 xlators/features/uidmap/src/Makefile.am |    2 
 xlators/features/uidmap/src/rbmap.c     |  268 +++++++++------
 xlators/features/uidmap/src/uidmap.c    |  570 ++++++++++++++++----------------
 xlators/features/uidmap/src/uidmap.h    |    8 
 5 files changed, 470 insertions(+), 396 deletions(-)

New commits:
commit f1d83347f755642d4e4bd297f680bfc965e56158
Author: Kaleb S. KEITHLEY <kkeithle at cloudfs-node01.kkeithle.redhat.com>
Date:   Tue Jun 7 10:01:00 2011 -0400

    scripts/cfs_start_volume.py: use proper option name, not the deprecated one
    xlators/features/uidmap/src/Makefile.am: turns out the gluster rb(tree) is
        in /usr/lib(64)/libglusterfs.so, so there's no need to compile it into
        our own lib
    xlators/features/uidmap/src/{rbmap,uidmap}.[ch]: properly deal with multi-
        tenancy, i.e. maintain separate mappings for each tenant and persist
        (pickle) the mappings in their own file(s) in /usr/lib/cloudfs

diff --git a/scripts/cfs_start_volume.py b/scripts/cfs_start_volume.py
index b51b653..70918db 100755
--- a/scripts/cfs_start_volume.py
+++ b/scripts/cfs_start_volume.py
@@ -119,16 +119,22 @@ def cloudify_server (input, output, users, port):
 		print "# stripping auth option %s = %s" % (opt, last.opts[opt])
 		del last.opts[opt]
 
-	default_uidmap_opts = dict()
-	default_uidmap_opts["uid-range"] = "10000-19999"
-	default_uidmap_opts["gid-range"] = "10000-19999"
-	default_uidmap_opts["tenant"] = "ChangeMe"
-	default_uidmap_opts["plugin"] = "/usr/lib64/glusterfs/3.1.3git/xlator/features/libmaprbtree.so"
+        uid_base = 10000
+        uid_incr = 1000
+        gid_base = 10000
+        gid_incr = 1000
+	uidmap_opts = dict()
 
 	last.subvols = []
 	for user, pw in users:
+		uidmap_opts[user] = dict()
+		uidmap_opts[user]["uidmap-plugin"] = "/usr/lib64/glusterfs/3.1.3git/xlator/features/libmaprbtree.so"
+		uidmap_opts[user]["uid-range"] = "%d-%d" % (uid_base, uid_base + uid_incr - 1)
+		uidmap_opts[user]["gid-range"] = "%d-%d" % (gid_base, gid_base + uid_incr - 1)
+		uid_base = uid_base + uid_incr
+		gid_base = gid_base + gid_incr
 		new_stack = volfilter.copy_stack(old_stack,user)
-		volfilter.push_filter(graph, new_stack, "features/uidmap", default_uidmap_opts)
+		volfilter.push_filter(graph, new_stack, "features/uidmap", uidmap_opts[user])
 		last.subvols.append(new_stack)
 		last.opts["auth.login.%s.allow"%new_stack.name] = user
 		last.opts["auth.login.%s.password"%user] = pw 
diff --git a/xlators/features/uidmap/src/Makefile.am b/xlators/features/uidmap/src/Makefile.am
index d0da92c..fd58a37 100644
--- a/xlators/features/uidmap/src/Makefile.am
+++ b/xlators/features/uidmap/src/Makefile.am
@@ -8,7 +8,7 @@ uidmap_la_SOURCES = uidmap.c
 
 libmaprbtree_la_LDFLAGS = -module -avoidversion -lglusterfs
 
-libmaprbtree_la_SOURCES = rb.c rbmap.c
+libmaprbtree_la_SOURCES = rbmap.c
 
 noinst_HEADERS = uidmap.h rb.h
 
diff --git a/xlators/features/uidmap/src/rbmap.c b/xlators/features/uidmap/src/rbmap.c
index 7c2f810..49b3500 100644
--- a/xlators/features/uidmap/src/rbmap.c
+++ b/xlators/features/uidmap/src/rbmap.c
@@ -1,5 +1,5 @@
-/* 
-   Copyright © 2011, Red Hat, Inc.
+/*
+   Copyright 2011, Red Hat, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -24,7 +24,8 @@
 #include "uidmap.h"
 #include "rb.h"
 
-static struct {
+typedef struct {
+        char *name;
         uid_t uid_low;
         uid_t uid_high;
         uid_t uid_next;
@@ -35,10 +36,9 @@ static struct {
         struct rb_table *uid_revmap;
         struct rb_table *gid_map;
         struct rb_table *gid_revmap;
-        char* tenant;
         int root_squash;
         pthread_mutex_t mtx;
-} rbmap;
+} mapping_t;
 
 union tuple {
         struct {
@@ -71,15 +71,18 @@ union tuple {
 
 #define RBMAP_LOG_LEVEL GF_LOG_DEBUG
 
+static struct rb_table *mappings;
+static pthread_mutex_t mappings_mtx = PTHREAD_MUTEX_INITIALIZER;
+
 /* serialize and persist */
 static void
-rbmap_serialize(char *tenant)
+rbmap_serialize(mapping_t *mapping)
 {
         char fname[128], lkname[128];
         FILE *file = NULL;
         int lockfd = -1;
-        (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, tenant);
-        (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, tenant);
+        (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, mapping->name);
+        (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, mapping->name);
 
         do {
                 int status;
@@ -87,44 +90,44 @@ rbmap_serialize(char *tenant)
                 union tuple *data;
                 lockfd = open(lkname, O_CREAT|O_WRONLY, 0644);
                 if (lockfd == -1) {
-                        gf_log("serialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_CRITICAL,
                                "open %s: %s", lkname, strerror(errno));
                         break;
                 }
                 status = flock(lockfd, LOCK_EX);
                 if (status == -1) {
-                        gf_log("serialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_CRITICAL,
                                "flock failed %s", strerror(errno));
                         break;
                 }
                 file = fopen(fname, "w");
                 if (file == NULL) {
                         (void) flock(lockfd, LOCK_UN);
-                        gf_log("serialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_CRITICAL,
                                "fopen failed %s", strerror(errno));
                         break;
                 }
                 (void) fprintf(file, RBMAP_SIGNATURE);
-                data = (union tuple *) rb_t_first(&trav, rbmap.uid_map);
+                data = (union tuple *) rb_t_first(&trav, mapping->uid_map);
                 while (data != NULL) {
                         (void) fprintf(file, "%s %u %u\n",
                                        RBMAP_UID_MAP_ENTRY,
                                        data->u1, data->u2);
                         data = (union tuple *) rb_t_next(&trav);
                 }
-                (void) fprintf(file, "%s %u\n", RBMAP_UID_LOW, rbmap.uid_low);
-                (void) fprintf(file, "%s %u\n", RBMAP_UID_HIGH, rbmap.uid_high);
-                (void) fprintf(file, "%s %u\n", RBMAP_UID_NEXT, rbmap.uid_next);
-                data = (union tuple *) rb_t_first(&trav, rbmap.gid_map);
+                (void) fprintf(file, "%s %u\n", RBMAP_UID_LOW, mapping->uid_low);
+                (void) fprintf(file, "%s %u\n", RBMAP_UID_HIGH, mapping->uid_high);
+                (void) fprintf(file, "%s %u\n", RBMAP_UID_NEXT, mapping->uid_next);
+                data = (union tuple *) rb_t_first(&trav, mapping->gid_map);
                 while (data != NULL) {
                         (void) fprintf(file, "%s %u %u\n",
                                        RBMAP_GID_MAP_ENTRY,
                                        data->g1, data->g2);
                         data = (union tuple *) rb_t_next(&trav);
                 }
-                (void) fprintf(file, "%s %u\n", RBMAP_GID_LOW, rbmap.gid_low);
-                (void) fprintf(file, "%s %u\n", RBMAP_GID_HIGH, rbmap.gid_high);
-                (void) fprintf(file, "%s %u\n", RBMAP_GID_NEXT, rbmap.gid_next);
+                (void) fprintf(file, "%s %u\n", RBMAP_GID_LOW, mapping->gid_low);
+                (void) fprintf(file, "%s %u\n", RBMAP_GID_HIGH, mapping->gid_high);
+                (void) fprintf(file, "%s %u\n", RBMAP_GID_NEXT, mapping->gid_next);
         } while (0);
         if (file != NULL) {
                 (void) fclose(file);
@@ -137,7 +140,7 @@ rbmap_serialize(char *tenant)
 
 
 static int
-rbmap_readmapfile(FILE *file)
+rbmap_readmapfile(mapping_t *mapping, FILE *file)
 {
         char scratch[128];
         char* sts;
@@ -155,10 +158,10 @@ rbmap_readmapfile(FILE *file)
                                 int num = sscanf(&scratch[RBMAP_UID_MAP_ENTRY_LEN+1],
                                                  " %u %u", &map_data->u1, &map_data->u2);
                                 if (num == 2) {
-                                        rb_insert(rbmap.uid_map, map_data);
+                                        rb_insert(mapping->uid_map, map_data);
                                         revmap_data->u1 = map_data->u2;
                                         revmap_data->u2 = map_data->u1;
-                                        rb_insert(rbmap.uid_revmap, revmap_data);
+                                        rb_insert(mapping->uid_revmap, revmap_data);
                                 } else {
                                         (void) free(map_data);
                                         (void) free(revmap_data);
@@ -169,13 +172,13 @@ rbmap_readmapfile(FILE *file)
                                 return -1;
                         }
                 } else if (strncmp(scratch, RBMAP_UID_LOW, RBMAP_UID_LOW_LEN) == 0) {
-                        rbmap.uid_low =
+                        mapping->uid_low =
                                 (uid_t) strtoul(&scratch[RBMAP_UID_LOW_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, RBMAP_UID_HIGH, RBMAP_UID_HIGH_LEN) == 0) {
-                        rbmap.uid_high =
+                        mapping->uid_high =
                                 (uid_t) strtoul(&scratch[RBMAP_UID_HIGH_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, RBMAP_UID_NEXT, RBMAP_UID_NEXT_LEN) == 0) {
-                        rbmap.uid_next =
+                        mapping->uid_next =
                                 (uid_t) strtoul(&scratch[RBMAP_UID_NEXT_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, RBMAP_GID_MAP_ENTRY, RBMAP_GID_MAP_ENTRY_LEN) == 0) {
                         union tuple *map_data;
@@ -190,10 +193,10 @@ rbmap_readmapfile(FILE *file)
                                 int num = sscanf(&scratch[RBMAP_GID_MAP_ENTRY_LEN+1],
                                                  " %u %u", &map_data->g1, &map_data->g2);
                                 if (num == 2) {
-                                        rb_insert(rbmap.gid_map, map_data);
+                                        rb_insert(mapping->gid_map, map_data);
                                         revmap_data->g1 = map_data->g2;
                                         revmap_data->g2 = map_data->g1;
-                                        rb_insert(rbmap.gid_revmap, revmap_data);
+                                        rb_insert(mapping->gid_revmap, revmap_data);
                                 } else {
                                         (void) free(map_data);
                                         (void) free(revmap_data);
@@ -204,13 +207,13 @@ rbmap_readmapfile(FILE *file)
                                 return -1;
                         }
                 } else if (strncmp(scratch, RBMAP_GID_LOW, RBMAP_GID_LOW_LEN) == 0) {
-                        rbmap.gid_low =
+                        mapping->gid_low =
                                 (uid_t) strtoul(&scratch[RBMAP_GID_LOW_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, RBMAP_GID_HIGH, RBMAP_GID_HIGH_LEN) == 0) {
-                        rbmap.gid_high =
+                        mapping->gid_high =
                                 (uid_t) strtoul(&scratch[RBMAP_GID_HIGH_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, RBMAP_GID_NEXT, RBMAP_GID_NEXT_LEN) == 0) {
-                        rbmap.gid_next =
+                        mapping->gid_next =
                                 (uid_t) strtoul(&scratch[RBMAP_GID_NEXT_LEN+1], NULL, 10);
                 }
         }
@@ -218,13 +221,13 @@ rbmap_readmapfile(FILE *file)
 }
 
 static int
-rbmap_deserialize(char *tenant)
+rbmap_deserialize(mapping_t *mapping)
 {
         char fname[128], lkname[128];
-        FILE* file = NULL;
+        FILE *file = NULL;
         int lockfd = -1;
-        (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, tenant);
-        (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, tenant);
+        (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, mapping->name);
+        (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, mapping->name);
 
         do {
                 char scratch[128];
@@ -232,34 +235,34 @@ rbmap_deserialize(char *tenant)
                 int status;
                 lockfd = open(lkname, O_CREAT|O_RDONLY, 0644);
                 if (lockfd == -1) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_CRITICAL,
                                "open %s: %s", lkname, strerror(errno));
                         break;
                 }
                 status = flock(lockfd, LOCK_EX);
                 if (status == -1) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_CRITICAL,
                                "flock: %s", strerror(errno));
                         break;
                 }
                 file = fopen(fname, "r");
                 if (file == NULL) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_INFO,
                                "fopen failed: %s", strerror(errno));
                         break;
                 }
                 /* read the first line (signature) of the file) */
                 if ((sts = fgets(scratch, sizeof scratch, file)) == (char *) EOF || sts == NULL) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_CRITICAL,
                                "fgets signature failed: %s", strerror(errno));
                         break;
                 }
                 if (strcmp(RBMAP_SIGNATURE, scratch) != 0) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(mapping->name, GF_LOG_CRITICAL,
                                "signature mismatch: %s", scratch);
                         break;
                 }
-                if (rbmap_readmapfile(file) == -1) {
+                if (rbmap_readmapfile(mapping, file) == -1) {
                         return -1;
                 }
         } while (0);
@@ -275,125 +278,148 @@ rbmap_deserialize(char *tenant)
 
 
 int
-map(struct _call_stack_t *stack, struct _xlator *xlator)
+map(struct _call_stack_t *stack, char *name)
 {
-        char *tenant = rbmap.tenant ? rbmap.tenant : "unknown";
         int do_persist = 0;
-        if (stack->uid == 0 && rbmap.root_squash) {
+        mapping_t *mapping, mneedle;
+        mneedle.name = name;
+        mapping = (mapping_t *) rb_find(mappings, &mneedle);
+        /* assert(mapping != NULL); */
+        if (mapping == NULL) {
+                return -1;
+        }
+        if (stack->uid == 0 && mapping->root_squash) {
                 stack->uid = stack->gid = CLOUDFS_NOBODY;
                 return 0;
         }
-        pthread_mutex_lock(&rbmap.mtx);
         do {
+                pthread_mutex_lock(&mapping->mtx);
                 if (stack->uid != 0) {
                         /* look for an existing match */
-                        union tuple *new_map, needle;
-                        needle.u1 = stack->uid;
-                        new_map = (union tuple *) rb_find(rbmap.uid_map, &needle);
+                        union tuple *new_map, tneedle;
+                        tneedle.u1 = stack->uid;
+                        new_map = (union tuple *) rb_find(mapping->uid_map, &tneedle);
                         if (new_map == NULL) {
                                 union tuple *new_revmap = NULL;
                                 /* couldn't find one, make a new one */
-                                if (rbmap.uid_next > rbmap.uid_high) {
-                                        gf_log("map uid", GF_LOG_CRITICAL,
-                                               "exhausted uids in range %u-%u",
-                                               rbmap.uid_low, rbmap.uid_high);
-                                        pthread_mutex_unlock(&rbmap.mtx);
+                                if (mapping->uid_next > mapping->uid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
+                                               "no uids in range %u-%u",
+                                               mapping->uid_low, mapping->uid_high);
+                                        pthread_mutex_unlock(&mapping->mtx);
                                         return -1;
                                 }
                                 new_map = (union tuple *) malloc(sizeof(union tuple));
                                 new_revmap =
                                         (union tuple *) malloc(sizeof(union tuple));
                                 if (new_map == NULL || new_revmap == NULL) {
-                                        pthread_mutex_unlock(&rbmap.mtx);
+                                        pthread_mutex_unlock(&mapping->mtx);
                                         if (new_map != NULL) (void) free(new_map);
                                         if (new_revmap != NULL) (void) free(new_revmap);
                                         return -1;
                                 }
                                 do_persist = 1;
                                 new_map->u1 = stack->uid;
-                                new_map->u2 = rbmap.uid_next++;
+                                new_map->u2 = mapping->uid_next++;
                                 new_revmap->u1 = new_map->u2;
                                 new_revmap->u2 = new_map->u1;
-                                if (rb_probe(rbmap.uid_map, new_map) == NULL) {
-                                        pthread_mutex_unlock(&rbmap.mtx);
+                                if (rb_probe(mapping->uid_map, new_map) == NULL) {
+                                        pthread_mutex_unlock(&mapping->mtx);
                                         (void) free(new_map);
                                         (void) free(new_revmap);
                                         return -1;
                                 }
-                                if (rb_probe(rbmap.uid_revmap, new_revmap) == NULL) {
-                                        pthread_mutex_unlock(&rbmap.mtx);
-                                        (void) rb_delete(rbmap.uid_map, new_map);
+                                if (rb_probe(mapping->uid_revmap, new_revmap) == NULL) {
+                                        pthread_mutex_unlock(&mapping->mtx);
+                                        (void) rb_delete(mapping->uid_map, new_map);
                                         (void) free(new_map);
                                         (void) free(new_revmap);
                                         return -1;
                                 }
-                                gf_log("map uid", GF_LOG_TRACE,
-                                       "added new uid mapping for %s %u -> %u",
-                                       tenant, stack->uid, new_map->u2);
+                                gf_log(name, RBMAP_LOG_LEVEL,
+                                       "added new uid mapping %u -> %u",
+                                       stack->uid, new_map->u2);
+                                if (mapping->uid_next > mapping->uid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
+                                               "exhausted uids in range %u-%u",
+                                               mapping->uid_low, mapping->uid_high);
+                                }
                         }
                         stack->uid = new_map->u2;
                 }
                 if (stack->gid != 0) {
                         /* look for an existing match */
-                        union tuple *new_map, needle;
-                        needle.g1 = stack->gid;
-                        new_map = (union tuple *) rb_find(rbmap.gid_map, &needle);
+                        union tuple *new_map, tneedle;
+                        tneedle.g1 = stack->gid;
+                        new_map = (union tuple *) rb_find(mapping->gid_map, &tneedle);
                         if (new_map == NULL) {
                                 union tuple *new_revmap = NULL;
                                 /* couldn't find one, make a new one */
-                                if (rbmap.gid_next > rbmap.gid_high) {
-                                        gf_log("map gid", GF_LOG_CRITICAL,
-                                               "exhausted gids in range %u-%u",
-                                               rbmap.gid_low, rbmap.gid_high);
-                                        pthread_mutex_unlock(&rbmap.mtx);
+                                if (mapping->gid_next > mapping->gid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
+                                               "no gids in range %u-%u",
+                                               mapping->gid_low, mapping->gid_high);
+                                        pthread_mutex_unlock(&mapping->mtx);
                                         return -1;
                                 }
                                 new_map = (union tuple *) malloc(sizeof(union tuple));
                                 new_revmap =
                                         (union tuple *) malloc(sizeof(union tuple));
                                 if (new_map == NULL || new_revmap == NULL) {
-                                        pthread_mutex_unlock(&rbmap.mtx);
+                                        pthread_mutex_unlock(&mapping->mtx);
                                         if (new_map != NULL) (void) free(new_map);
                                         if (new_revmap != NULL) (void) free(new_revmap);
                                         return -1;
                                 }
                                 do_persist = 1;
                                 new_map->g1 = stack->gid;
-                                new_map->g2 = rbmap.gid_next++;
+                                new_map->g2 = mapping->gid_next++;
                                 new_revmap->g1 = new_map->g2;
                                 new_revmap->g2 = new_map->g1;
-                                if (rb_probe(rbmap.gid_map, new_map) == NULL) {
-                                        pthread_mutex_unlock(&rbmap.mtx);
+                                if (rb_probe(mapping->gid_map, new_map) == NULL) {
+                                        pthread_mutex_unlock(&mapping->mtx);
                                         (void) free(new_map);
                                         (void) free(new_revmap);
                                         return -1;
                                 }
-                                if (rb_probe(rbmap.gid_revmap, new_revmap) == NULL) {
-                                        pthread_mutex_unlock(&rbmap.mtx);
-                                        (void) rb_delete(rbmap.gid_map, new_map);
+                                if (rb_probe(mapping->gid_revmap, new_revmap) == NULL) {
+                                        pthread_mutex_unlock(&mapping->mtx);
+                                        (void) rb_delete(mapping->gid_map, new_map);
                                         (void) free(new_map);
                                         (void) free(new_revmap);
                                         return -1;
                                 }
-                                gf_log("map gid", GF_LOG_TRACE,
-                                       "added new gid mapping for %s %u -> %u",
-                                       tenant, stack->gid, new_map->g2);
+                                gf_log(name, RBMAP_LOG_LEVEL,
+                                       "added new gid mapping %u -> %u",
+                                       stack->gid, new_map->g2);
+                                if (mapping->gid_next > mapping->gid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
+                                               "exhausted gids in range %u-%u",
+                                               mapping->gid_low, mapping->gid_high);
+                                }
                         }
                         stack->gid = new_map->g2;
                 }
+                if (do_persist > 0)
+                        rbmap_serialize(mapping);
+                pthread_mutex_unlock(&mapping->mtx);
         } while (0);
-        if (do_persist > 0)
-                rbmap_serialize(tenant);
-        pthread_mutex_unlock(&rbmap.mtx);
 
         return 0;
 }
 
 
 void
-revmap(uid_t *uid, gid_t *gid)
+revmap(uid_t *uid, gid_t *gid, char *name)
 {
-        union tuple *found, needle;
+        union tuple *tuple, tneedle;
+        mapping_t *mapping, mneedle;
+        mneedle.name = name;
+        mapping = (mapping_t *) rb_find(mappings, &mneedle);
+        /* assert(mapping != NULL); */
+        if (mapping == NULL) {
+                return;
+        }
         switch (*uid) {
         case 0:
                 /* break; */
@@ -401,10 +427,10 @@ revmap(uid_t *uid, gid_t *gid)
                 *uid = 0;
                 break;
         default:
-                needle.u1 = *uid;
-                found = (union tuple *) rb_find(rbmap.uid_revmap, &needle);
-                if (found != NULL) {
-                        *uid = found->u2;
+                tneedle.u1 = *uid;
+                tuple = (union tuple *) rb_find(mapping->uid_revmap, &tneedle);
+                if (tuple != NULL) {
+                        *uid = tuple->u2;
                 }
                 break;
         }
@@ -415,10 +441,10 @@ revmap(uid_t *uid, gid_t *gid)
                 *uid = 0;
                 break;
         default:
-                needle.g1 = *gid;
-                found = (union tuple *) rb_find(rbmap.gid_revmap, &needle);
-                if (found != NULL) {
-                        *gid = found->g2;
+                tneedle.g1 = *gid;
+                tuple = (union tuple *) rb_find(mapping->gid_revmap, &tneedle);
+                if (tuple != NULL) {
+                        *gid = tuple->g2;
                 }
                 break;
         }
@@ -452,23 +478,51 @@ rbmap_compare_gid(const void *rb_a, const void *rb_b, void *rb_param)
         return ret;
 }
 
+static int
+rbmap_compare_tenantname(const void *rb_a, const void *rb_b, void *rb_param)
+{
+        mapping_t *needle = (mapping_t *) rb_a;
+        mapping_t *haystack = (mapping_t *) rb_b;
+        return strcmp(haystack->name, needle->name);
+}
+
 
 int32_t
-init(struct _xlator *xlator, char *tenant, uid_t uid_low, uid_t uid_hi, gid_t gid_low, gid_t gid_hi, int root_squash)
+init(struct _xlator *xlator,
+     uid_t uid_low, uid_t uid_high, gid_t gid_low, gid_t gid_high,
+     int root_squash)
 {
-        pthread_mutex_init(&rbmap.mtx, NULL);
-        rbmap.tenant      = strdup(tenant);
-        rbmap.root_squash = root_squash;
-        rbmap.uid_low     = rbmap.uid_next = uid_low;
-        rbmap.uid_high    = uid_hi;
-        rbmap.gid_low     = rbmap.gid_next = gid_low;
-        rbmap.gid_high    = gid_hi;
-        rbmap.uid_map     = rb_create(rbmap_compare_uid, NULL, NULL);
-        rbmap.uid_revmap  = rb_create(rbmap_compare_uid, NULL, NULL);
-        rbmap.gid_map     = rb_create(rbmap_compare_gid, NULL, NULL);
-        rbmap.gid_revmap  = rb_create(rbmap_compare_gid, NULL, NULL);
-
-        return rbmap_deserialize(tenant);
+        mapping_t *newmapping;
+        int ret = 0;
+        pthread_mutex_lock(&mappings_mtx);
+        if (mappings == NULL) {
+                mappings = rb_create(rbmap_compare_tenantname, NULL, NULL);
+        }
+        pthread_mutex_unlock(&mappings_mtx);
+        if (mappings == NULL) {
+                return -1;
+        }
+        newmapping = (mapping_t *) malloc(sizeof(mapping_t));
+        if (newmapping == NULL) {
+                return -1;
+        }
+        pthread_mutex_init(&newmapping->mtx, NULL);
+        newmapping->name        = strdup(xlator->name);
+        newmapping->root_squash = root_squash;
+        newmapping->uid_low     = newmapping->uid_next = uid_low;
+        newmapping->uid_high    = uid_high;
+        newmapping->gid_low     = newmapping->gid_next = gid_low;
+        newmapping->gid_high    = gid_high;
+        newmapping->uid_map     = rb_create(rbmap_compare_uid, NULL, NULL);
+        newmapping->uid_revmap  = rb_create(rbmap_compare_uid, NULL, NULL);
+        newmapping->gid_map     = rb_create(rbmap_compare_gid, NULL, NULL);
+        newmapping->gid_revmap  = rb_create(rbmap_compare_gid, NULL, NULL);
+        if ((ret = rbmap_deserialize(newmapping)) != -1) {
+                pthread_mutex_lock(&mappings_mtx);
+                rb_insert(mappings, newmapping);
+                pthread_mutex_unlock(&mappings_mtx);
+        }
+        return ret;
 }
 
 void
diff --git a/xlators/features/uidmap/src/uidmap.c b/xlators/features/uidmap/src/uidmap.c
index 18dbdaa..9241203 100644
--- a/xlators/features/uidmap/src/uidmap.c
+++ b/xlators/features/uidmap/src/uidmap.c
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2011 Red Hat, Inc.
+ * Copyright 2011 Red Hat, Inc.
  *
  * This file is part of CloudFS.
  *
@@ -39,9 +39,6 @@
 #define CFS_GID_LOW_DEFAULT 10000
 #define CFS_GID_HIGH_DEFAULT 19999
 
-static short uidmap_root_squash = 0;
-static char *uidmap_tenant = NULL;
-
 typedef struct uid_map_entry {
         uid_t me_client_uid;
         uid_t me_server_uid;
@@ -52,22 +49,26 @@ typedef struct gid_map_entry {
         uid_t me_server_gid;
 } gid_map_entry_t;
 
-typedef struct id_mapping {
-        uid_map_entry_t *im_uid_map;
-        unsigned short   im_uid_map_len;
-        uid_t            im_uid_low;
-        uid_t            im_uid_high;
-        uid_t            im_uid_next;
-        gid_map_entry_t *im_gid_map;
-        unsigned short   im_gid_map_len;
-        gid_t            im_gid_low;
-        gid_t            im_gid_high;
-        gid_t            im_gid_next;
-
-        pthread_mutex_t  im_mtx;
-} id_mapping_t;
-
-static id_mapping_t uidmap_mapping = {
+typedef struct {
+        char            *name;
+        uid_map_entry_t *uid_map;
+        unsigned short   uid_map_len;
+        uid_t            uid_low;
+        uid_t            uid_high;
+        uid_t            uid_next;
+        gid_map_entry_t *gid_map;
+        unsigned short   gid_map_len;
+        gid_t            gid_low;
+        gid_t            gid_high;
+        gid_t            gid_next;
+        short            root_squash;
+        pthread_mutex_t  mtx;
+} mapping_t;
+
+static unsigned short uidmap_num_mappings = 0;
+
+static mapping_t* uidmap_mappings; /* = {
+        .im_name        = NULL,
         .im_uid_map     = NULL,
         .im_uid_map_len = 0,
         .im_uid_low     = CFS_UID_LOW_DEFAULT,
@@ -78,8 +79,9 @@ static id_mapping_t uidmap_mapping = {
         .im_gid_low     = CFS_UID_LOW_DEFAULT,
         .im_gid_high    = CFS_UID_HIGH_DEFAULT,
         .im_gid_next    = CFS_UID_LOW_DEFAULT,
+        .im_root_squash = 0,
         .im_mtx         = PTHREAD_MUTEX_INITIALIZER
-};
+}; */
 
 #define CFS_SIGNATURE         "cloudfs map: default\n"
 #define CFS_UID_MAP_ENTRY     "uid_map_entry:"
@@ -103,7 +105,7 @@ static id_mapping_t uidmap_mapping = {
 
 /* serialize and persist */
 static void
-uidmap_serialize_default(char *tenant)
+uidmap_serialize_default(char *tenant, mapping_t *map)
 {
         char fname[128], lkname[128];
         FILE *file = NULL;
@@ -116,47 +118,47 @@ uidmap_serialize_default(char *tenant)
                 unsigned short i;
                 lockfd = open(lkname, O_CREAT|O_WRONLY, 0644);
                 if (lockfd == -1) {
-                        gf_log("serialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_CRITICAL,
                                "open %s: %s", lkname, strerror(errno));
                         break;
                 }
                 status = flock(lockfd, LOCK_EX);
                 if (status == -1) {
-                        gf_log("serialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_CRITICAL,
                                "flock failed %s", strerror(errno));
                         break;
                 }
                 file = fopen(fname, "w");
                 if (file == NULL) {
                         (void) flock(lockfd, LOCK_UN);
-                        gf_log("serialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_CRITICAL,
                                "fopen failed %s", strerror(errno));
                         break;
                 }
                 (void) fprintf(file, CFS_SIGNATURE);
-                for (i = 0; i < uidmap_mapping.im_uid_map_len; i++) {
+                for (i = 0; i < map->uid_map_len; i++) {
                         (void) fprintf(file, "%s %u %u\n",
                                        CFS_UID_MAP_ENTRY,
-                                       uidmap_mapping.im_uid_map[i].me_client_uid,
-                                       uidmap_mapping.im_uid_map[i].me_server_uid);
+                                       map->uid_map[i].me_client_uid,
+                                       map->uid_map[i].me_server_uid);
                 }
                 (void) fprintf(file, "%s %u\n",
-                               CFS_UID_LOW, uidmap_mapping.im_uid_low);
+                               CFS_UID_LOW, map->uid_low);
                 (void) fprintf(file, "%s %u\n",
-                               CFS_UID_HIGH, uidmap_mapping.im_uid_high);
+                               CFS_UID_HIGH, map->uid_high);
                 (void) fprintf(file, "%s %u\n",
-                               CFS_UID_NEXT, uidmap_mapping.im_uid_next);
-                for (i = 0; i < uidmap_mapping.im_gid_map_len; i++) {
+                               CFS_UID_NEXT, map->uid_next);
+                for (i = 0; i < map->gid_map_len; i++) {
                         (void) fprintf(file, "%s %u %u\n", CFS_GID_MAP_ENTRY,
-                                       uidmap_mapping.im_gid_map[i].me_client_gid,
-                                       uidmap_mapping.im_gid_map[i].me_server_gid);
+                                       map->gid_map[i].me_client_gid,
+                                       map->gid_map[i].me_server_gid);
                 }
                 (void) fprintf(file, "%s %u\n", CFS_GID_LOW,
-                               uidmap_mapping.im_gid_low);
+                               map->gid_low);
                 (void) fprintf(file, "%s %u\n", CFS_GID_HIGH,
-                               uidmap_mapping.im_gid_high);
+                               map->gid_high);
                 (void) fprintf(file, "%s %u\n", CFS_GID_NEXT,
-                               uidmap_mapping.im_gid_next);
+                               map->gid_next);
         } while (0);
         if (file != NULL) {
                 (void) fclose(file);
@@ -169,17 +171,15 @@ uidmap_serialize_default(char *tenant)
 
 
 static int
-uidmap_adduidentry(uid_t server_uid, uid_t client_uid)
+uidmap_adduidentry(mapping_t *map, uid_t server_uid, uid_t client_uid)
 {
         uid_map_entry_t *uid_map_entry = NULL;
-        uidmap_mapping.im_uid_map =
-                REALLOC(uidmap_mapping.im_uid_map,
-                        sizeof(uid_map_entry_t) * (uidmap_mapping.im_uid_map_len + 1));
-        if (uidmap_mapping.im_uid_map == NULL) {
+        map->uid_map = REALLOC(map->uid_map,
+                               sizeof(uid_map_entry_t) * (map->uid_map_len + 1));
+        if (map->uid_map == NULL) {
                 return -1;
         }
-        uid_map_entry =
-                &uidmap_mapping.im_uid_map[uidmap_mapping.im_uid_map_len++];
+        uid_map_entry = &map->uid_map[map->uid_map_len++];
         uid_map_entry->me_client_uid = client_uid;
         uid_map_entry->me_server_uid = server_uid;
         return 0;
@@ -187,17 +187,15 @@ uidmap_adduidentry(uid_t server_uid, uid_t client_uid)
 
 
 static int
-uidmap_addgidentry(uid_t server_gid, uid_t client_gid)
+uidmap_addgidentry(mapping_t *map, uid_t server_gid, uid_t client_gid)
 {
         gid_map_entry_t *gid_map_entry = NULL;
-        uidmap_mapping.im_gid_map =
-                REALLOC(uidmap_mapping.im_gid_map,
-                        sizeof(gid_map_entry_t) * (uidmap_mapping.im_gid_map_len + 1));
-        if (uidmap_mapping.im_gid_map == NULL) {
+        map->gid_map = REALLOC(map->gid_map,
+                               sizeof(gid_map_entry_t) * (map->gid_map_len + 1));
+        if (map->gid_map == NULL) {
                 return -1;
         }
-        gid_map_entry =
-                &uidmap_mapping.im_gid_map[uidmap_mapping.im_gid_map_len++];
+        gid_map_entry = &map->gid_map[map->gid_map_len++];
         gid_map_entry->me_client_gid = client_gid;
         gid_map_entry->me_server_gid = server_gid;
         return 0;
@@ -205,7 +203,7 @@ uidmap_addgidentry(uid_t server_gid, uid_t client_gid)
 
 
 static int
-uidmap_readmapfile(FILE *file)
+uidmap_readmapfile(mapping_t *map, FILE *file)
 {
         char* sts;
         char scratch[128];
@@ -216,46 +214,40 @@ uidmap_readmapfile(FILE *file)
                         int num = sscanf(&scratch[CFS_UID_MAP_ENTRY_LEN+1],
                                          " %u %u", &client_uid, &server_uid);
                         if (num == 2) {
-                                if (uidmap_adduidentry(server_uid, client_uid) == -1) {
+                                if (uidmap_adduidentry(map, server_uid, client_uid) == -1) {
                                         return -1;
                                 }
                         }
                 } else if (strncmp(scratch, CFS_UID_LOW, CFS_UID_LOW_LEN) == 0) {
-                        uidmap_mapping.im_uid_low =
-                                (uid_t) strtoul(&scratch[CFS_UID_LOW_LEN+1], NULL, 10);
+                        map->uid_low = (uid_t) strtoul(&scratch[CFS_UID_LOW_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, CFS_UID_HIGH, CFS_UID_HIGH_LEN) == 0) {
-                        uidmap_mapping.im_uid_high =
-                                (uid_t) strtoul(&scratch[CFS_UID_HIGH_LEN+1], NULL, 10);
+                        map->uid_high = (uid_t) strtoul(&scratch[CFS_UID_HIGH_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, CFS_UID_NEXT, CFS_UID_NEXT_LEN) == 0) {
-                        uidmap_mapping.im_uid_next =
-                                (uid_t) strtoul(&scratch[CFS_UID_NEXT_LEN+1], NULL, 10);
+                        map->uid_next = (uid_t) strtoul(&scratch[CFS_UID_NEXT_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, CFS_GID_MAP_ENTRY, CFS_GID_MAP_ENTRY_LEN) == 0) {
                         gid_t server_gid;
                         gid_t client_gid;
                         int num = sscanf(&scratch[CFS_GID_MAP_ENTRY_LEN+1],
                                          " %u %u", &client_gid, &server_gid);
                         if (num == 2) {
-                                if (uidmap_addgidentry(server_gid, client_gid) == -1) {
+                                if (uidmap_addgidentry(map, server_gid, client_gid) == -1) {
                                         return -1;
                                 }
                         }
                 } else if (strncmp(scratch, CFS_GID_LOW, CFS_GID_LOW_LEN) == 0) {
-                        uidmap_mapping.im_gid_low =
-                                (uid_t) strtoul(&scratch[CFS_GID_LOW_LEN+1], NULL, 10);
+                        map->gid_low = (uid_t) strtoul(&scratch[CFS_GID_LOW_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, CFS_GID_HIGH, CFS_GID_HIGH_LEN) == 0) {
-                        uidmap_mapping.im_gid_high =
-                                (uid_t) strtoul(&scratch[CFS_GID_HIGH_LEN+1], NULL, 10);
+                        map->gid_high = (uid_t) strtoul(&scratch[CFS_GID_HIGH_LEN+1], NULL, 10);
                 } else if (strncmp(scratch, CFS_GID_NEXT, CFS_GID_NEXT_LEN) == 0) {
-                        uidmap_mapping.im_gid_next =
-                                (uid_t) strtoul(&scratch[CFS_GID_NEXT_LEN+1], NULL, 10);
+                        map->gid_next = (uid_t) strtoul(&scratch[CFS_GID_NEXT_LEN+1], NULL, 10);
                 }
         }
-	return 0;
+        return 0;
 }
 
 
 static int
-uidmap_deserialize_default(char *tenant)
+uidmap_deserialize_default(char *tenant, uid_t uid_low, uid_t uid_high, gid_t gid_low, gid_t gid_high, short root_squash)
 {
         char fname[128], lkname[128];
         FILE* file = NULL;
@@ -266,38 +258,61 @@ uidmap_deserialize_default(char *tenant)
 
         do {
                 char scratch[128];
+                mapping_t *map;
                 char* sts;
                 int status;
+
+                uidmap_mappings = REALLOC(uidmap_mappings, 
+                                          sizeof(mapping_t) * uidmap_num_mappings);
+                if (uidmap_mappings == NULL) {
+                        break;
+                }
+                map = &uidmap_mappings[uidmap_num_mappings];
+                map->name = strdup(tenant);
+                map->uid_map     = NULL,
+                map->uid_map_len = 0,
+                map->uid_low     = uid_low,
+                map->uid_high    = uid_high,
+                map->uid_next    = uid_low,
+                map->gid_map     = NULL,
+                map->gid_map_len = 0,
+                map->gid_low     = gid_low,
+                map->gid_high    = gid_high,
+                map->gid_next    = gid_low,
+                map->root_squash = root_squash,
+                (void) pthread_mutex_init(&map->mtx, NULL);
+                uidmap_num_mappings++;
+
                 lockfd = open(lkname, O_CREAT|O_RDONLY, 0644);
                 if (lockfd == -1) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_CRITICAL,
                                "open %s: %s", lkname, strerror(errno));
                         break;
                 }
                 status = flock(lockfd, LOCK_EX);
                 if (status == -1) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_CRITICAL,
                                "flock: %s", strerror(errno));
                         break;
                 }
                 file = fopen(fname, "r");
                 if (file == NULL) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_INFO,
                                "fopen failed: %s", strerror(errno));
                         break;
                 }
                 /* read the first line (signature) of the file) */
                 if ((sts = fgets(scratch, sizeof scratch, file)) == (char *) EOF || sts == NULL) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_CRITICAL,
                                "fgets signature failed: %s", strerror(errno));
                         break;
                 }
                 if (strcmp(CFS_SIGNATURE, scratch) != 0) {
-                        gf_log("deserialize", GF_LOG_CRITICAL,
+                        gf_log(tenant, GF_LOG_CRITICAL,
                                "signature mismatch: %s", scratch);
                         break;
                 }
-                ret = uidmap_readmapfile(file);
+                ret = uidmap_readmapfile(map, file);
         } while (0);
         if (file != NULL) {
                 (void) fclose(file);
@@ -311,106 +326,126 @@ uidmap_deserialize_default(char *tenant)
 
 
 static int
-uidmap_map_default(struct _call_stack_t *stack, struct _xlator *xlator)
+uidmap_map_default(struct _call_stack_t *stack, char *name)
 {
-        char *tenant = uidmap_tenant ? uidmap_tenant : "unknown";
+        mapping_t *map = uidmap_mappings;
         int do_persist = 0;
-        if (stack->uid == 0 && uidmap_root_squash) {
+        unsigned short i = 0;
+        /* assert(uid_num_mappings > 0) */
+        for (; i < uidmap_num_mappings; i++, map++) {
+                if (strcmp(map->name, name) == 0) {
+                        break;
+                }
+        }
+        if (stack->uid == 0 && map->root_squash) {
                 stack->uid = stack->gid = CLOUDFS_NOBODY;
                 return 0;
         }
-        pthread_mutex_lock(&uidmap_mapping.im_mtx);
+        pthread_mutex_lock(&map->mtx);
         do {
                 unsigned short index = 0;
                 if (stack->uid != 0) {
                         /* look for an existing match */
                         uid_map_entry_t *uid_map_entry = NULL;
-                        for (; index < uidmap_mapping.im_uid_map_len; index++) {
-                                if (uidmap_mapping.im_uid_map[index].me_client_uid == stack->uid) {
-                                        uid_map_entry = &uidmap_mapping.im_uid_map[index];
+                        for (; index < map->uid_map_len; index++) {
+                                if (map->uid_map[index].me_client_uid == stack->uid) {
+                                        uid_map_entry = &map->uid_map[index];
                                         break;
                                 }
                         }
                         if (uid_map_entry == NULL) {
                                 /* couldn't find one, make a new one */
-                                if (uidmap_mapping.im_uid_next > uidmap_mapping.im_uid_high) {
-                                        gf_log("map uid", GF_LOG_CRITICAL,
-                                               "exhausted uids in range %u-%u",
-                                               uidmap_mapping.im_uid_low,
-                                               uidmap_mapping.im_uid_high);
-                                        pthread_mutex_unlock(&uidmap_mapping.im_mtx);
+                                if (map->uid_next > map->uid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
+                                               "no uids in range %u-%u",
+                                               map->uid_low, map->uid_high);
+                                        pthread_mutex_unlock(&map->mtx);
                                         return -1;
                                 }
-                                uid_map_entry_t *tmpmap = REALLOC(uidmap_mapping.im_uid_map, sizeof(uid_map_entry_t) * (uidmap_mapping.im_uid_map_len + 1));
+                                uid_map_entry_t *tmpmap =
+                                        REALLOC(map->uid_map, sizeof(uid_map_entry_t) * (map->uid_map_len + 1));
                                 if (tmpmap == NULL) {
-                                        pthread_mutex_unlock(&uidmap_mapping.im_mtx);
+                                        pthread_mutex_unlock(&map->mtx);
                                         return -1;
                                 }
                                 do_persist = 1;
-                                uidmap_mapping.im_uid_map = tmpmap;
-                                uid_map_entry = &uidmap_mapping.im_uid_map[uidmap_mapping.im_uid_map_len++];
+                                map->uid_map = tmpmap;
+                                uid_map_entry = &map->uid_map[map->uid_map_len++];
                                 uid_map_entry->me_client_uid = stack->uid;
-                                uid_map_entry->me_server_uid = uidmap_mapping.im_uid_next++;
-                                gf_log("map uid", GF_LOG_TRACE,
-                                       "added new uid mapping for %s %u -> %u",
-                                       tenant, stack->uid, uid_map_entry->me_server_uid);
+                                uid_map_entry->me_server_uid = map->uid_next++;
+                                gf_log(name, CFS_LOG_LEVEL,
+                                       "added new uid mapping %u -> %u",
+                                       stack->uid, uid_map_entry->me_server_uid);
+                                if (map->uid_next > map->uid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
+                                               "exhausted uids in range %u-%u",
+                                               map->uid_low, map->uid_high);
+                                }
                         }
                         stack->uid = uid_map_entry->me_server_uid;
                 }
                 if (stack->gid != 0) {
                         gid_map_entry_t *gid_map_entry = NULL;
-                        for (index = 0; index < uidmap_mapping.im_gid_map_len; index++) {
-                                if (uidmap_mapping.im_gid_map[index].me_client_gid == stack->gid) {
-                                        gid_map_entry = &uidmap_mapping.im_gid_map[index];
+                        for (index = 0; index < map->gid_map_len; index++) {
+                                if (map->gid_map[index].me_client_gid == stack->gid) {
+                                        gid_map_entry = &map->gid_map[index];
                                         break;
                                 }
                         }
                         if (gid_map_entry == NULL) {
                                 /* couldn't find one, make a new one */
-                                if (uidmap_mapping.im_gid_next > uidmap_mapping.im_gid_high) {
-                                        gf_log("map uid", GF_LOG_CRITICAL,
-                                               "exhausted gids in range %u-%u",
-                                               uidmap_mapping.im_gid_low,
-                                               uidmap_mapping.im_gid_high);
-                                        pthread_mutex_unlock(&uidmap_mapping.im_mtx);
+                                if (map->gid_next > map->gid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
+                                               "no gids in range %u-%u",
+                                               map->gid_low, map->gid_high);
+                                        pthread_mutex_unlock(&map->mtx);
                                         return -1;
                                 }
-                                gid_map_entry_t *tmpmap = REALLOC(uidmap_mapping.im_gid_map, sizeof(gid_map_entry_t) * (uidmap_mapping.im_gid_map_len + 1));
+                                gid_map_entry_t *tmpmap =
+                                        REALLOC(map->gid_map, sizeof(gid_map_entry_t) * (map->gid_map_len + 1));
                                 if (tmpmap == NULL) {
-                                        pthread_mutex_unlock(&uidmap_mapping.im_mtx);
+                                        pthread_mutex_unlock(&map->mtx);
                                         return -1;
                                 }
                                 do_persist = 1;
-                                uidmap_mapping.im_gid_map = tmpmap;
-                                gid_map_entry = &uidmap_mapping.im_gid_map[uidmap_mapping.im_gid_map_len++];
+                                map->gid_map = tmpmap;
+                                gid_map_entry = &map->gid_map[map->gid_map_len++];
                                 gid_map_entry->me_client_gid = stack->gid;
-                                gid_map_entry->me_server_gid = uidmap_mapping.im_gid_next++;
-                                gf_log("map gid", GF_LOG_TRACE,
-                                       "added new gid mapping for %s %u -> %u",
-                                       tenant, stack->gid, gid_map_entry->me_server_gid);
-                                if (uidmap_mapping.im_gid_next > uidmap_mapping.im_gid_high) {
-                                        gf_log("map gid", GF_LOG_CRITICAL,
+                                gid_map_entry->me_server_gid = map->gid_next++;
+                                gf_log(name, CFS_LOG_LEVEL,
+                                       "added new gid mapping %u -> %u",
+                                       stack->gid, gid_map_entry->me_server_gid);
+                                if (map->gid_next > map->gid_high) {
+                                        gf_log(name, GF_LOG_CRITICAL,
                                                "exhausted gids in range %u-%u",
-                                               uidmap_mapping.im_gid_low,
-                                               uidmap_mapping.im_gid_high);
+                                               map->gid_low, map->gid_high);
                                 }
                         }
                         stack->gid = gid_map_entry->me_server_gid;
                 }
         } while (0);
         if (do_persist > 0)
-                uidmap_serialize_default(tenant);
-        pthread_mutex_unlock(&uidmap_mapping.im_mtx);
+                uidmap_serialize_default(name, map);
+        pthread_mutex_unlock(&map->mtx);
         return 0;
 }
 
 
 static void
-uidmap_revmap_default(uid_t *uid, gid_t *gid)
+uidmap_revmap_default(uid_t *uid, gid_t *gid, char *name)
 {
-        unsigned int index = 0;
         uid_map_entry_t *uid_map_entry;
         gid_map_entry_t *gid_map_entry;
+        mapping_t *map = uidmap_mappings;
+        unsigned int index = 0;
+        unsigned short i = 0;
+
+        /* assert(uid_num_mappings > 0) */
+        for (; i < uidmap_num_mappings; i++, map++) {
+                if (strcmp(map->name, name) == 0) {
+                        break;
+                }
+        }
 
         switch (*uid) {
         case 0:
@@ -419,8 +454,8 @@ uidmap_revmap_default(uid_t *uid, gid_t *gid)
                 *uid = 0;
                 break;
         default:
-                uid_map_entry = uidmap_mapping.im_uid_map;
-                for (; index < uidmap_mapping.im_uid_map_len; index++, uid_map_entry++) {
+                uid_map_entry = map->uid_map;
+                for (; index < map->uid_map_len; index++, uid_map_entry++) {
                         if (*uid == uid_map_entry->me_server_uid)
                                 *uid = uid_map_entry->me_client_uid;
                 }
@@ -433,8 +468,8 @@ uidmap_revmap_default(uid_t *uid, gid_t *gid)
                 *uid = 0;
                 break;
         default:
-                gid_map_entry = uidmap_mapping.im_gid_map;
-                for (index = 0; index < uidmap_mapping.im_gid_map_len; index++, gid_map_entry++) {
+                gid_map_entry = map->gid_map;
+                for (index = 0; index < map->gid_map_len; index++, gid_map_entry++) {
                         if (*gid == gid_map_entry->me_server_gid)
                                 *gid = gid_map_entry->me_client_gid;
                 }
@@ -458,10 +493,10 @@ uidmap_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(create, frame, op_ret, op_errno, fd, inode, buf,
                              preparent, postparent);
@@ -491,8 +526,8 @@ uidmap_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(stat, frame, op_ret, op_errno, buf);
         return 0;
@@ -508,8 +543,8 @@ uidmap_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(readv, frame, op_ret, op_errno, vector, count,
                              buf, iobref);
@@ -526,9 +561,9 @@ uidmap_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid);
-        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(writev, frame, op_ret, op_errno, prebuf, postbuf);
         return 0;
@@ -546,11 +581,11 @@ uidmap_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64" :(op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid);
+        (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid, this->name);
         list_for_each_entry(entry, &buf->list, list) {
-                (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid);
+                (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid, this->name);
         }
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(readdir, frame, op_ret, op_errno, buf);
 
@@ -568,11 +603,11 @@ uidmap_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64" :(op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid);
+        (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid, this->name);
         list_for_each_entry(entry, &buf->list, list) {
-                (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid);
+                (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid, this->name);
         }
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(readdirp, frame, op_ret, op_errno, buf);
 
@@ -589,9 +624,9 @@ uidmap_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid);
-        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(fsync, frame, op_ret, op_errno, prebuf, postbuf);
 
@@ -608,9 +643,9 @@ uidmap_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid);
-        (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid, this->name);
+        (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(setattr, frame, op_ret, op_errno, statpre, statpost);
         return 0;
@@ -626,9 +661,9 @@ uidmap_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid);
-        (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid, this->name);
+        (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(fsetattr, frame, op_ret, op_errno,
                              statpre, statpost);
@@ -645,9 +680,9 @@ uidmap_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(unlink, frame, op_ret, op_errno,
                              preparent, postparent);
@@ -665,12 +700,12 @@ uidmap_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&preoldparent->ia_uid, &preoldparent->ia_gid);
-        (*uidmap_revmap)(&postoldparent->ia_uid, &postoldparent->ia_gid);
-        (*uidmap_revmap)(&prenewparent->ia_uid, &prenewparent->ia_gid);
-        (*uidmap_revmap)(&postnewparent->ia_uid, &postnewparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&preoldparent->ia_uid, &preoldparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postoldparent->ia_uid, &postoldparent->ia_gid, this->name);
+        (*uidmap_revmap)(&prenewparent->ia_uid, &prenewparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postnewparent->ia_uid, &postnewparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(rename, frame, op_ret, op_errno, buf,
                              preoldparent, postoldparent,
@@ -688,8 +723,8 @@ uidmap_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&stbuf->ia_uid, &stbuf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&stbuf->ia_uid, &stbuf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(readlink, frame, op_ret, op_errno, buf, stbuf);
         return 0;
@@ -706,9 +741,9 @@ uidmap_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(lookup, frame, op_ret, op_errno, inode, buf,
                              xattr, postparent);
@@ -726,10 +761,10 @@ uidmap_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(symlink, frame, op_ret, op_errno, inode, buf,
                              preparent, postparent);
@@ -747,10 +782,10 @@ uidmap_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(mknod, frame, op_ret, op_errno, inode, buf,
                              preparent, postparent);
@@ -768,10 +803,10 @@ uidmap_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(mkdir, frame, op_ret, op_errno, inode, buf,
                              preparent, postparent);
@@ -789,10 +824,10 @@ uidmap_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(link, frame, op_ret, op_errno, inode, buf,
                              preparent, postparent);
@@ -835,9 +870,9 @@ uidmap_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid);
-        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+        (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(rmdir, frame, op_ret, op_errno,
                              preparent, postparent);
@@ -854,9 +889,9 @@ uidmap_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid);
-        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(truncate, frame, op_ret, op_errno, prebuf, postbuf);
         return 0;
@@ -952,9 +987,9 @@ uidmap_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid);
-        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+        (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(ftruncate, frame, op_ret, op_errno, prebuf, postbuf);
         return 0;
@@ -969,8 +1004,8 @@ uidmap_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid);
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(fstat, frame, op_ret, op_errno, buf);
         return 0;
@@ -987,9 +1022,9 @@ uidmap_lk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
                "%"PRId64": (op_ret=%d, op_errno=%d)",
                frame->root->unique, op_ret, op_errno);
 
-        (*uidmap_revmap)(&uid, &gid);
+        (*uidmap_revmap)(&uid, &gid, this->name);
         lock->l_owner = uid;
-        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid);
+        (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
 
         STACK_UNWIND_STRICT(lk, frame, op_ret, op_errno, lock);
         return 0;
@@ -1086,7 +1121,7 @@ uidmap_entrylk(call_frame_t *frame, xlator_t *this,
                ((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"),
                ((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK"));
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_entrylk_cbk,
@@ -1108,7 +1143,7 @@ uidmap_fentrylk(call_frame_t *frame, xlator_t *this,
                ((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"),
                ((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK"));
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_fentrylk_cbk,
@@ -1123,7 +1158,7 @@ int
 uidmap_inodelk(call_frame_t *frame, xlator_t *this, const char *volume,
               loc_t *loc, int32_t cmd, struct gf_flock *flock)
 {
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_inodelk_cbk,
@@ -1142,7 +1177,7 @@ uidmap_finodelk(call_frame_t *frame, xlator_t *this, const char *volume,
                "%"PRId64": (volume=%s, fd=%p, cmd=%d)",
                frame->root->unique, volume, fd, cmd);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_finodelk_cbk,
@@ -1161,7 +1196,7 @@ uidmap_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc,
                "%"PRId64": (path=%s, ino=%"PRIu64" flags=%d)",
                frame->root->unique, loc->path, loc->inode->ino, flags);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_xattrop_cbk,
@@ -1181,7 +1216,7 @@ uidmap_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
                "%"PRId64": (fd=%p, flags=%d)",
                frame->root->unique, fd, flags);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_fxattrop_cbk,
@@ -1203,7 +1238,7 @@ uidmap_lookup(call_frame_t *frame, xlator_t *this,
                frame->root->unique, loc->path,
                loc->inode->ino);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_lookup_cbk,
@@ -1222,7 +1257,7 @@ uidmap_stat(call_frame_t *frame, xlator_t *this, loc_t *loc)
                "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
                frame->root->unique, loc->path, loc->inode->ino);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_stat_cbk,
@@ -1241,7 +1276,7 @@ uidmap_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size)
                "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, size=%"GF_PRI_SIZET")",
                frame->root->unique, loc->path, loc->inode->ino, size);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_readlink_cbk,
@@ -1261,7 +1296,7 @@ uidmap_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc,
                "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, mode=%d, dev=%"GF_PRI_DEV")",
                frame->root->unique, loc->path, loc->inode->ino, mode, dev);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_mknod_cbk,
@@ -1282,7 +1317,7 @@ uidmap_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
                frame->root->unique, loc->path,
                ((loc->inode)? loc->inode->ino : 0), mode);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_mkdir_cbk,
@@ -1300,7 +1335,7 @@ uidmap_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc)
                "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
                frame->root->unique, loc->path, loc->inode->ino);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_unlink_cbk,
@@ -1318,7 +1353,7 @@ uidmap_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
                "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=%d)",
                frame->root->unique, loc->path, loc->inode->ino, flags);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_rmdir_cbk,
@@ -1339,7 +1374,7 @@ uidmap_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath,
                frame->root->unique, linkpath, loc->path,
                ((loc->inode)? loc->inode->ino : 0));
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_symlink_cbk,
@@ -1360,7 +1395,7 @@ uidmap_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
                frame->root->unique, oldloc->path, oldloc->ino,
                newloc->path, newloc->ino);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_rename_cbk,
@@ -1381,7 +1416,7 @@ uidmap_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
                frame->root->unique, oldloc->path, oldloc->inode->ino,
                newloc->path, newloc->inode->ino);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_link_cbk,
@@ -1400,7 +1435,7 @@ uidmap_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
                "%"PRId64": loc {path=%s, ino=%"PRIu64"}, valid=%d",
                frame->root->unique, loc->path, loc->inode->ino, valid);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_setattr_cbk,
@@ -1420,7 +1455,7 @@ uidmap_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
                "%"PRId64": (fd=%p, valid=%d)",
                frame->root->unique, fd, valid);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_fsetattr_cbk,
@@ -1440,7 +1475,7 @@ uidmap_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc,
                "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, offset=%"PRId64")",
                frame->root->unique, loc->path, loc->inode->ino, offset);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_truncate_cbk,
@@ -1462,7 +1497,7 @@ uidmap_open(call_frame_t *frame, xlator_t *this, loc_t *loc,
                frame->root->unique, loc->path, loc->inode->ino, flags,
                fd, wbflags);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_open_cbk,
@@ -1481,7 +1516,7 @@ uidmap_create(call_frame_t *frame, xlator_t *this, loc_t *loc,
                "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=0%o mode=0%o)",
                frame->root->unique, loc->path, loc->inode->ino, flags, mode);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_create_cbk,
@@ -1500,7 +1535,7 @@ uidmap_readv(call_frame_t *frame, xlator_t *this, fd_t *fd,
                "%"PRId64": (*fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
                frame->root->unique, fd, size, offset);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_readv_cbk,
@@ -1520,7 +1555,7 @@ uidmap_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
                "%"PRId64": (*fd=%p, *vector=%p, count=%d, offset=%"PRId64")",
                frame->root->unique, fd, vector, count, offset);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_writev_cbk,
@@ -1539,7 +1574,7 @@ uidmap_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc)
                frame->root->unique, loc->path,
                ((loc->inode)? loc->inode->ino : 0));
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_statfs_cbk,
@@ -1556,7 +1591,7 @@ uidmap_flush(call_frame_t *frame, xlator_t *this, fd_t *fd)
         gf_log(this->name, CFS_LOG_LEVEL,
                "%"PRId64": (*fd=%p)", frame->root->unique, fd);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_flush_cbk,
@@ -1573,7 +1608,7 @@ uidmap_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags)
         gf_log(this->name, CFS_LOG_LEVEL,
                "%"PRId64": (flags=%d, *fd=%p)", frame->root->unique, flags, fd);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_fsync_cbk,
@@ -1593,7 +1628,7 @@ uidmap_setxattr(call_frame_t *frame, xlator_t *this,
                frame->root->unique, loc->path,
                ((loc->inode)? loc->inode->ino : 0), dict, flags);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_setxattr_cbk,
@@ -1613,7 +1648,7 @@ uidmap_getxattr(call_frame_t *frame, xlator_t *this,
                frame->root->unique, loc->path,
                ((loc->inode)? loc->inode->ino : 0), name);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_getxattr_cbk,
@@ -1633,7 +1668,7 @@ uidmap_removexattr(call_frame_t *frame, xlator_t *this,
                frame->root->unique, loc->path,
                ((loc->inode)? loc->inode->ino : 0), name);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_removexattr_cbk,
@@ -1652,7 +1687,7 @@ uidmap_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
                "%"PRId64":( loc {path=%s, ino=%"PRIu64"}, fd=%p)",
                frame->root->unique, loc->path, loc->inode->ino, fd);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_opendir_cbk,
@@ -1670,7 +1705,7 @@ uidmap_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
                "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
                frame->root->unique, fd, size, offset);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_readdirp_cbk,
@@ -1690,7 +1725,7 @@ uidmap_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd,
                "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
                frame->root->unique, fd, size, offset);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_readdir_cbk,
@@ -1710,7 +1745,7 @@ uidmap_fsyncdir(call_frame_t *frame, xlator_t *this,
                "%"PRId64": (datasync=%d, *fd=%p)",
                frame->root->unique, datasync, fd);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_fsyncdir_cbk,
@@ -1729,7 +1764,7 @@ uidmap_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask)
                frame->root->unique, loc->path,
                ((loc->inode)? loc->inode->ino : 0), mask);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_access_cbk,
@@ -1748,7 +1783,7 @@ uidmap_ftruncate(call_frame_t *frame, xlator_t *this,
                "%"PRId64": (offset=%"PRId64", *fd=%p)",
                frame->root->unique, offset, fd);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_ftruncate_cbk,
@@ -1766,7 +1801,7 @@ uidmap_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd)
         gf_log(this->name, CFS_LOG_LEVEL,
                "%"PRId64": (*fd=%p)", frame->root->unique, fd);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_fstat_cbk,
@@ -1787,7 +1822,7 @@ uidmap_lk(call_frame_t *frame, xlator_t *this, fd_t *fd,
                frame->root->unique, fd, cmd, lock->l_type, lock->l_whence,
                lock->l_start, lock->l_len, lock->l_pid);
 
-        if ((*uidmap_map)(frame->root, this) == -1)
+        if ((*uidmap_map)(frame->root, this->name) == -1)
                 return -1;
 
         STACK_WIND(frame, uidmap_lk_cbk,
@@ -1831,32 +1866,29 @@ uidmap_loadsharedlib(char* xltrname, char *libname)
                 } while (0);
 
                 if (dlclose(handle)) {
-                        gf_log(xltrname, GF_LOG_ERROR,
+                        gf_log(xltrname, CFS_LOG_LEVEL,
                                "dlclose plugin: %s", dlerror());
                 }
         }
-	return plugin_init;
+        return plugin_init;
 }
 
 int32_t
 init(xlator_t *this)
 {
         char *uid_range = NULL, *gid_range = NULL;
-        char *root_squash    = NULL;
-        char *plugin         = NULL;
-        char *tenant         = NULL;
-        init_fn plugin_init  = NULL;
-        uid_t uidmap_low_uid = CFS_UID_LOW_DEFAULT;
-        uid_t uidmap_hi_uid  = CFS_UID_HIGH_DEFAULT;
-        gid_t uidmap_low_gid = CFS_UID_LOW_DEFAULT;
-        gid_t uidmap_hi_gid  = CFS_UID_HIGH_DEFAULT;
+        char *plugin        = NULL;
+        init_fn plugin_init = NULL;
+        uid_t low_uid       = CFS_UID_LOW_DEFAULT;
+        uid_t high_uid      = CFS_UID_HIGH_DEFAULT;
+        gid_t low_gid       = CFS_UID_LOW_DEFAULT;
+        gid_t high_gid      = CFS_UID_HIGH_DEFAULT;
+        short root_squash   = 0;
         data_t *data;
 
         if (!this)
                 return -1;
 
-        /* gf_log_set_loglevel(GF_LOG_NORMAL); */
-
         if (!this->children || this->children->next) {
                 gf_log(this->name, GF_LOG_ERROR,
                        "uidmap translator requires one subvolume");
@@ -1870,12 +1902,10 @@ init(xlator_t *this)
         if ((data = dict_get(this->options, "uid-range")) != NULL) {
                 uid_range = data_to_str(data);
                 if (uid_range != NULL && *uid_range != 0) {
-                        uid_t low, hi;
-                        if (sscanf(uid_range, "%u-%u", &low, &hi) == 2) {
-                                uidmap_low_uid = low; uidmap_hi_uid = hi;
-                                uidmap_mapping.im_uid_low =
-                                        uidmap_mapping.im_uid_next = low;
-                                uidmap_mapping.im_uid_high = hi;
+                        if (sscanf(uid_range, "%u-%u", &low_uid, &high_uid) == 2) {
+                        /*      uidmap_mapping.uid_low =
+                                        uidmap_mapping.uid_next = low;
+                                uidmap_mapping.uid_high = hi; */
                         } else {
                                 gf_log(this->name, GF_LOG_ERROR,
                                        "invalid uid-range in config");
@@ -1890,12 +1920,10 @@ init(xlator_t *this)
         if ((data = dict_get(this->options, "gid-range")) != NULL) {
                 gid_range = data_to_str(data);
                 if (gid_range != NULL && *gid_range != 0) {
-                        gid_t low, hi;
-                        if (sscanf(gid_range, "%u-%u", &low, &hi) == 2) {
-                                uidmap_low_gid = low; uidmap_hi_gid = hi;
-                                uidmap_mapping.im_gid_low =
-                                        uidmap_mapping.im_gid_next = low;
-                                uidmap_mapping.im_gid_high = hi;
+                        if (sscanf(gid_range, "%u-%u", &low_gid, &high_gid) == 2) {
+                        /*      uidmap_mapping.gid_low =
+                                        uidmap_mapping.gid_next = low;
+                                uidmap_mapping.gid_high = hi; */
                         } else {
                                 gf_log(this->name, GF_LOG_ERROR,
                                        "invalid gid-range in config");
@@ -1908,35 +1936,23 @@ init(xlator_t *this)
         }
 
         if ((data = dict_get(this->options, "root-squash")) != NULL) {
-                root_squash = data_to_str(data);
-                if (root_squash != NULL && *root_squash != 0) {
-                        char* ptr = root_squash;
+                char *rt_sqsh = data_to_str(data);
+                if (rt_sqsh != NULL && *rt_sqsh != 0) {
+                        char* ptr = rt_sqsh;
                         for (; *ptr != 0; ptr++)
                                 *ptr = tolower(*ptr);
-                        if (strcmp(root_squash, "yes") == 0)
-                                uidmap_root_squash = 1;
+                        if (strcmp(rt_sqsh, "yes") == 0)
+                                root_squash = 1;
                 }
         }
 
-        if ((data = dict_get(this->options, "tenant")) != NULL) {
-                tenant = data_to_str(data);
-                if (tenant != NULL) {
-                    uidmap_tenant = strdup(tenant);
-                }
-        } else {
-                gf_log(this->name, GF_LOG_ERROR,
-                       "you must specify a tenant name in the config");
-                return -1;
-        }
-
         if ((data = dict_get(this->options, "uidmap-plugin")) != NULL) {
                 plugin = data_to_str(data);
                 if (plugin != NULL && *plugin != 0) {
                         if ((plugin_init = uidmap_loadsharedlib(this->name, plugin)) != NULL) {
-                                if ((*plugin_init)(this, uidmap_tenant,
-                                                   uidmap_low_uid, uidmap_hi_uid,
-                                                   uidmap_low_gid, uidmap_hi_gid,
-                                                   uidmap_root_squash) != 0) {
+                                if ((*plugin_init)(this, low_uid, high_uid,
+                                                   low_gid, high_gid,
+                                                   root_squash) != 0) {
                                         gf_log(this->name, GF_LOG_CRITICAL,
                                                "plugin init error");
                                 }
@@ -1944,8 +1960,9 @@ init(xlator_t *this)
                 }
         }
         if (uidmap_map == NULL) {
-            if (uidmap_deserialize_default(uidmap_tenant ? uidmap_tenant : "unknown") == -1)
+            if (uidmap_deserialize_default(this->name, low_uid, high_uid, low_gid, high_gid, root_squash) == -1)
                     return -1;
+            uidmap_serialize_default(this->name, uidmap_mappings);
             uidmap_map = uidmap_map_default;
             uidmap_revmap = uidmap_revmap_default;
         }
@@ -2019,9 +2036,6 @@ struct volume_options options[] = {
           .type = GF_OPTION_TYPE_STR,
           .value = { "yes", "no"}
         },
-        { .key  = {"tenant"},
-          .type = GF_OPTION_TYPE_STR
-        },
         { .key  = {"uid-range"},
           .type = GF_OPTION_TYPE_STR,
         },
diff --git a/xlators/features/uidmap/src/uidmap.h b/xlators/features/uidmap/src/uidmap.h
index 5de9322..d4d0dfb 100644
--- a/xlators/features/uidmap/src/uidmap.h
+++ b/xlators/features/uidmap/src/uidmap.h
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2011 Red Hat, Inc.
+ * Copyright 2011 Red Hat, Inc.
  *
  * This file is part of CloudFS.
  *
@@ -22,9 +22,9 @@
 
 #include <sys/types.h>
 
-typedef int (* map_fn)(struct _call_stack_t *, struct _xlator *);
-typedef void (* revmap_fn)(uid_t *, gid_t *);
-typedef int32_t (* init_fn)(struct _xlator *, char *, uid_t, uid_t, gid_t, gid_t, int);
+typedef int (* map_fn)(struct _call_stack_t *, char *);
+typedef void (* revmap_fn)(uid_t *, gid_t *, char *);
+typedef int32_t (* init_fn)(struct _xlator *, uid_t, uid_t, gid_t, gid_t, int);
 typedef void (* fini_fn)(struct _xlator *);
 
 #define UIDMAP_MAP_LOCK_FILE "/var/lib/cloudfs/map_%s.lck"




More information about the cloudfs-devel mailing list