From: bwzhou Date: Mon, 24 Sep 2007 11:51:10 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_7_0_51~698 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c43262bf0f6c351825c7dd2c2b6fdbcf21fcbe73 Branch HEAD b=12609 i=johann i=tianzy set l_getgroups as the default group upcall in mkfs.lustre; some minor fixes for sanity.sh --- diff --git a/lustre/include/lustre_param.h b/lustre/include/lustre_param.h index 8acf23e..5dcd714 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 d31c089..53482d0 100644 --- a/lustre/tests/cfg/insanity-local.sh +++ b/lustre/tests/cfg/insanity-local.sh @@ -48,6 +48,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 16c6c3b..0ad36de 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -53,6 +53,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 520a7a9..7fd576f 100644 --- a/lustre/tests/cfg/lov.sh +++ b/lustre/tests/cfg/lov.sh @@ -47,6 +47,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 fce524d..950f320 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -143,6 +143,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 if [ "${ONLY}" = "MOUNT" ] ; then @@ -2903,7 +2905,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 8e7d972..8a36d21 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -948,14 +948,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); @@ -1046,6 +1074,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) { @@ -1184,6 +1214,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; @@ -1221,7 +1263,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; }