}
checksum = sbi->ll_flags & LL_SBI_CHECKSUM;
- err = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CHECKSUM),
- KEY_CHECKSUM, sizeof(checksum), &checksum,
- NULL);
- if (err) {
- CERROR("%s: Set checksum failed: rc = %d\n",
- sbi->ll_dt_exp->exp_obd->obd_name, err);
- GOTO(out_root, err);
+ if (sbi->ll_checksum_set) {
+ err = obd_set_info_async(NULL, sbi->ll_dt_exp,
+ sizeof(KEY_CHECKSUM), KEY_CHECKSUM,
+ sizeof(checksum), &checksum, NULL);
+ if (err) {
+ CERROR("%s: Set checksum failed: rc = %d\n",
+ sbi->ll_dt_exp->exp_obd->obd_name, err);
+ GOTO(out_root, err);
+ }
}
cl_sb_init(sb);
static inline int ll_set_opt(const char *opt, char *data, int fl)
{
- if (strncmp(opt, data, strlen(opt)) != 0)
- return(0);
- else
- return(fl);
+ if (strncmp(opt, data, strlen(opt)) != 0)
+ return 0;
+ else
+ return fl;
}
/* non-client-specific mount options are parsed in lmd_parse */
-static int ll_options(char *options, int *flags)
+static int ll_options(char *options, struct ll_sb_info *sbi)
{
- int tmp;
- char *s1 = options, *s2;
- ENTRY;
+ int tmp;
+ char *s1 = options, *s2;
+ int *flags = &sbi->ll_flags;
+ ENTRY;
- if (!options)
- RETURN(0);
+ if (!options)
+ RETURN(0);
- CDEBUG(D_CONFIG, "Parsing opts %s\n", options);
+ CDEBUG(D_CONFIG, "Parsing opts %s\n", options);
while (*s1) {
CDEBUG(D_SUPER, "next opt=%s\n", s1);
goto next;
}
- tmp = ll_set_opt("checksum", s1, LL_SBI_CHECKSUM);
- if (tmp) {
- *flags |= tmp;
- goto next;
- }
- tmp = ll_set_opt("nochecksum", s1, LL_SBI_CHECKSUM);
- if (tmp) {
- *flags &= ~tmp;
- goto next;
- }
+ tmp = ll_set_opt("checksum", s1, LL_SBI_CHECKSUM);
+ if (tmp) {
+ *flags |= tmp;
+ sbi->ll_checksum_set = 1;
+ goto next;
+ }
+ tmp = ll_set_opt("nochecksum", s1, LL_SBI_CHECKSUM);
+ if (tmp) {
+ *flags &= ~tmp;
+ sbi->ll_checksum_set = 1;
+ goto next;
+ }
tmp = ll_set_opt("lruresize", s1, LL_SBI_LRU_RESIZE);
if (tmp) {
*flags |= tmp;
if (!sbi)
GOTO(out_free, err = -ENOMEM);
- err = ll_options(lsi->lsi_lmd->lmd_opts, &sbi->ll_flags);
+ err = ll_options(lsi->lsi_lmd->lmd_opts, sbi);
if (err)
GOTO(out_free, err);
}
run_test 77j "client only supporting ADLER32"
+test_77k() { # LU-10906
+ [ $PARALLEL == "yes" ] && skip "skip parallel run"
+ $GSS && skip_env "could not run with gss"
+
+ local cksum_param="osc.$FSNAME*.checksums"
+ local get_checksum="$LCTL get_param -n $cksum_param | head -n1"
+ local checksum
+ local i
+
+ [ "$ORIG_CSUM" ] || ORIG_CSUM=$(eval $get_checksum)
+ stack_trap "wait_update $HOSTNAME '$get_checksum' $ORIG_CSUM" EXIT
+ stack_trap "do_facet mgs $LCTL set_param -P $cksum_param=$ORIG_CSUM" \
+ EXIT
+
+ for i in 0 1; do
+ do_facet mgs $LCTL set_param -P $cksum_param=$i ||
+ error "failed to set checksum=$i on MGS"
+ wait_update $HOSTNAME "$get_checksum" $i
+ #remount
+ echo "remount client, checksum should be $i"
+ remount_client $MOUNT || "failed to remount client"
+ checksum=$(eval $get_checksum)
+ [ $checksum -eq $i ] || error "checksum($checksum) != $i"
+ done
+
+ for opt in "checksum" "nochecksum"; do
+ #remount with mount option
+ echo "remount client with option $opt, checksum should be $i"
+ umount_client $MOUNT || "failed to umount client"
+ mount_client $MOUNT "$MOUNT_OPTS,$opt" ||
+ "failed to mount client with option '$opt'"
+ checksum=$(eval $get_checksum)
+ [ $checksum -eq $i ] || error "checksum($checksum) != $i"
+ i=$((i - 1))
+ done
+
+ remount_client $MOUNT || "failed to remount client"
+}
+run_test 77k "enable/disable checksum correctly"
+
[ "$ORIG_CSUM" ] && set_checksums $ORIG_CSUM || true
rm -f $F77_TMP
unset F77_TMP