export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/utils:$PATH:/sbin:/usr/sbin
ONLY=${ONLY:-"$*"}
+ALWAYS_EXCEPT="$SANITY_PCC_EXCEPT "
# bug number for skipped test:
-ALWAYS_EXCEPT=""
+ALWAYS_EXCEPT+=""
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
ENABLE_PROJECT_QUOTAS=${ENABLE_PROJECT_QUOTAS:-true}
+HSMTOOL_ARCHIVE_FORMAT=v1
LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
MULTIOP=${MULTIOP:-multiop}
OPENFILE=${OPENFILE:-openfile}
-MMAP_CAT=${MMAP_CAT:-mmap_cat}
MOUNT_2=${MOUNT_2:-"yes"}
FAIL_ON_ERROR=false
local lustre_path="$2"
local fid=$(path2fid $lustre_path)
- local -a f_seq
- local -a f_oid
- local -a f_ver
-
- f_seq=$(echo $fid | awk -F ':' '{print $1}')
- f_oid=$(echo $fid | awk -F ':' '{print $2}')
- f_ver=$(echo $fid | awk -F ':' '{print $3}')
-
- printf "%s/%04x/%04x/%04x/%04x/%04x/%04x/%s" \
- $hsm_root $(($f_oid & 0xFFFF)) \
- $(($f_oid >> 16 & 0xFFFF)) \
- $(($f_seq & 0xFFFF)) \
- $(($f_seq >> 16 & 0xFFFF)) \
- $(($f_seq >> 32 & 0xFFFF)) \
- $(($f_seq >> 48 & 0xFFFF)) $fid
+ local seq=$(echo $fid | awk -F ':' '{print $1}')
+ local oid=$(echo $fid | awk -F ':' '{print $2}')
+ local ver=$(echo $fid | awk -F ':' '{print $3}')
+
+ case "$HSMTOOL_ARCHIVE_FORMAT" in
+ v1)
+ printf "%s/%04x/%04x/%04x/%04x/%04x/%04x/%s" \
+ $hsm_root $((oid & 0xFFFF)) \
+ $((oid >> 16 & 0xFFFF)) \
+ $((seq & 0xFFFF)) \
+ $((seq >> 16 & 0xFFFF)) \
+ $((seq >> 32 & 0xFFFF)) \
+ $((seq >> 48 & 0xFFFF)) $fid
+ ;;
+ v2)
+ printf "%s/%04x/%s" $hsm_root $(((oid ^ seq) & 0xFFFF)) $fid
+ ;;
+ esac
}
check_lpcc_state()
is_project_quota_supported || project=false
- do_facet $SINGLEAGT mkdir -p $DIR/$tdir
+ do_facet $SINGLEAGT $LFS mkdir -i0 -c1 $DIR/$tdir
setup_pcc_mapping
$project && lfs project -sp $project_id $DIR/$tdir
setup_pcc_mapping $SINGLEAGT \
"projid={100}\ rwid=$HSM_ARCHIVE_NUMBER\ auto_attach=0"
$LCTL pcc list $MOUNT
- mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+ mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
chmod 777 $DIR/$tdir || error "chmod 777 $DIR/$tdir failed"
do_facet $SINGLEAGT $RUNAS dd if=/dev/zero of=$file bs=1024 count=1 ||
setup_pcc_mapping $SINGLEAGT \
"projid={100}\ rwid=$HSM_ARCHIVE_NUMBER\ open_attach=0\ stat_attach=0"
- do_facet $SINGLEAGT mkdir -p $DIR/$tdir
+ do_facet $SINGLEAGT $LFS mkdir -i0 -c1 $DIR/$tdir
chmod 777 $DIR/$tdir || error "chmod 0777 $DIR/$tdir failed"
$LFS project -sp $project_id $DIR/$tdir ||
error "failed to set project for $DIR/$tdir"
copytool setup -m "$MOUNT" -a "$HSM_ARCHIVE_NUMBER"
setup_pcc_mapping
file=$DIR/$tdir/multiop
- mkdir -p $DIR/$tdir
+ $LFS mkdir -i -1 -c $MDSCOUNT $DIR/$tdir
rm -f $file
do_facet $SINGLEAGT $LFS project -sp $project_id $DIR/$tdir ||
local loopfile="$TMP/$tfile"
local mntpt="/mnt/pcc.$tdir"
local hsm_root="$mntpt/$tdir"
+ local excepts="-e 6 -e 7 -e 8 -e 9"
! is_project_quota_supported &&
skip "project quota is not supported" && return
lfs project -sp $project_id $DIR/$tdir ||
error "lfs project -sp $project_id $DIR/$tdir failed"
- # mmap_sanity tst7 failed on the local ext4 filesystem.
- # It seems that Lustre filesystem does special process for tst 7.
- # Thus, we exclude tst7 from the PCC testing.
- # There is a mmap problem for PCC when multiple clients read/write
- # on a shared mmapped file. Thus, we exclude mmap_sanity tst6 from
- # the PCC tesing.
- $LUSTRE/tests/mmap_sanity -d $DIR/$tdir -m $DIR2/$tdir -e 6 -e 7 ||
+ # 1. mmap_sanity tst7 failed on the local ext4 filesystem.
+ # It seems that Lustre filesystem does special process for tst 7.
+ # 2. There is a mmap problem for PCC when multiple clients read/write
+ # on a shared mmapped file for mmap_sanity tst 6.
+ # 3. Current CentOS8 kernel does not strictly obey POSIX syntax for
+ # mmap() within the maping but beyond current end of the underlying
+ # files: It does not send SIGBUS signals to the process.
+ # 4. For negative file offset, sanity_mmap also failed on 48 bits
+ # ldiksfs backend due to too large offset: "Value too large for
+ # defined data type".
+ # mmap_sanity tst7/tst8/tst9 all failed on Lustre and local ext4.
+ # Thus, we exclude sanity tst6/tst7/tst8/tst9 from the PCC testing.
+ $LUSTRE/tests/mmap_sanity -d $DIR/$tdir -m $DIR2/$tdir $excepts ||
error "mmap_sanity test failed"
sync; sleep 1; sync
+ # Revoke the layout lock, the PCC-cached file will be
+ # detached automatically.
+ do_facet $SINGLEAGT $LCTL \
+ set_param ldlm.namespaces.*mdc*.lru_size=clear
rm -rf $DIR/$tdir || error "failed to remove $DIR/$tdir"
}
run_test 4 "Auto cache test for mmap"
sleep 3
wait_request_state $(path2fid $file) RESTORE SUCCEED
$LFS hsm_remove $file || error "hsm remove $file failed"
- wait $pid && error "RW-PCC attach $file should fail"
+ wait $pid
do_facet $SINGLEAGT "[ -f $lpcc_path ]" &&
error "RW-PCC cached file '$lpcc_path' should be removed"
"$rule\ rwid=$HSM_ARCHIVE_NUMBER\ auto_attach=0"
$LCTL pcc list $MOUNT
- do_facet $SINGLEAGT mkdir -p $DIR/$tdir
+ do_facet $SINGLEAGT $LFS mkdir -i 0 $DIR/$tdir
chmod 777 $DIR/$tdir || error "chmod 0777 $DIR/$tdir failed"
rm -f $file || error "rm $file failed"
copytool setup -m "$MOUNT" -a "$HSM_ARCHIVE_NUMBER"
setup_pcc_mapping
- mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
+ mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
chmod 777 $DIR/$tdir || error "chmod 777 $DIR/$tdir failed"
echo "Check open attach for non-root user"