diff --git a/lustre/include/lustre_param.h b/lustre/include/lustre_param.h
index 429c9e9be86facfc918841abf377deee1fb0f720..281cf6e52100e7aace29d463efd4614bceeb7aca 100644
--- a/lustre/include/lustre_param.h
+++ b/lustre/include/lustre_param.h
@@ -52,6 +52,7 @@ int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
 #define PARAM_FAILNODE             "failover.node="    /* llog generation */
 #define PARAM_FAILMODE             "failover.mode="    /* llog generation */
 #define PARAM_ACTIVE               "active="           /* llog generation */
+#define PARAM_MDT_UPCALL           "mdt.group_upcall=" /* mds group upcall */
 
 /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
 #define PARAM_OST                  "ost."
diff --git a/lustre/tests/cfg/insanity-local.sh b/lustre/tests/cfg/insanity-local.sh
index e3f40877fab7b439ad287d722fc13d14d068e107..527b7c51aadfd5e1ae6b719f7e2485c9b4ee5abc 100644
--- a/lustre/tests/cfg/insanity-local.sh
+++ b/lustre/tests/cfg/insanity-local.sh
@@ -41,6 +41,8 @@ MOUNTOPT=""
     MOUNTOPT=$MOUNTOPT" --param lov.stripesize=$STRIPE_BYTES"
 [ "x$STRIPES_PER_OBJ" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --param lov.stripecount=$STRIPES_PER_OBJ"
+[ "x$LUSTRE" != "x" ] &&
+    MOUNTOPT=$MOUNTOPT"  --param mdt.group_upcall=$LUSTRE/utils/l_getgroups" 
 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$MDSSIZE --param sys.timeout=$TIMEOUT $MKFSOPT $MOUNTOPT $MDSOPT"
 
 MKFSOPT=""
diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh
index 92966b1fb979420a2129a2abd94b9476dac9f424..6f69df4c4babfc2050d7e291209aedbdffff72f6 100644
--- a/lustre/tests/cfg/local.sh
+++ b/lustre/tests/cfg/local.sh
@@ -45,6 +45,8 @@ MOUNTOPT=""
     MOUNTOPT=$MOUNTOPT" --param lov.stripesize=$STRIPE_BYTES"
 [ "x$STRIPES_PER_OBJ" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --param lov.stripecount=$STRIPES_PER_OBJ"
+[ "x$LUSTRE" != "x" ] &&
+    MOUNTOPT=$MOUNTOPT" --param mdt.group_upcall=$LUSTRE/utils/l_getgroups"
 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$MDSSIZE --param sys.timeout=$TIMEOUT $MKFSOPT $MOUNTOPT $MDSOPT"
 
 MKFSOPT=""
diff --git a/lustre/tests/cfg/lov.sh b/lustre/tests/cfg/lov.sh
index 56ca580c7efe9b353e07aba05761d915f9e55c5d..7acff2f3cf43ae13688fd29426bff036bef81288 100644
--- a/lustre/tests/cfg/lov.sh
+++ b/lustre/tests/cfg/lov.sh
@@ -39,6 +39,8 @@ MOUNTOPT=""
     MOUNTOPT=$MOUNTOPT" --param lov.stripesize=$STRIPE_BYTES"
 [ "x$STRIPES_PER_OBJ" != "x" ] &&
     MOUNTOPT=$MOUNTOPT" --param lov.stripecount=$STRIPES_PER_OBJ"
+[ "x$LUSTRE" != "x" ] &&
+    MOUNTOPT=$MOUNTOPT" --param mdt.group_upcall=$LUSTRE/utils/l_getgroups"
 MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$MDSSIZE --param sys.timeout=$TIMEOUT $MKFSOPT $MOUNTOPT $MDSOPT"
 
 MKFSOPT=""
diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 262e470504e12f7fd4213bbe104117d86e961de8..ff534fcdc9e9c9e7305b583c745f9aa7963b3443 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -135,6 +135,8 @@ MAXFREE=${MAXFREE:-$((200000 * $OSTCOUNT))}
 [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo
 rm -rf $DIR/[Rdfs][1-9]*
 
+$RUNAS ls $DIR >/dev/null 2>&1 || { echo "Error: uid $RUNAS_ID doesn't exist on MDS!"; exit 1; }
+
 build_test_filter
 
 echo "preparing for tests involving mounts"
@@ -2837,7 +2839,7 @@ test_72() { # bug 5695 - Test that on 2.6 remove_suid works properly
 	touch $DIR/f72
 	chmod 777 $DIR/f72
 	chmod ug+s $DIR/f72
-	$RUNAS -u $(($RUNAS_ID + 1)) dd if=/dev/zero of=$DIR/f72 bs=512 count=1 || error
+	$RUNAS dd if=/dev/zero of=$DIR/f72 bs=512 count=1 || error
 	# See if we are still setuid/sgid
 	test -u $DIR/f72 -o -g $DIR/f72 && error "S/gid is not dropped on write"
 	# Now test that MDS is updated too
diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c
index 29e95ddeca78e11f1216c4e14c7a21169102d210..da732f74efeced1dc43bd5d07ac047a4b16c87df 100644
--- a/lustre/utils/mkfs_lustre.c
+++ b/lustre/utils/mkfs_lustre.c
@@ -927,14 +927,42 @@ static inline void badopt(const char *opt, char *type)
         usage(stderr);
 }
 
+static int clean_param(char *buf, char *key)
+{
+        char *sub, *next;
+
+        if (!buf)
+                return 1;
+        if ((sub = strstr(buf, key)) != NULL) {
+                if ((next = strchr(sub, ' ')) != NULL) {
+                        next++;
+                        memmove(sub, next, strlen(next) + 1);
+                } else {
+                        *sub = '\0';
+                }
+        }
+        return 0;
+} 
+
 static int add_param(char *buf, char *key, char *val)
 {
         int end = sizeof(((struct lustre_disk_data *)0)->ldd_params);
-        int start = strlen(buf);
+        int start;
         int keylen = 0;
+        char *ptr;
 
-        if (key)
+        if (key) {
                 keylen = strlen(key);
+                clean_param(buf, key);
+        } else {
+                if((ptr = strchr(val, '=')) == NULL)
+                        return 1;
+                *ptr = '\0';
+                clean_param(buf, val);
+                *ptr = '=';
+        }
+                
+        start = strlen(buf);
         if (start + 1 + keylen + strlen(val) >= end) {
                 fprintf(stderr, "%s: params are too long-\n%s %s%s\n",
                         progname, buf, key ? key : "", val);
@@ -1021,6 +1049,8 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
         char *optstring = "b:c:C:d:ef:Ghi:k:L:m:MnNo:Op:Pqru:vw";
         int opt;
         int rc, longidx;
+        int upcall = 0;
+        const size_t prefix_len = sizeof(PARAM_MDT_UPCALL) - 1;
 
         while ((opt = getopt_long(argc, argv, optstring, long_opt, &longidx)) !=
                EOF) {
@@ -1159,6 +1189,18 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
                         mop->mo_ldd.ldd_flags |= LDD_F_SV_TYPE_OST;
                         break;
                 case 'p':
+                        /* Test if the param is valid for mdt.group_upcall */
+                        if (!strncmp(optarg, PARAM_MDT_UPCALL, prefix_len)) {
+                                upcall++;
+                                if(strcmp(optarg + prefix_len, "NONE") &&
+                                   access(optarg + prefix_len, R_OK | X_OK))
+                                        fprintf(stderr, "WARNING: group upcall "
+                                                "parameter not executable: %s\n"
+                                                "NOTE: you can change the path "
+                                                "to the group upcall through "
+                                                "tunefs.lustre(8)\n", optarg + 
+                                                prefix_len);
+                        }
                         rc = add_param(mop->mo_ldd.ldd_params, NULL, optarg);
                         if (rc)
                                 return rc;
@@ -1196,7 +1238,23 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
                 fprintf(stderr, "Bad argument: %s\n", argv[optind]);
                 return EINVAL;
         }
-
+        
+#ifndef TUNEFS
+        if (mop->mo_ldd.ldd_flags & LDD_F_SV_TYPE_MDT && 0 == upcall) {
+                if(access("/usr/sbin/l_getgroups", R_OK | X_OK))
+                        fprintf(stderr, "WARNING: MDS group upcall is not set, "
+                                "use 'NONE'\n");
+                else {
+                        rc = add_param(mop->mo_ldd.ldd_params, PARAM_MDT_UPCALL,
+                                       "/usr/sbin/l_getgroups");
+                        if (rc)
+                                return rc;
+                        /* Must update the mgs logs */
+                        mop->mo_ldd.ldd_flags |= LDD_F_UPDATE;
+                }
+        }
+#endif
+ 
         return 0;
 }