⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sanity.sh

📁 lustre 1.6.5 source code
💻 SH
📖 第 1 页 / 共 5 页
字号:
}run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/${tdir}2"test_32h() {	rm -fr $DIR/$tdir $DIR/${tdir}2	TMP_DIR=$DIR/$tdir/tmp       	mkdir -p $TMP_DIR $DIR/${tdir}2 	ln -s $DIR/${tdir}2 $TMP_DIR/symlink12 	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 	ls $TMP_DIR/symlink12 || error	ls $DIR/$tdir/symlink02  || error}run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/${tdir}2"test_32i() {	[ -e $DIR/d32i ] && rm -fr $DIR/d32i	mkdir -p $DIR/d32i/ext2-mountpoint 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32i/ext2-mountpoint || error	touch $DIR/d32i/test_file	$CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error  	$UMOUNT $DIR/d32i/ext2-mountpoint || error}run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="test_32j() {	[ -e $DIR/d32j ] && rm -fr $DIR/d32j	mkdir -p $DIR/d32j/ext2-mountpoint 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32j/ext2-mountpoint || error	touch $DIR/d32j/test_file	cat $DIR/d32j/ext2-mountpoint/../test_file || error	$UMOUNT $DIR/d32j/ext2-mountpoint || error}run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="test_32k() {	rm -fr $DIR/d32k	mkdir -p $DIR/d32k/ext2-mountpoint 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint  	mkdir -p $DIR/d32k/d2	touch $DIR/d32k/d2/test_file || error	$CHECKSTAT -t file $DIR/d32k/ext2-mountpoint/../d2/test_file || error	$UMOUNT $DIR/d32k/ext2-mountpoint || error}run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"test_32l() {	rm -fr $DIR/d32l	mkdir -p $DIR/d32l/ext2-mountpoint 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32l/ext2-mountpoint || error	mkdir -p $DIR/d32l/d2	touch $DIR/d32l/d2/test_file	cat  $DIR/d32l/ext2-mountpoint/../d2/test_file || error	$UMOUNT $DIR/d32l/ext2-mountpoint || error}run_test 32l "open d32l/ext2-mountpoint/../d2/test_file ========"test_32m() {	rm -fr $DIR/d32m	mkdir -p $DIR/d32m/tmp    	TMP_DIR=$DIR/d32m/tmp       	ln -s $DIR $TMP_DIR/symlink11 	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01 	$CHECKSTAT -t link $DIR/d32m/tmp/symlink11 || error	$CHECKSTAT -t link $DIR/d32m/symlink01 || error}run_test 32m "stat d32m/symlink->tmp/symlink->lustre-root ======"test_32n() {	rm -fr $DIR/d32n	mkdir -p $DIR/d32n/tmp    	TMP_DIR=$DIR/d32n/tmp       	ln -s $DIR $TMP_DIR/symlink11 	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01 	ls -l $DIR/d32n/tmp/symlink11  || error	ls -l $DIR/d32n/symlink01 || error}run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======"test_32o() {	rm -fr $DIR/d32o $DIR/$tfile	touch $DIR/$tfile 	mkdir -p $DIR/d32o/tmp    	TMP_DIR=$DIR/d32o/tmp       	ln -s $DIR/$tfile $TMP_DIR/symlink12 	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 	$CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error	$CHECKSTAT -t link $DIR/d32o/symlink02 || error	$CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error	$CHECKSTAT -t file -f $DIR/d32o/symlink02 || error}run_test 32o "stat d32o/symlink->tmp/symlink->lustre-root/$tfile"test_32p() {    log 32p_1	rm -fr $DIR/d32p    log 32p_2	rm -f $DIR/$tfile    log 32p_3	touch $DIR/$tfile     log 32p_4	mkdir -p $DIR/d32p/tmp        log 32p_5	TMP_DIR=$DIR/d32p/tmp           log 32p_6	ln -s $DIR/$tfile $TMP_DIR/symlink12     log 32p_7	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02     log 32p_8	cat $DIR/d32p/tmp/symlink12 || error    log 32p_9	cat $DIR/d32p/symlink02 || error    log 32p_10}run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/$tfile"test_32q() {	[ -e $DIR/d32q ] && rm -fr $DIR/d32q	mkdir -p $DIR/d32q        touch $DIR/d32q/under_the_mount	mount -t ext2 -o loop $EXT2_DEV $DIR/d32q	ls $DIR/d32q/under_the_mount && error || true	$UMOUNT $DIR/d32q || error}run_test 32q "stat follows mountpoints in Lustre (should return error)"test_32r() {	[ -e $DIR/d32r ] && rm -fr $DIR/d32r	mkdir -p $DIR/d32r        touch $DIR/d32r/under_the_mount	mount -t ext2 -o loop $EXT2_DEV $DIR/d32r	ls $DIR/d32r | grep -q under_the_mount && error || true	$UMOUNT $DIR/d32r || error}run_test 32r "opendir follows mountpoints in Lustre (should return error)"test_33() {	rm -f $DIR/$tfile	touch $DIR/$tfile	chmod 444 $DIR/$tfile	chown $RUNAS_ID $DIR/$tfile	log 33_1	$RUNAS $OPENFILE -f O_RDWR $DIR/$tfile && error || true	log 33_2}run_test 33 "write file with mode 444 (should return error) ===="test_33a() {        rm -fr $DIR/d33        mkdir -p $DIR/d33        chown $RUNAS_ID $DIR/d33        $RUNAS $OPENFILE -f O_RDWR:O_CREAT -m 0444 $DIR/d33/f33|| error "create"        $RUNAS $OPENFILE -f O_RDWR:O_CREAT -m 0444 $DIR/d33/f33 && \		error "open RDWR" || true}run_test 33a "test open file(mode=0444) with O_RDWR (should return error)"test_33b() {        rm -fr $DIR/d33        mkdir -p $DIR/d33        chown $RUNAS_ID $DIR/d33        $RUNAS $OPENFILE -f 1286739555 $DIR/d33/f33 && error "create" || true}run_test 33b "test open file with malformed flags (No panic and return error)"TEST_34_SIZE=${TEST_34_SIZE:-2000000000000}test_34a() {	rm -f $DIR/f34	$MCREATE $DIR/f34 || error	$GETSTRIPE $DIR/f34 2>&1 | grep -q "no stripe info" || error	$TRUNCATE $DIR/f34 $TEST_34_SIZE || error	$GETSTRIPE $DIR/f34 2>&1 | grep -q "no stripe info" || error	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error}run_test 34a "truncate file that has not been opened ==========="test_34b() {	[ ! -f $DIR/f34 ] && test_34a	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error	$OPENFILE -f O_RDONLY $DIR/f34	$GETSTRIPE $DIR/f34 2>&1 | grep -q "no stripe info" || error	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error}run_test 34b "O_RDONLY opening file doesn't create objects ====="test_34c() {	[ ! -f $DIR/f34 ] && test_34a 	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error	$OPENFILE -f O_RDWR $DIR/f34	$GETSTRIPE $DIR/f34 2>&1 | grep -q "no stripe info" && error	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error}run_test 34c "O_RDWR opening file-with-size works =============="test_34d() {	[ ! -f $DIR/f34 ] && test_34a 	dd if=/dev/zero of=$DIR/f34 conv=notrunc bs=4k count=1 || error	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error	rm $DIR/f34}run_test 34d "write to sparse file ============================="test_34e() {	rm -f $DIR/f34e	$MCREATE $DIR/f34e || error	$TRUNCATE $DIR/f34e 1000 || error	$CHECKSTAT -s 1000 $DIR/f34e || error	$OPENFILE -f O_RDWR $DIR/f34e	$CHECKSTAT -s 1000 $DIR/f34e || error}run_test 34e "create objects, some with size and some without =="test_34f() { # bug 6242, 6243	SIZE34F=48000	rm -f $DIR/f34f	$MCREATE $DIR/f34f || error	$TRUNCATE $DIR/f34f $SIZE34F || error "truncating $DIR/f3f to $SIZE34F"	dd if=$DIR/f34f of=$TMP/f34f	$CHECKSTAT -s $SIZE34F $TMP/f34f || error "$TMP/f34f not $SIZE34F bytes"	dd if=/dev/zero of=$TMP/f34fzero bs=$SIZE34F count=1	cmp $DIR/f34f $TMP/f34fzero || error "$DIR/f34f not all zero"	cmp $TMP/f34f $TMP/f34fzero || error "$TMP/f34f not all zero"	rm $TMP/f34f $TMP/f34fzero $DIR/f34f}run_test 34f "read from a file with no objects until EOF ======="test_35a() {	cp /bin/sh $DIR/f35a	chmod 444 $DIR/f35a	chown $RUNAS_ID $DIR/f35a	$RUNAS $DIR/f35a && error || true	rm $DIR/f35a}run_test 35a "exec file with mode 444 (should return and not leak) ====="test_36a() {	rm -f $DIR/f36	utime $DIR/f36 || error}run_test 36a "MDS utime check (mknod, utime) ==================="test_36b() {	echo "" > $DIR/f36	utime $DIR/f36 || error}run_test 36b "OST utime check (open, utime) ===================="test_36c() {	rm -f $DIR/d36/f36	mkdir $DIR/d36	chown $RUNAS_ID $DIR/d36	$RUNAS utime $DIR/d36/f36 || error}run_test 36c "non-root MDS utime check (mknod, utime) =========="test_36d() {	[ ! -d $DIR/d36 ] && test_36c	echo "" > $DIR/d36/f36	$RUNAS utime $DIR/d36/f36 || error}run_test 36d "non-root OST utime check (open, utime) ==========="test_36e() {	[ $RUNAS_ID -eq $UID ] && skip "RUNAS_ID = UID = $UID -- skipping" && return	mkdir -p $DIR/$tdir	touch $DIR/$tdir/$tfile	$RUNAS utime $DIR/$tdir/$tfile && \		error "utime worked, expected failure" || true}run_test 36e "utime on non-owned file (should return error) ===="test_36f() {	export LANG=C LC_LANG=C # for date language	DATESTR="Dec 20  2000"	mkdir -p $DIR/$tdir	#define OBD_FAIL_OST_BRW_PAUSE_BULK 0x214        sysctl -w lustre.fail_loc=0x80000214	date; date +%s	cp /etc/hosts $DIR/$tdir/$tfile	sync & # write RPC generated with "current" inode timestamp, but delayed	sleep 1	touch --date="$DATESTR" $DIR/$tdir/$tfile # setattr timestamp in past	LS_BEFORE="`ls -l $DIR/$tdir/$tfile`" # old timestamp from client cache	cancel_lru_locks osc	LS_AFTER="`ls -l $DIR/$tdir/$tfile`"  # timestamp from OST object	date; date +%s	[ "$LS_BEFORE" != "$LS_AFTER" ] && \		echo "BEFORE: $LS_BEFORE" && \		echo "AFTER : $LS_AFTER" && \		echo "WANT  : $DATESTR" && \		error "$DIR/$tdir/$tfile timestamps changed" || true}run_test 36f "utime on file racing with OST BRW write =========="test_36g() {	remote_ost && skip "remote OST" && return	export FMD_MAX_AGE=`do_facet ost1 lctl get_param -n obdfilter.*.client_cache_seconds 2> /dev/null | head -n 1`	FMD_BEFORE="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`"	touch $DIR/d36/$tfile	sleep $((FMD_MAX_AGE + 12))	FMD_AFTER="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`"	[ "$FMD_AFTER" -gt "$FMD_BEFORE" ] && \		echo "AFTER : $FMD_AFTER > BEFORE $FMD_BEFORE" && \		error "fmd didn't expire after ping" || true}run_test 36g "filter mod data cache expiry ====================="test_37() {	mkdir -p $DIR/$tdir	echo f > $DIR/$tdir/fbugfile	mount -t ext2 -o loop $EXT2_DEV $DIR/$tdir	ls $DIR/$tdir | grep "\<fbugfile\>" && error	$UMOUNT $DIR/$tdir || error	rm -f $DIR/$tdir/fbugfile || error}run_test 37 "ls a mounted file system to check old content ====="test_38() {	o_directory $DIR/$tfile}run_test 38 "open a regular file with O_DIRECTORY =============="test_39() {	touch $DIR/$tfile	touch $DIR/${tfile}2#	ls -l  $DIR/$tfile $DIR/${tfile}2#	ls -lu  $DIR/$tfile $DIR/${tfile}2#	ls -lc  $DIR/$tfile $DIR/${tfile}2	sleep 2	$OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/${tfile}2	if [ ! $DIR/${tfile}2 -nt $DIR/$tfile ]; then		echo "mtime"		ls -l  $DIR/$tfile $DIR/${tfile}2		echo "atime"		ls -lu  $DIR/$tfile $DIR/${tfile}2		echo "ctime"		ls -lc  $DIR/$tfile $DIR/${tfile}2		error "O_TRUNC didn't change timestamps"	fi}run_test 39 "mtime changed on create ==========================="test_40() {	dd if=/dev/zero of=$DIR/f40 bs=4096 count=1	$RUNAS $OPENFILE -f O_WRONLY:O_TRUNC $DIR/f40 && error	$CHECKSTAT -t file -s 4096 $DIR/f40 || error}run_test 40 "failed open(O_TRUNC) doesn't truncate ============="test_41() {	# bug 1553	small_write $DIR/f41 18}run_test 41 "test small file write + fstat ====================="count_ost_writes() {        lctl get_param -n osc.*.stats |            awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'}# decent defaultWRITEBACK_SAVE=500DIRTY_RATIO_SAVE=40MAX_DIRTY_RATIO=50BG_DIRTY_RATIO_SAVE=10MAX_BG_DIRTY_RATIO=25start_writeback() {	trap 0	# in 2.6, restore /proc/sys/vm/dirty_writeback_centisecs,	# dirty_ratio, dirty_background_ratio	if [ -f /proc/sys/vm/dirty_writeback_centisecs ]; then		echo $WRITEBACK_SAVE > /proc/sys/vm/dirty_writeback_centisecs		echo $BG_DIRTY_RATIO_SAVE > /proc/sys/vm/dirty_background_ratio		echo $DIRTY_RATIO_SAVE > /proc/sys/vm/dirty_ratio	else		# if file not here, we are a 2.4 kernel		kill -CONT `pidof kupdated`	fi}stop_writeback() {	# setup the trap first, so someone cannot exit the test at the	# exact wrong time and mess up a machine	trap start_writeback EXIT	# in 2.6, save and 0 /proc/sys/vm/dirty_writeback_centisecs	if [ -f /proc/sys/vm/dirty_writeback_centisecs ]; then		WRITEBACK_SAVE=`cat /proc/sys/vm/dirty_writeback_centisecs`		echo 0 > /proc/sys/vm/dirty_writeback_centisecs		# save and increase /proc/sys/vm/dirty_ratio		DIRTY_RATIO_SAVE=`cat /proc/sys/vm/dirty_ratio`		echo $MAX_DIRTY_RATIO > /proc/sys/vm/dirty_ratio		# save and increase /proc/sys/vm/dirty_background_ratio		BG_DIRTY_RATIO_SAVE=`cat /proc/sys/vm/dirty_background_ratio`		echo $MAX_BG_DIRTY_RATIO > /proc/sys/vm/dirty_background_ratio	else		# if file not here, we are a 2.4 kernel		kill -STOP `pidof kupdated`	fi}# ensure that all stripes have some grant before we test client-side cachesetup_test42() {	[ "$SETUP_TEST42" ] && return	for i in `seq -f $DIR/f42-%g 1 $OSTCOUNT`; do		dd if=/dev/zero of=$i bs=4k count=1		rm $i	done	SETUP_TEST42=DONE}# Tests 42* verify that our behaviour is correct WRT caching, file closure,# file truncation, and file removal.test_42a() {	setup_test42	cancel_lru_locks osc	stop_writeback	sync; sleep 1; sync # just to be safe	BEFOREWRITES=`count_ost_writes`	lctl get_param -n osc.*[oO][sS][cC][_-]*.cur_grant_bytes | grep "[0-9]"	dd if=/dev/zero of=$DIR/f42a bs=1024 count=100	AFTERWRITES=`count_ost_writes`	[ $BEFOREWRITES -eq $AFTERWRITES ] || \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -