MDSOPT=${MDSOPT:-}
MDS_FS_MKFS_OPTS=${MDS_FS_MKFS_OPTS:-}
MDS_MOUNT_OPTS=${MDS_MOUNT_OPTS:-}
+# <facet_type>_MOUNT_FS_OPTS is the mount options specified when formatting
+# the underlying device by argument "--mountfsoptions"
+MDS_MOUNT_FS_OPTS=${MDS_MOUNT_FS_OPTS:-}
MGSSIZE=${MGSSIZE:-$MDSSIZE}
MGSOPT=${MGSOPT:-}
MGS_FS_MKFS_OPTS=${MGS_FS_MKFS_OPTS:-}
MGS_MOUNT_OPTS=${MGS_MOUNT_OPTS:-}
+MGS_MOUNT_FS_OPTS=${MGS_MOUNT_FS_OPTS:-}
OSTCOUNT=${OSTCOUNT:-2}
OSTDEVBASE=${OSTDEVBASE:-$TMP/${FSNAME}-ost}
OSTOPT=${OSTOPT:-}
OST_FS_MKFS_OPTS=${OST_FS_MKFS_OPTS:-}
OST_MOUNT_OPTS=${OST_MOUNT_OPTS:-}
+OST_MOUNT_FS_OPTS=${OST_MOUNT_FS_OPTS:-}
OST_INDEX_LIST=${OST_INDEX_LIST:-}
# Can specify individual ost devs with
# OSTDEV1="/dev/sda"
}
run_test 103 "rename filesystem name"
+test_104() { # LU-6952
+ local mds_mountopts=$MDS_MOUNT_OPTS
+ local ost_mountopts=$OST_MOUNT_OPTS
+ local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
+ local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
+ awk '{ print $2 }')
+
+ [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
+ { skip "this test needs utils above 2.9.55" && return 0; }
+
+ # specify "acl" in mount options used by mkfs.lustre
+ if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
+ MDS_MOUNT_FS_OPTS="acl,user_xattr"
+ else
+
+ MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
+ fi
+
+ echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
+
+ #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
+ formatall
+ if [ -z "$MDS_MOUNT_OPTS" ]; then
+ MDS_MOUNT_OPTS="-o noacl"
+ else
+ MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
+ fi
+
+ for num in $(seq $MDSCOUNT); do
+ start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
+ error "Failed to start MDS"
+ done
+
+ for num in $(seq $OSTCOUNT); do
+ start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
+ error "Failed to start OST"
+ done
+
+ mount_client $MOUNT
+ setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
+ error "ACL is applied when FS is mounted with noacl."
+
+ MDS_MOUNT_OPTS=$mds_mountopts
+ OST_MOUNT_OPTS=$ost_mountopts
+ MDS_MOUNT_FS_OPTS=$mds_mountfsopts
+
+ formatall
+ setupall
+}
+run_test 104 "Make sure user defined options are reflected in mount"
+
if ! combined_mgs_mds ; then
stop mgs
fi
echo -n "$opts"
}
+mountfs_opts() {
+ local facet=$1
+ local type=$(facet_type $facet)
+ local var=${type}_MOUNT_FS_OPTS
+ local opts=""
+ if [ -n "${!var}" ]; then
+ opts+=" --mountfsoptions=${!var}"
+ fi
+ echo -n "$opts"
+}
+
check_ost_indices() {
local index_count=${#OST_INDICES[@]}
[[ $index_count -eq 0 || $OSTCOUNT -le $index_count ]] && return 0
fi
echo "Format mgs: $(mgsdevname)"
reformat_external_journal mgs
- add mgs $(mkfs_opts mgs $(mgsdevname)) --reformat \
+ add mgs $(mkfs_opts mgs $(mgsdevname)) $(mountfs_opts mgs) --reformat \
$(mgsdevname) $(mgsvdevname) ${quiet:+>/dev/null} || exit 10
}
echo "Format mds$num: $(mdsdevname $num)"
reformat_external_journal mds$num
add mds$num $(mkfs_opts mds$num $(mdsdevname ${num})) \
- --reformat $(mdsdevname $num) $(mdsvdevname $num) \
- ${quiet:+>/dev/null} || exit 10
+ $(mountfs_opts mds$num) --reformat $(mdsdevname $num) \
+ $(mdsvdevname $num) ${quiet:+>/dev/null} || exit 10
}
format_ost() {
echo "Format ost$num: $(ostdevname $num)"
reformat_external_journal ost$num
add ost$num $(mkfs_opts ost$num $(ostdevname ${num})) \
- --reformat $(ostdevname $num) $(ostvdevname ${num}) \
- ${quiet:+>/dev/null} || exit 10
+ $(mountfs_opts ost$num) --reformat $(ostdevname $num) \
+ $(ostvdevname ${num}) ${quiet:+>/dev/null} || exit 10
}
formatall() {
{
struct lustre_disk_data *ldd = &mop->mo_ldd;
char *cur, *start;
+ char *temp_options;
int rc = 0;
rc = osd_is_lustre(source, &ldd->ldd_mount_type);
/* Since we never rewrite ldd, ignore temp flags */
ldd->ldd_flags &= ~(LDD_F_VIRGIN | LDD_F_WRITECONF);
+ /* This is to make sure default options go first */
+ temp_options = strdup(options);
+ if (temp_options == NULL) {
+ fprintf(stderr, "%s: can't allocate memory for temp_options\n",
+ progname);
+ return ENOMEM;
+ }
+ strncpy(options, ldd->ldd_mount_opts, options_len);
+ rc = append_option(options, options_len, temp_options, NULL);
+ free(temp_options);
+ if (rc != 0)
+ return rc;
+
/* svname of the form lustre:OST1234 means never registered */
rc = strlen(ldd->ldd_svname);
if (strcmp(ldd->ldd_svname, "MGS") != 0) {
if (rc != 0)
return rc;
- rc = append_option(options, options_len, ldd->ldd_mount_opts, NULL);
- if (rc != 0)
- return rc;
-
if (!mop->mo_have_mgsnid) {
/* Only use disk data if mount -o mgsnode=nid wasn't
* specified */