From 75d6d35bcc48eefe490e8b4efd673c58b3373507 Mon Sep 17 00:00:00 2001 From: JC Lafoucriere Date: Sun, 2 Nov 2014 21:17:45 -0500 Subject: [PATCH] LU-4178 tests: add messages to sanity-hsm Add messages in case of file creation failure so we can diagnose the failure. This is a backport to b2_5 of Lustre change: http://review.whamcloud.com/8113 Lustre commit: 597214dc586ae9d329f2bb819600ac4b9ddfcc06 Signed-off-by: JC Lafoucriere Change-Id: I080c4cbb6bfe5a65d964f32a36d7c1dba35d0c27 Reviewed-on: http://review.whamcloud.com/8113 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: James Nunez Tested-by: Jenkins Tested-by: Maloo (cherry picked from commit 597214dc586ae9d329f2bb819600ac4b9ddfcc06) --- lustre/tests/sanity-hsm.sh | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 0634d95..11298d6 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -339,7 +339,7 @@ make_archive() { local file=$HSM_ARCHIVE/$1 do_facet $SINGLEAGT mkdir -p $(dirname $file) do_facet $SINGLEAGT dd if=/dev/urandom of=$file count=32 bs=1000000 || - error "cannot create $file" + file_creation_failure dd $file $? } copy2archive() { @@ -559,6 +559,15 @@ check_hsm_flags_user() { [[ $st == $fl ]] || error "hsm flags on $f are $st != $fl" } +file_creation_failure() { + local cmd=$1 + local f=$2 + local err=$3 + + df $MOUNT $MOUNT2 + error "cannot create $f with $cmd, status=$err" +} + copy_file() { local f= @@ -572,20 +581,22 @@ copy_file() { f=${f/$DIR/$DIR2} fi rm -f $f - cp $1 $f || error "cannot copy $1 to $f" + cp $1 $f || file_creation_failure cp $f $? + path2fid $f || error "cannot get fid on $f" } make_small() { local file2=${1/$DIR/$DIR2} dd if=/dev/urandom of=$file2 count=2 bs=1M conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? + path2fid $1 || error "cannot get fid on $1" } make_small_sync() { dd if=/dev/urandom of=$1 count=1 bs=1M conv=sync || - error "cannot create $1" + file_creation_failure dd $1 $? path2fid $1 || error "cannot get fid on $1" } @@ -602,7 +613,8 @@ make_large_for_striping() { cleanup_large_files dd if=/dev/urandom of=$file2 count=5 bs=$sz conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? + path2fid $1 || error "cannot get fid on $1" } @@ -616,7 +628,8 @@ make_large_for_progress() { # size is not a multiple of 1M to avoid stripe # aligment dd if=/dev/urandom of=$file2 count=39 bs=1000000 conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? + path2fid $1 || error "cannot get fid on $1" } @@ -630,7 +643,7 @@ make_large_for_progress_aligned() { # size is a multiple of 1M to have stripe # aligment dd if=/dev/urandom of=$file2 count=33 bs=1M conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? path2fid $1 || error "cannot get fid on $1" } @@ -641,7 +654,7 @@ make_large_for_cancel() { # Copy timeout is 100s. 105MB => 105s dd if=/dev/urandom of=$file2 count=103 bs=1M conv=fsync || - error "cannot create $file2" + file_creation_failure dd $file2 $? path2fid $1 || error "cannot get fid on $1" } @@ -826,7 +839,7 @@ test_3() { error "user could not change hsm flags" dd if=/etc/passwd of=$f.append bs=1 count=3\ conv=notrunc oflag=append status=noxfer || - error "could not append to test file" + file_creation_failure dd $f.append $? check_hsm_flags $f.append "0x00000003" # Modify a file sets it dirty @@ -835,7 +848,7 @@ test_3() { error "user could not change hsm flags" dd if=/dev/zero of=$f.modify bs=1 count=3\ conv=notrunc status=noxfer || - error "could not modify test file" + file_creation_failure dd $f.modify $? check_hsm_flags $f.modify "0x00000003" # Open O_TRUNC sets dirty -- 1.8.3.1