diff --git a/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh b/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh index 169e13296ea..b67be7df2cc 100644 --- a/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_client_inc.sh @@ -62,7 +62,7 @@ mount_m0t1fs() local mountop=$2 # Create mount directory - sudo mkdir -p $m0t1fs_mount_dir || { + sudo mkdir -p "$m0t1fs_mount_dir" || { echo "Failed to create mount directory." return 1 } @@ -77,8 +77,8 @@ mount_m0t1fs() local cmd="sudo mount -t m0t1fs \ -o pfid='$M0T1FS_PROC_ID',profile='$PROF_OPT',ha='$lnet_nid:$HA_EP',$mountop \ none $m0t1fs_mount_dir" - echo $cmd - eval $cmd || { + echo "$cmd" + eval "$cmd" || { echo "Failed to mount m0t1fs file system." return 1 } @@ -87,7 +87,7 @@ mount_m0t1fs() mount | grep m0t1fs local retcode=$? if [ $retcode = 0 ]; then - time df $m0t1fs_mount_dir + time df "$m0t1fs_mount_dir" fi return $retcode } @@ -97,7 +97,7 @@ unmount_and_clean() m0t1fs_mount_dir=$MOTR_M0T1FS_MOUNT_DIR multiple_pools=$1 echo "Unmounting file system ..." - umount $m0t1fs_mount_dir &>/dev/null + umount "$m0t1fs_mount_dir" &>/dev/null sleep 2 @@ -105,7 +105,7 @@ unmount_and_clean() mount | grep m0t1fs echo "Cleaning up mount test directory..." - rm -rf $m0t1fs_mount_dir &>/dev/null + rm -rf "$m0t1fs_mount_dir" &>/dev/null local i=0 for ((i=0; i < ${#IOSEP[*]}; i++)) ; do @@ -115,12 +115,12 @@ unmount_and_clean() # fids are generated from same baseline which results # in failure of cob_create fops. local ios_index=`expr $i + 1` - rm -rf $MOTR_M0T1FS_TEST_DIR/d$ios_index/stobs/o/* + rm -rf "$MOTR_M0T1FS_TEST_DIR"/d"$ios_index"/stobs/o/* done - if [ ! -z "$multiple_pools" ] && [ $multiple_pools == 1 ]; then + if [ ! -z "$multiple_pools" ] && [ "$multiple_pools" == 1 ]; then local ios_index=`expr $i + 1` - rm -rf $MOTR_M0T1FS_TEST_DIR/d$ios_index/stobs/o/* + rm -rf "$MOTR_M0T1FS_TEST_DIR"/d"$ios_index"/stobs/o/* fi } @@ -134,12 +134,12 @@ unmount_m0t1fs() local m0t1fs_mount_dir=$1 echo "Unmounting file system ..." - umount $m0t1fs_mount_dir &>/dev/null + umount "$m0t1fs_mount_dir" &>/dev/null sleep 2 echo "Cleaning up test directory..." - rm -rf $m0t1fs_mount_dir &>/dev/null + rm -rf "$m0t1fs_mount_dir" &>/dev/null } @@ -158,7 +158,7 @@ bulkio_test() local mode=$4 local mountopt=$5 - mount_m0t1fs $m0t1fs_mount_dir "$mode,$mountopt" || return 1 + mount_m0t1fs "$m0t1fs_mount_dir" "$mode,$mountopt" || return 1 echo "Creating local input file of I/O size ..." run "dd if=/dev/urandom of=$local_input bs=$io_size count=$io_counts" @@ -169,7 +169,7 @@ bulkio_test() fi echo "Writing data to m0t1fs file ..." - touch_file $m0t1fs_file $unit_size && + touch_file "$m0t1fs_file" "$unit_size" && run "dd if=$local_input of=$m0t1fs_file bs=$io_size count=$io_counts" if [ $? -ne 0 ]; then echo "Failed to write data on m0t1fs file." @@ -197,7 +197,7 @@ bulkio_test() fi echo "Comparing data written and data read from m0t1fs file ..." - if ! cmp $local_input $local_output + if ! cmp "$local_input" "$local_output" then echo -n "Failed: data written and data read from m0t1fs file " echo "are not same." @@ -216,7 +216,7 @@ bulkio_test() show_write_speed() { - cat $MOTR_TEST_LOGFILE | grep copied | tail -2 | head -1 | \ + cat "$MOTR_TEST_LOGFILE" | grep copied | tail -2 | head -1 | \ awk -F, '{print $3}' } @@ -253,7 +253,7 @@ io_combinations() do echo -n "Test: I/O for stripe = ${stripe_size}K," \ "bs = $io_size, count = $io_count... " - bulkio_test $unit_size $io_size $io_count $mode "" &>> $MOTR_TEST_LOGFILE + bulkio_test $unit_size "$io_size" $io_count "$mode" "" &>> "$MOTR_TEST_LOGFILE" if [ $? -ne "0" ] then return 1 @@ -277,7 +277,7 @@ file_creation_test() for i in {a..z} {A..Z}; do for c in `seq 1 4095`; - do echo -n $i ; + do echo -n "$i" ; done; echo; done > $SFILE @@ -285,13 +285,13 @@ file_creation_test() NR_FILES=$[ $nr_files - $START_FID ] NR_FILES=$[ $NR_FILES * $NR_FILES ] - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mode || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mode || return 1 echo "Test: Creating $NR_FILES files on m0t1fs ..." for ((i=$START_FID; i<$nr_files; ++i)); do for ((j=$START_FID; j<$nr_files; ++j)); do - touch $MOTR_M0T1FS_MOUNT_DIR/$j:$i || break + touch "$MOTR_M0T1FS_MOUNT_DIR"/$j:$i || break run "dd if=$SFILE of=$MOTR_M0T1FS_MOUNT_DIR/$j:$i bs=$BS" || break - dd if=$MOTR_M0T1FS_MOUNT_DIR/$j:$i of=$DFILE bs=$BS 2>/dev/null || break + dd if="$MOTR_M0T1FS_MOUNT_DIR"/"$j":"$i" of=$DFILE bs=$BS 2>/dev/null || break diff -C 0 $SFILE $DFILE || { echo "file content differ!!!!!!!!!!!!!!!!! at $j:$i file. " break; @@ -325,7 +325,7 @@ file_creation_test() for ((j=$START_FID; j<$nr_files; ++j)); do touch $MOTR_M0T1FS_MOUNT_DIR/1$j:$i || break run "dd if=$SFILE of=$MOTR_M0T1FS_MOUNT_DIR/1$j:$i bs=$BS" || break - dd if=$MOTR_M0T1FS_MOUNT_DIR/1$j:$i of=$DFILE bs=$BS 2>/dev/null || break + dd if="$MOTR_M0T1FS_MOUNT_DIR"/1"$j":"$i" of=$DFILE bs=$BS 2>/dev/null || break diff -C 0 $SFILE $DFILE || { echo "file content differ!!!!!!!!!!!!!!!!! at $j:$i file. " break; @@ -360,15 +360,15 @@ file_creation_test() return 0 fi - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "verify" || { + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "verify" || { return 1 } for ((i=0; i<$nr_files; ++i)); do #arbitrary file size. "1021" is a prime close to 1024. - touch $MOTR_M0T1FS_MOUNT_DIR/file$i || break + touch "$MOTR_M0T1FS_MOUNT_DIR"/file"$i" || break dd if=$SFILE of=/tmp/src bs=1021 count=`expr $i + 1` >/dev/null 2>&1 || break - cp -v /tmp/src $MOTR_M0T1FS_MOUNT_DIR/file$i || break - cp -v $MOTR_M0T1FS_MOUNT_DIR/file$i /tmp/dest || break + cp -v /tmp/src "$MOTR_M0T1FS_MOUNT_DIR"/file"$i" || break + cp -v "$MOTR_M0T1FS_MOUNT_DIR"/file"$i" /tmp/dest || break diff -C 0 /tmp/src /tmp/dest || { echo "file content differ at file$i file. " break; @@ -383,7 +383,7 @@ file_creation_test() fi for ((i=0; i<$nr_files; ++i)); do - rm -vf $MOTR_M0T1FS_MOUNT_DIR/file$i || break + rm -vf "$MOTR_M0T1FS_MOUNT_DIR"/file"$i" || break done if [ $i -eq $nr_files ]; then echo "success." @@ -403,70 +403,70 @@ multi_client_test() local rc=0 - mount_m0t1fs ${mount_dir_1} "fid_start=65536" || + mount_m0t1fs "${mount_dir_1}" "fid_start=65536" || return 1 mount | grep m0t1fs - mount_m0t1fs ${mount_dir_2} "fid_start=66536" || { - unmount_m0t1fs ${mount_dir_1} + mount_m0t1fs "${mount_dir_2}" "fid_start=66536" || { + unmount_m0t1fs "${mount_dir_1}" return 1 } mount | grep m0t1fs - mount_m0t1fs ${mount_dir_3} "fid_start=67536" || { - unmount_m0t1fs ${mount_dir_1} - unmount_m0t1fs ${mount_dir_2} + mount_m0t1fs "${mount_dir_3}" "fid_start=67536" || { + unmount_m0t1fs "${mount_dir_1}" + unmount_m0t1fs "${mount_dir_2}" return 1 } echo "Three clients mounted:" mount | grep m0t1fs - cp -av /bin/ls ${mount_dir_1}/obj1 || rc=1 - cp -av /bin/ls ${mount_dir_2}/obj2 || rc=1 - cp -av /bin/ls ${mount_dir_3}/obj3 || rc=1 - ls -liR ${mount_dir_1} || rc=1 - ls -liR ${mount_dir_2} || rc=1 - ls -liR ${mount_dir_3} || rc=1 - - diff /bin/ls ${mount_dir_1}/obj1 || rc=1 - diff /bin/ls ${mount_dir_1}/obj2 || rc=1 - diff /bin/ls ${mount_dir_1}/obj3 || rc=1 - - diff /bin/ls ${mount_dir_1}/obj1 || rc=1 - diff /bin/ls ${mount_dir_2}/obj2 || rc=1 - diff /bin/ls ${mount_dir_3}/obj3 || rc=1 - - unmount_m0t1fs ${mount_dir_1} - unmount_m0t1fs ${mount_dir_2} - unmount_m0t1fs ${mount_dir_3} + cp -av /bin/ls "${mount_dir_1}"/obj1 || rc=1 + cp -av /bin/ls "${mount_dir_2}"/obj2 || rc=1 + cp -av /bin/ls "${mount_dir_3}"/obj3 || rc=1 + ls -liR "${mount_dir_1}" || rc=1 + ls -liR "${mount_dir_2}" || rc=1 + ls -liR "${mount_dir_3}" || rc=1 + + diff /bin/ls "${mount_dir_1}"/obj1 || rc=1 + diff /bin/ls "${mount_dir_1}"/obj2 || rc=1 + diff /bin/ls "${mount_dir_1}"/obj3 || rc=1 + + diff /bin/ls "${mount_dir_1}"/obj1 || rc=1 + diff /bin/ls "${mount_dir_2}"/obj2 || rc=1 + diff /bin/ls "${mount_dir_3}"/obj3 || rc=1 + + unmount_m0t1fs "${mount_dir_1}" + unmount_m0t1fs "${mount_dir_2}" + unmount_m0t1fs "${mount_dir_3}" echo "First round done." - mount_m0t1fs ${mount_dir_1} "fid_start=65536" || { + mount_m0t1fs "${mount_dir_1}" "fid_start=65536" || { return 1 } - mount_m0t1fs ${mount_dir_2} "fid_start=66536" || { - unmount_m0t1fs ${mount_dir_1} + mount_m0t1fs "${mount_dir_2}" "fid_start=66536" || { + unmount_m0t1fs "${mount_dir_1}" return 1 } - mount_m0t1fs ${mount_dir_3} "fid_start=67536" || { - unmount_m0t1fs ${mount_dir_1} - unmount_m0t1fs ${mount_dir_2} + mount_m0t1fs "${mount_dir_3}" "fid_start=67536" || { + unmount_m0t1fs "${mount_dir_1}" + unmount_m0t1fs "${mount_dir_2}" return 1 } echo "Three clients mounted:" mount | grep m0t1fs - ls -liR ${mount_dir_1} || rc=1 - ls -liR ${mount_dir_2} || rc=1 - ls -liR ${mount_dir_3} || rc=1 + ls -liR "${mount_dir_1}" || rc=1 + ls -liR "${mount_dir_2}" || rc=1 + ls -liR "${mount_dir_3} "|| rc=1 - diff /bin/ls ${mount_dir_1}/obj1 || rc=1 - diff /bin/ls ${mount_dir_2}/obj2 || rc=1 - diff /bin/ls ${mount_dir_3}/obj3 || rc=1 + diff /bin/ls "${mount_dir_1}"/obj1 || rc=1 + diff /bin/ls "${mount_dir_2}"/obj2 || rc=1 + diff /bin/ls "${mount_dir_3}"/obj3 || rc=1 # Completely repeat the first round of the test. - diff /bin/ls ${mount_dir_1}/obj1 || rc=1 - diff /bin/ls ${mount_dir_1}/obj2 || rc=1 - diff /bin/ls ${mount_dir_1}/obj3 || rc=1 + diff /bin/ls "${mount_dir_1}"/obj1 || rc=1 + diff /bin/ls "${mount_dir_1}"/obj2 || rc=1 + diff /bin/ls "${mount_dir_1}"/obj3 || rc=1 - unmount_m0t1fs ${mount_dir_1} - unmount_m0t1fs ${mount_dir_2} - unmount_m0t1fs ${mount_dir_3} + unmount_m0t1fs "${mount_dir_1}" + unmount_m0t1fs "${mount_dir_2}" + unmount_m0t1fs "${mount_dir_3}" echo "Second round done" mount | grep m0t1fs return $rc @@ -488,7 +488,7 @@ rmw_test() do echo -n "IORMW Test: I/O for unit ="\ "${unit_size}K, bs = $io_size, count = $io_count ... " - bulkio_test $unit_size $io_size $io_count $mode $mountopt &>> $MOTR_TEST_LOGFILE || return 1 + bulkio_test $unit_size $io_size $io_count "$mode" "$mountopt" &>> "$MOTR_TEST_LOGFILE" || return 1 show_write_speed done done @@ -510,14 +510,14 @@ obf_test() local rc=0 echo "Test: obf..." - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "oostore" || { + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "oostore" || { return 1 } - touch $MOTR_M0T1FS_MOUNT_DIR/0:30000 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/0:30000 || rc=1 - ls -la $MOTR_M0T1FS_MOUNT_DIR/0:30000 || rc=1 - rm $MOTR_M0T1FS_MOUNT_DIR/0:30000 || rc=1 - unmount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR + touch "$MOTR_M0T1FS_MOUNT_DIR"/0:30000 || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/0:30000 || rc=1 + ls -la "$MOTR_M0T1FS_MOUNT_DIR"/0:30000 || rc=1 + rm "$MOTR_M0T1FS_MOUNT_DIR"/0:30000 || rc=1 + unmount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" if [ $rc -eq 0 ]; then echo "Success: Open-by-fid test." else @@ -534,58 +534,58 @@ m0t1fs_crud() local fsname2=$2 local fsname3=$3 local mode=$4 - touch $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - touch $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 - touch $MOTR_M0T1FS_MOUNT_DIR/$fsname3 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname3 || rc=1 - chmod 567 $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - chmod 123 $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 - chmod 345 $MOTR_M0T1FS_MOUNT_DIR/$fsname3 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname3 -c "%n: %a %s" || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname1 bs=4K count=1 || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname2 bs=128K count=1 || rc=1 - touch_file $MOTR_M0T1FS_MOUNT_DIR/$fsname3 64 && - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname3 bs=1M count=1 || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" || rc=1 + chmod 567 "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" || rc=1 + chmod 123 "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" || rc=1 + chmod 345 "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" -c "%n: %a %s" || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" bs=4K count=1 || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" bs=128K count=1 || rc=1 + touch_file "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" 64 && + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" bs=1M count=1 || rc=1 sync - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname3 -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" -c "%n: %a %s" || rc=1 echo 3 > /proc/sys/vm/drop_caches - dd of=/dev/zero if=$MOTR_M0T1FS_MOUNT_DIR/$fsname1 bs=4K count=1 || rc=1 - dd of=/dev/zero if=$MOTR_M0T1FS_MOUNT_DIR/$fsname2 bs=128K count=1 || rc=1 - dd of=/dev/zero if=$MOTR_M0T1FS_MOUNT_DIR/$fsname3 bs=1M count=1 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname3 -c "%n: %a %s" || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname1 bs=4K count=1 || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname2 bs=128K count=1 || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname3 bs=1M count=1 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 -c "%n: %a %s" || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname3 -c "%n: %a %s" || rc=1 + dd of=/dev/zero if="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" bs=4K count=1 || rc=1 + dd of=/dev/zero if="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" bs=128K count=1 || rc=1 + dd of=/dev/zero if="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" bs=1M count=1 || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" -c "%n: %a %s" || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" bs=4K count=1 || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" bs=128K count=1 || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" bs=1M count=1 || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" -c "%n: %a %s" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" -c "%n: %a %s" || rc=1 if [ "$mode" != "oostore" ]; then - ls -l $MOTR_M0T1FS_MOUNT_DIR || rc=1 + ls -l "$MOTR_M0T1FS_MOUNT_DIR" || rc=1 fi unmount_and_clean echo "Remount and perform write on already created file" - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "$mode" || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname1 bs=4K count=1 || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname2 bs=128K count=1 || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname3 bs=1M count=1 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$fsname3 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 2>/dev/null && rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 2>/dev/null && rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname3 2>/dev/null && rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "$mode" || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" bs=4K count=1 || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" bs=128K count=1 || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" bs=1M count=1 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" 2>/dev/null && rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname2" 2>/dev/null && rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname3" 2>/dev/null && rc=1 # Test for CROW - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fsname1 bs=4K count=1 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" bs=4K count=1 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname1" || rc=1 return $rc } @@ -596,7 +596,7 @@ m0t1fs_basic() local fsname2="890" local fsname3="xyz0" echo "Test: basic..." - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR || rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" || rc=1 mount | grep m0t1fs m0t1fs_crud $fsname1 $fsname2 $fsname3 || rc=1 unmount_and_clean @@ -618,26 +618,26 @@ m0t1fs_large_dir() local count=512 echo "Test: larde_dir: mode=$1 fsname_prefix=$2..." - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "$mode" || rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "$mode" || rc=1 mount | grep m0t1fs || rc=1 for i in `seq 1 $count`; do - touch $MOTR_M0T1FS_MOUNT_DIR/$fsname_prex$i || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname_prex$i -c "%n: %a %s" || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname_prex""$i" || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname_prex""$i" -c "%n: %a %s" || rc=1 done - local dirs=`/bin/ls $MOTR_M0T1FS_MOUNT_DIR -U` - local dirs_count=`echo $dirs | wc -w` + local dirs=`/bin/ls "$MOTR_M0T1FS_MOUNT_DIR" -U` + local dirs_count=`echo "$dirs" | wc -w` echo "readdir count: result $dirs_count, expected $count" if [ ! $dirs_count -eq $count ] ; then rc=1 fi for i in `seq 1 $count`; do - local match=`echo $dirs | grep -c "\<$fsname_prex$i\>"` - if [ ! $match -eq 1 ] ; then + local match=`echo "$dirs" | grep -c "\<$fsname_prex$i\>"` + if [ ! "$match" -eq 1 ] ; then echo "match $fsname_prex$i failed: $match" rc=1 else - rm -v $MOTR_M0T1FS_MOUNT_DIR/$fsname_prex$i || rc=1 + rm -v "$MOTR_M0T1FS_MOUNT_DIR"/"$fsname_prex""$i" || rc=1 fi done @@ -654,13 +654,13 @@ m0t1fs_oostore_mode() local mode="oostore" echo "Test: oostore_mode..." - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mode || rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mode || rc=1 mount | grep m0t1fs || rc=1 m0t1fs_crud $fsname1 $fsname2 $fsname3 $mode || rc=1 - touch $MOTR_M0T1FS_MOUNT_DIR/123456 2>/dev/null && rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/123456 2>/dev/null && rc=1 - touch $MOTR_M0T1FS_MOUNT_DIR/abcdef 2>/dev/null && rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/abcdef 2>/dev/null && rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/123456 2>/dev/null && rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/123456 2>/dev/null && rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/abcdef 2>/dev/null && rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/abcdef 2>/dev/null && rc=1 unmount_and_clean return $rc @@ -683,48 +683,48 @@ m0t1fs_oostore_mode_basic() for i in {a..z} {A..Z} ; do for c in `seq 1 4095`; - do echo -n $i ; + do echo -n "$i" ; done; echo; done > $SOURCE_TXT - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "oostore" || rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "oostore" || rc=1 mount | grep m0t1fs || rc=1 - cp -v $SOURCE_TXT $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - cat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 > /tmp/$fsname1 || rc=1 + cp -v $SOURCE_TXT "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 || rc=1 + cat "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 > /tmp/$fsname1 || rc=1 # sleep two seconds, so the {a,c,m}time are different sleep 2 - cp -v $SOURCE_TXT $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 - cat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 > /tmp/$fsname2 || rc=1 + cp -v $SOURCE_TXT "$MOTR_M0T1FS_MOUNT_DIR"/$fsname2 || rc=1 + cat "$MOTR_M0T1FS_MOUNT_DIR"/$fsname2 > /tmp/$fsname2 || rc=1 diff $SOURCE_TXT /tmp/$fsname1 || rc=1 diff $SOURCE_TXT /tmp/$fsname2 || rc=1 - chmod 123 $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - chmod 456 $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 + chmod 123 "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 || rc=1 + chmod 456 "$MOTR_M0T1FS_MOUNT_DIR"/$fsname2 || rc=1 - cat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 > /dev/null || rc=1 - cat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 > /dev/null || rc=1 + cat "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 > /dev/null || rc=1 + cat "$MOTR_M0T1FS_MOUNT_DIR"/$fsname2 > /dev/null || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - stat $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 || rc=1 + stat "$MOTR_M0T1FS_MOUNT_DIR"/$fsname2 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$fsname2 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$fsname2 || rc=1 # Recreate and remove the file - touch $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$fsname1 || rc=1 - - cp -v $SOURCE_TXT $MOTR_M0T1FS_MOUNT_DIR/$file || rc=1 - cp -v $MOTR_M0T1FS_MOUNT_DIR/$file $MOTR_M0T1FS_MOUNT_DIR/$file1 || rc=1 - cp -v $MOTR_M0T1FS_MOUNT_DIR/$file $MOTR_M0T1FS_MOUNT_DIR/$file2 || rc=1 - cp -v $MOTR_M0T1FS_MOUNT_DIR/$file $MOTR_M0T1FS_MOUNT_DIR/$file3 || rc=1 - cp -v $MOTR_M0T1FS_MOUNT_DIR/$file $MOTR_M0T1FS_MOUNT_DIR/$file4 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$file || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$file1 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$file2 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$file3 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$file4 || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$fsname1 || rc=1 + + cp -v $SOURCE_TXT "$MOTR_M0T1FS_MOUNT_DIR"/$file || rc=1 + cp -v "$MOTR_M0T1FS_MOUNT_DIR"/$file "$MOTR_M0T1FS_MOUNT_DIR"/$file1 || rc=1 + cp -v "$MOTR_M0T1FS_MOUNT_DIR"/$file "$MOTR_M0T1FS_MOUNT_DIR"/$file2 || rc=1 + cp -v "$MOTR_M0T1FS_MOUNT_DIR"/$file "$MOTR_M0T1FS_MOUNT_DIR"/$file3 || rc=1 + cp -v "$MOTR_M0T1FS_MOUNT_DIR"/$file "$MOTR_M0T1FS_MOUNT_DIR"/$file4 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$file || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$file1 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$file2 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$file3 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$file4 || rc=1 unmount_and_clean @@ -736,21 +736,21 @@ m0t1fs_parallel_io_test() local mode=$1 BS=$((10 * 1024 * 1024)) echo "Parallel IO test" - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "$mode" || rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "$mode" || rc=1 mount | grep m0t1fs || rc=1 echo "Create files" for i in 0:100{0..4}000; do - touch $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 done for i in 0:100{0..4}000; do - setfattr -n writesize -v $BS $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 + setfattr -n writesize -v $BS "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 done - echo "Spawn parallel dd's" + echo "Spawn parallel dd\'s" for i in `seq 1 4` do fid="0:100"$i"000" - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$fid \ + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/"$fid" \ bs=$BS count=10 & dd_pid[$i]=$! done @@ -761,7 +761,7 @@ m0t1fs_parallel_io_test() wait ${dd_pid[$i]} done for i in 0:100{0..4}000; do - rm -f $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 done unmount_and_clean @@ -773,19 +773,19 @@ m0t1fs_big_bs_io_test() local mode=$1 echo "Big BS IO test" rc=0 - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR "$mode" || rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" "$mode" || rc=1 mount | grep m0t1fs || rc=1 echo "Create file" i=0:1000000 - touch $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 - setfattr -n writesize -v 65536 $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$i bs=32M count=1 || rc=1 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 + setfattr -n writesize -v 65536 "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/$i bs=32M count=1 || rc=1 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 echo "Test the error case" - touch $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 - setfattr -n writesize -v 4096 $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 - dd if=/dev/zero of=$MOTR_M0T1FS_MOUNT_DIR/$i bs=32M count=1 || rc=0 - rm -f $MOTR_M0T1FS_MOUNT_DIR/$i || rc=1 + touch "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 + setfattr -n writesize -v 4096 "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 + dd if=/dev/zero of="$MOTR_M0T1FS_MOUNT_DIR"/$i bs=32M count=1 || rc=0 + rm -f "$MOTR_M0T1FS_MOUNT_DIR"/$i || rc=1 unmount_and_clean return $rc @@ -799,25 +799,25 @@ m0t1fs_big_bs_io_test() m0t1fs_test_MOTR_2099() { local rc=0 - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR || rc=1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" || rc=1 - df $MOTR_M0T1FS_MOUNT_DIR - used_before=`df $MOTR_M0T1FS_MOUNT_DIR --output=used | tail -n 1` + df "$MOTR_M0T1FS_MOUNT_DIR" + used_before=`df "$MOTR_M0T1FS_MOUNT_DIR" --output=used | tail -n 1` for i in 0:00{0..9}{0..1}; do # This is to create 20 files, 200MB each, 8GB in total. m0t1fs_file=$MOTR_M0T1FS_MOUNT_DIR/${i} - touch_file $m0t1fs_file 8192 && run "dd if=/dev/zero of=$m0t1fs_file bs=200M count=1" || rc=1 + touch_file "$m0t1fs_file" 8192 && run "dd if=/dev/zero of=$m0t1fs_file bs=200M count=1" || rc=1 done - df $MOTR_M0T1FS_MOUNT_DIR - used_after=`df $MOTR_M0T1FS_MOUNT_DIR --output=used | tail -n 1` + df "$MOTR_M0T1FS_MOUNT_DIR" + used_after=`df "$MOTR_M0T1FS_MOUNT_DIR" --output=used | tail -n 1` for i in 0:00{0..9}{0..1}; do m0t1fs_file=$MOTR_M0T1FS_MOUNT_DIR/${i} - rm -f $m0t1fs_file + rm -f "$m0t1fs_file" done - df $MOTR_M0T1FS_MOUNT_DIR - used_delete=`df $MOTR_M0T1FS_MOUNT_DIR --output=used | tail -n 1` + df "$MOTR_M0T1FS_MOUNT_DIR" + used_delete=`df "$MOTR_M0T1FS_MOUNT_DIR" --output=used | tail -n 1` echo "used_before used_after used_delete $used_before $used_after $used_delete" - if [ $used_before -ne $used_delete ] ; then + if [ "$used_before" -ne "$used_delete" ] ; then echo "balloc space leak? After deletion, used blocks are not the same as before." rc=1 fi @@ -845,12 +845,12 @@ m0t1fs_system_tests() return 1 } - file_creation_test $MAX_NR_FILES || { + file_creation_test "$MAX_NR_FILES" || { echo "Failed: File creation test failed." return 1 } - file_creation_test $MAX_NR_FILES "oostore" || { + file_creation_test "$MAX_NR_FILES" "oostore" || { echo "Failed: File creation test failed." return 1 } @@ -890,12 +890,12 @@ m0t1fs_system_tests() return 1 } - io_combinations $POOL_WIDTH $NR_DATA $NR_PARITY $NR_SPARE || { + io_combinations "$POOL_WIDTH" "$NR_DATA" "$NR_PARITY" "$NR_SPARE" || { echo "Failed: IO failed.." return 1 } - io_combinations $POOL_WIDTH $NR_DATA $NR_PARITY $NR_SPARE "oostore"|| { + io_combinations "$POOL_WIDTH" "$NR_DATA" "$NR_PARITY" "$NR_SPARE" "oostore"|| { echo "Failed: IO failed oostore mode.." return 1 } diff --git a/m0t1fs/linux_kernel/st/m0t1fs_dgmode_io.sh b/m0t1fs/linux_kernel/st/m0t1fs_dgmode_io.sh index 43a8c71953e..2c8211aecaf 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_dgmode_io.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_dgmode_io.sh @@ -54,8 +54,8 @@ valid_count_get() local i=$((10-$j)) local bs=$1 input_file_size=`expr $i \* $bs` - echo $input_file_size - echo $ABCD_SOURCE_SIZE + echo "$input_file_size" + echo "$ABCD_SOURCE_SIZE" while [ $input_file_size -gt $ABCD_SOURCE_SIZE ] do j=$((RANDOM%9)) @@ -121,7 +121,7 @@ fmio_truncation_module() seek=`expr $cnt \+ 1` echo "Ensure that truncating to a size larger than the current one succeeds" - fmio_files_write dd bs=$blk_size count=1 seek=$seek + fmio_files_write dd bs=$blk_size count=1 seek="$seek" rc=$? if [ $rc -ne "0" ] then @@ -155,17 +155,17 @@ fmio_truncation_module() fmio_source_files_create() { - if [ $pattern == $ABCD ] || [ $pattern == $ALTERNATE ] + if [ "$pattern" == "$ABCD" ] || [ "$pattern" == "$ALTERNATE" ] then - $prog_file_pattern $source_abcd 2>&1 >> $MOTR_TEST_LOGFILE || { + $prog_file_pattern "$source_abcd" 2>&1 >> "$MOTR_TEST_LOGFILE" || { echo "Failed: m0t1fs_io_file_pattern..." return 1 } fi - if [ $pattern == $RANDOM1 ] || [ $pattern == $ALTERNATE ] + if [ "$pattern" == "$RANDOM1" ] || [ "$pattern" == "$ALTERNATE" ] then - dd if=/dev/urandom bs=$block_size count=$random_source_dd_count of=$source_random 2>&1 >> $MOTR_TEST_LOGFILE || { + dd if=/dev/urandom bs="$block_size" count=$random_source_dd_count of="$source_random" 2>&1 >> "$MOTR_TEST_LOGFILE" || { echo "Failed: dd..." return 1 } @@ -181,7 +181,7 @@ fmio_files_write() # Verify that 'the size of the file to be written' is not larger than # 'the ABCD source file size' - bs=$(echo $2 | cut -d= -f2) + bs=$(echo "$2" | cut -d= -f2) if [ $bs -lt 0 ] then @@ -207,13 +207,13 @@ fmio_files_write() # Select source file from the sandbox, according to the configured # pattern - if [ $pattern == $ABCD ] + if [ "$pattern" == "$ABCD" ] then source_sandbox=$source_abcd - elif [ $pattern == $RANDOM1 ] + elif [ "$pattern" == "$RANDOM1" ] then source_sandbox=$source_random - elif [ $pattern == $ALTERNATE ] + elif [ "$pattern" == "$ALTERNATE" ] then if [ `expr $dd_count % 2` == 0 ] then @@ -234,34 +234,34 @@ fmio_files_write() file_to_compare_m0t1fs="$MOTR_M0T1FS_MOUNT_DIR/0:1000$dd_count" echo "touch $file_to_compare_m0t1fs" echo "setfattr -n lid -v 4 $file_to_compare_m0t1fs" - touch $file_to_compare_m0t1fs - setfattr -n lid -v 4 $file_to_compare_m0t1fs - getfattr -n pver $file_to_compare_m0t1fs + touch "$file_to_compare_m0t1fs" + setfattr -n lid -v 4 "$file_to_compare_m0t1fs" + getfattr -n pver "$file_to_compare_m0t1fs" fi echo -e "Write to the files from sandbox and m0t1fs (dd_count #$dd_count):" echo -e "\t - $file_to_compare_sandbox \n\t - $file_to_compare_m0t1fs" $@ \ - if=$source_sandbox of=$file_to_compare_sandbox >> $MOTR_TEST_LOGFILE || { + if="$source_sandbox" of="$file_to_compare_sandbox" >> "$MOTR_TEST_LOGFILE" || { echo "Failed: dd..." return 1 } $@ \ - if=$source_sandbox of=$file_to_compare_m0t1fs >> $MOTR_TEST_LOGFILE || { + if="$source_sandbox" of="$file_to_compare_m0t1fs" >> "$MOTR_TEST_LOGFILE" || { echo "Failed: dd..." return 1 } - if [ $debug_level != $DEBUG_LEVEL_OFF ] + if [ "$debug_level" != "$DEBUG_LEVEL_OFF" ] then echo "od -A d -c $file_to_compare_sandbox | tail" - od -A d -c $file_to_compare_sandbox | tail + od -A d -c "$file_to_compare_sandbox" | tail echo "od -A d -c $file_to_compare_m0t1fs | tail" - od -A d -c $file_to_compare_m0t1fs | tail + od -A d -c "$file_to_compare_m0t1fs" | tail fi - if [ $debug_level == $DEBUG_LEVEL_3 ] + if [ "$debug_level" == "$DEBUG_LEVEL_3" ] then echo "stob_read after dd execution (dd_count #$dd_count)" fmio_stob_read_full @@ -279,9 +279,9 @@ fmio_files_compare() #Read file from m0t1fs with minimum possible count local block_size=`expr $ABCD_SOURCE_SIZE \+ $random_source_size` mount | grep m0t1 - ls -l $file_to_compare_m0t1fs - dd if=$file_to_compare_m0t1fs bs=$block_size count=1 of=$fmio_sandbox/local_m0t1fs_cp - cmp $file_to_compare_sandbox $fmio_sandbox/local_m0t1fs_cp + ls -l "$file_to_compare_m0t1fs" + dd if="$file_to_compare_m0t1fs" bs="$block_size" count=1 of="$fmio_sandbox"/local_m0t1fs_cp + cmp "$file_to_compare_sandbox" "$fmio_sandbox"/local_m0t1fs_cp rc=$? if [ $rc -ne 0 ] then @@ -289,12 +289,12 @@ fmio_files_compare() echo -e "\tparity group number may be calculated as:" echo -e "\t\tpg_no = differing_offset / (unit_size * N)\n" echo "od -A d -c $file_to_compare_sandbox | tail" - od -A d -c $file_to_compare_sandbox | tail + od -A d -c "$file_to_compare_sandbox" | tail echo "od -A d -c $file_to_compare_m0t1fs | tail" - od -A d -c $file_to_compare_m0t1fs | tail + od -A d -c "$file_to_compare_m0t1fs" | tail - if [ $debug_level == $DEBUG_LEVEL_2 ] || - [ $debug_level == $DEBUG_LEVEL_3 ] + if [ "$debug_level" == "$DEBUG_LEVEL_2" ] || + [ "$debug_level" == "$DEBUG_LEVEL_3" ] then echo "stob_read after data discrepancy is encountered (dd_count #$dd_count)" fmio_stob_read_full @@ -302,11 +302,11 @@ fmio_files_compare() fi echo "cmp output (dd_count #$dd_count): $rc" - if [ $debug_level == $DEBUG_LEVEL_INTERACTIVE ] + if [ "$debug_level" == "$DEBUG_LEVEL_INTERACTIVE" ] then fmio_if_to_continue_check fi - rm -f $fmio_sandbox/local_m0t1fs_cp + rm -f "$fmio_sandbox"/local_m0t1fs_cp return $rc } @@ -317,13 +317,13 @@ fmio_pool_mach_set_failure() echo "parameter 'device' is required" return 1 } - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then - disk_state_set "failed" $device || { + disk_state_set "failed" "$device" || { echo "Failed: disk_state_set failed for $device ..." return 1 } - disk_state_get $fail_devices + disk_state_get "$fail_devices" fi return 0 } @@ -336,9 +336,9 @@ fmio_sns_repair() return 1 } - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then - disk_state_set "repair" $device || return 1 + disk_state_set "repair" "$device" || return 1 sns_repair || { echo "Failed: SNS repair..." @@ -347,12 +347,12 @@ fmio_sns_repair() echo "wait for sns repair" wait_for_sns_repair_or_rebalance "repair" || return $? - disk_state_set "repaired" $device || return 1 + disk_state_set "repaired" "$device" || return 1 echo "sns repair done" - disk_state_get $fail_devices + disk_state_get "$fail_devices" fi - if [ $debug_level == $DEBUG_LEVEL_3 ] + if [ "$debug_level" == "$DEBUG_LEVEL_3" ] then echo "stob_read after repair (dd_count #$dd_count)" fmio_stob_read_full @@ -369,9 +369,9 @@ fmio_sns_rebalance() return 1 } - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then - disk_state_set "rebalance" $device || return 1 + disk_state_set "rebalance" "$device" || return 1 sns_rebalance || { echo "Failed: SNS rebalance..." @@ -380,10 +380,10 @@ fmio_sns_rebalance() echo "wait for sns rebalance" wait_for_sns_repair_or_rebalance "rebalance" || return $? - disk_state_set "online" $device || return 1 + disk_state_set "online" "$device" || return 1 echo "sns rebalance done" - disk_state_get $fail_devices + disk_state_get "$fail_devices" fi return 0 } @@ -411,7 +411,7 @@ fmio_stob_read_full() return 0 # Not returning error intentionally fi - if [ $file_kind != $SINGLE_FILE ] + if [ "$file_kind" != "$SINGLE_FILE" ] then echo "stob reading supported with $SINGLE_FILE kind only..." return 0 # Not returning error intentionally @@ -440,7 +440,7 @@ fmio_stob_read_full() echo "stobid $stobid" echo "od -A d -c $MOTR_M0T1FS_TEST_DIR/$ios/stobs/o/$stobid" - od -A d -c $MOTR_M0T1FS_TEST_DIR/$ios/stobs/o/$stobid + od -A d -c "$MOTR_M0T1FS_TEST_DIR"/$ios/stobs/o/"$stobid" # Note: During development, the above can be quickly modified # using 'sed' to read specific lines of interest from the stob # output. @@ -483,11 +483,11 @@ fmio_pre() file_to_create2="$MOTR_M0T1FS_MOUNT_DIR/0:11112" file_to_create3="$MOTR_M0T1FS_MOUNT_DIR/0:11113" - rm -rf $fmio_sandbox - mkdir -p $fmio_sandbox - if [ $debug_level == $DEBUG_LEVEL_STTEST ] + rm -rf "$fmio_sandbox" + mkdir -p "$fmio_sandbox" + if [ "$debug_level" == "$DEBUG_LEVEL_STTEST" ] then - mkdir $fmio_sandbox/tmp + mkdir "$fmio_sandbox"/tmp fi echo "Creating source files" @@ -511,9 +511,9 @@ fmio_io_test() fi echo "All the devices are online at this point" - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then - disk_state_get $fail_devices + disk_state_get "$fail_devices" fi echo "Creating files initially" @@ -549,9 +549,9 @@ fmio_io_test() } echo "Create a file after first $step: $file_to_create1" - touch $file_to_create1 + touch "$file_to_create1" rc=$? - getfattr -n pver $file_to_create1 + getfattr -n pver "$file_to_create1" if [ $rc -ne 0 ] then echo "Failed: create after first $step, rc $rc..." @@ -570,7 +570,7 @@ fmio_io_test() echo "Failed: IO or read after first $step, rc=$rc OOSTORE=$OOSTORE" return 1 fi - if [ $single_file_test -eq 1 ] + if [ "$single_file_test" -eq 1 ] then echo -e "\n*** $test_name test 2.1: Another IO and read after first $step ***" fmio_files_write dd bs=8821 count=5 seek=23 conv=notrunc @@ -580,9 +580,9 @@ fmio_io_test() return 1 fi fi - if [ $OOSTORE -eq 1 ] + if [ "$OOSTORE" -eq 1 ] then - rm -rf $file_to_create1 + rm -rf "$file_to_create1" rc=$? if [ $rc -ne 0 ] then @@ -601,9 +601,9 @@ fmio_io_test() fmio_sns_repair $fail_device2 || return 1 fi echo "Create a file after second $step: $file_to_create2" - touch $file_to_create2 + touch "$file_to_create2" rc=$? - getfattr -n pver $file_to_create2 + getfattr -n pver "$file_to_create2" if [ $rc -ne 0 ] then echo "Failed: create after second $step, rc $rc..." @@ -658,9 +658,9 @@ fmio_io_test() } echo "Create a file after third $step: $file_to_create3" - touch $file_to_create3 + touch "$file_to_create3" rc=$? - getfattr -n pver $file_to_create3 + getfattr -n pver "$file_to_create3" if [ $rc -ne 0 ] then echo "Failed: create after third $step, rc $rc..." @@ -683,7 +683,7 @@ fmio_io_test() fmio_failed_dev_test() { - if [ $failed_dev_test -eq 0 ] + if [ "$failed_dev_test" -eq 0 ] then return 1 fi @@ -700,7 +700,7 @@ fmio_failed_dev_test() fmio_repaired_dev_test() { - if [ $failed_dev_test -eq 1 ] + if [ "$failed_dev_test" -eq 1 ] then return 1 fi @@ -717,7 +717,7 @@ fmio_repaired_dev_test() fmio_motr_service_start() { - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then local multiple_pools=0 echo "About to start Motr service" @@ -739,7 +739,7 @@ fmio_motr_service_start() fmio_motr_service_stop() { - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then echo "About to stop Motr service" motr_service stop @@ -763,19 +763,19 @@ fmio_m0t1fs_mount() local mountopt="oostore,verify" fi echo "Mount options are $mountopt" - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 fi return 0 } fmio_m0t1fs_unmount() { - if [ $debug_level != $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" != "$DEBUG_LEVEL_STTEST" ] then echo "unmounting and cleaning.." - unmount_and_clean &>> $MOTR_TEST_LOGFILE + unmount_and_clean &>> "$MOTR_TEST_LOGFILE" fi return 0 } @@ -783,9 +783,9 @@ fmio_m0t1fs_unmount() fmio_m0t1fs_clean() { echo "cleaning Motr mountpoint.." - rm -f $file_to_create1 - rm -f $file_to_create2 - rm -f $file_to_create3 + rm -f "$file_to_create1" + rm -f "$file_to_create2" + rm -f "$file_to_create3" # Delete file created for single file io testing. rm -f "$MOTR_M0T1FS_MOUNT_DIR/0:10000" # Delete files created for separate file io testing. @@ -803,12 +803,12 @@ failure_modes_test() str="single file" # Set the unit size for the file on m0t1fs to 32K. This is # necessary for large IO. - touch $file_to_compare_m0t1fs + touch "$file_to_compare_m0t1fs" # Currently server-side receives an issue while writing a # large file after two repairs and one failure, when unit size # is more than 32K. - setfattr -n lid -v 4 $file_to_compare_m0t1fs - getfattr -n pver $file_to_compare_m0t1fs + setfattr -n lid -v 4 "$file_to_compare_m0t1fs" + getfattr -n pver "$file_to_compare_m0t1fs" if [ $? -ne "0" ] then echo "Setfattr failed." @@ -818,7 +818,7 @@ failure_modes_test() str="separate file" fi - if [ $failure_mode == $FAILED_DEVICES ] || [ $failure_mode == $BOTH_DEVICES ] + if [ "$failure_mode" == "$FAILED_DEVICES" ] || [ "$failure_mode" == "$BOTH_DEVICES" ] then echo "--------------------------------------------------------" echo "Start with the failed device IO testing ($str)" @@ -841,7 +841,7 @@ failure_modes_test() return 0 fi echo "Mark the devices online again before the next test" - fmio_repair_n_rebalance $fail_devices || return 1 + fmio_repair_n_rebalance "$fail_devices" || return 1 fi #@todo Run sns_repair and rebalance tests in oostore mode only when MOTR-1166 lands. # This is so because till then new pool version won't get created for @@ -849,7 +849,7 @@ failure_modes_test() # case. return 0 - if [ $failure_mode == $REPAIRED_DEVICES ] || [ $failure_mode == $BOTH_DEVICES ] + if [ "$failure_mode" == "$REPAIRED_DEVICES" ] || [ "$failure_mode" == "$BOTH_DEVICES" ] then echo "--------------------------------------------------------" echo "Starting with the repaired device IO testing ($str)" @@ -869,7 +869,7 @@ failure_modes_test() echo "--------------------------------------------------------" echo "Mark the devices online again before the next test" - fmio_sns_rebalance $fail_devices || { + fmio_sns_rebalance "$fail_devices" || { echo "Failed: sns rebalance..." return 1 } @@ -883,7 +883,7 @@ main() echo '*********************************************************' echo -n 'Running ' - [ $OOSTORE -eq 0 ] || echo -n 'non-' + [ "$OOSTORE" -eq 0 ] || echo -n 'non-' echo 'oostore test.' echo '*********************************************************' @@ -896,14 +896,14 @@ main() echo "*********************************************************" # Override this variable so as to use linux stob, for debugging - if [ $debug_level != $DEBUG_LEVEL_OFF ] + if [ "$debug_level" != "$DEBUG_LEVEL_OFF" ] then MOTR_STOB_DOMAIN="linux" fi # Override these variables so as to test the ST framework without # involving motr service and m0t1fs - if [ $debug_level == $DEBUG_LEVEL_STTEST ] + if [ "$debug_level" == "$DEBUG_LEVEL_STTEST" ] then MOTR_TEST_LOGFILE="$fmio_sandbox/log" MOTR_M0T1FS_MOUNT_DIR="$fmio_sandbox/tmp" @@ -923,13 +923,13 @@ main() fmio_pre || return 1 - fmio_m0t1fs_mount $OOSTORE || { + fmio_m0t1fs_mount "$OOSTORE" || { fmio_motr_service_stop return 1 } echo -e "Done with preprocessing for failure modes IO testing\n" - if [ $file_kind == $SINGLE_FILE ] || [ $file_kind == $BOTH_FILE_KINDS ] + if [ "$file_kind" == "$SINGLE_FILE" ] || [ "$file_kind" == "$BOTH_FILE_KINDS" ] then echo "========================================================" echo "Start with the single file IO testing" @@ -945,7 +945,7 @@ main() echo "========================================================" fi - if [ $file_kind == $SEPARATE_FILE ] || [ $file_kind == $BOTH_FILE_KINDS ] + if [ "$file_kind" == "$SEPARATE_FILE" ] || [ "$file_kind" == "$BOTH_FILE_KINDS" ] then echo "========================================================" echo "Start with the separate file IO testing" diff --git a/m0t1fs/linux_kernel/st/m0t1fs_multi_clients.sh b/m0t1fs/linux_kernel/st/m0t1fs_multi_clients.sh index cd19240affa..20a10709b5e 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_multi_clients.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_multi_clients.sh @@ -61,7 +61,7 @@ main() echo "Starting multi clients testing:" echo "Test log will be stored in $MOTR_TEST_LOGFILE." - multi_clients 2>&1 | tee -a $MOTR_TEST_LOGFILE + multi_clients 2>&1 | tee -a "$MOTR_TEST_LOGFILE" rc=${PIPESTATUS[0]} if [ $rc -eq 0 ]; then diff --git a/m0t1fs/linux_kernel/st/m0t1fs_rpc_cancel_test.sh b/m0t1fs/linux_kernel/st/m0t1fs_rpc_cancel_test.sh index 9751003e4d3..b58e78d73b0 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_rpc_cancel_test.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_rpc_cancel_test.sh @@ -110,25 +110,25 @@ rcancel_pre() load_motr_ctl_module || return 1 - rm -rf $rcancel_sandbox - mkdir -p $rcancel_sandbox + rm -rf "$rcancel_sandbox" + mkdir -p "$rcancel_sandbox" echo "Creating data file $source_abcd" - $prog_file_pattern $source_abcd 2>&1 >> $MOTR_TEST_LOGFILE || { + $prog_file_pattern "$source_abcd" 2>&1 >> "$MOTR_TEST_LOGFILE" || { echo "Failed: $prog_file_pattern" return 1 } echo "Creating source file $source_file" - dd if=$source_abcd of=$source_file bs=$bs count=$count >> $MOTR_TEST_LOGFILE 2>&1 + dd if="$source_abcd" of="$source_file" bs=$bs count=$count >> "$MOTR_TEST_LOGFILE" 2>&1 echo "ls -l $source_file (Reference for data files generated)" - ls -l $source_file + ls -l "$source_file" if [ $DEBUG_MODE -eq 1 ] then rm -f /var/log/motr/m0tr_ko.img rm -f /var/log/motr/m0trace.bin* - $M0_SRC_DIR/utils/trace/m0traced -K -d + "$M0_SRC_DIR"/utils/trace/m0traced -K -d fi } @@ -166,7 +166,7 @@ rcancel_session_cancel_fop() } echo "Test: Session canceled" - if [ $io_performed_during_cancel -eq 1 ]; then + if [ "$io_performed_during_cancel" -eq 1 ]; then echo "Test: sleep 4m so that the processing on the IOS is done that may need to wait for the net buf timeouts." echo "Such case is not applicable for production scenario where the IOS would be unreachable before session is canceled." sleep 4m @@ -185,7 +185,7 @@ rcancel_session_restore_fop() rcancel_mount_cancel_restore_unmount() { - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 rcancel_session_cancel_fop 0 rcancel_session_restore_fop unmount_and_clean @@ -193,7 +193,7 @@ rcancel_mount_cancel_restore_unmount() rcancel_mount_cancel_unmount() { - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 rcancel_session_cancel_fop 0 unmount_and_clean } @@ -204,7 +204,7 @@ rcancel_test_cleanup() local cl_nr_ops=$2 local cl_op=$3 - if [ $cl_op != "dd" ] && [ $cl_op != "touch" ] && [ $cl_op != "setfattr" ] && [ $cl_op != "getfattr" ] + if [ "$cl_op" != "dd" ] && [ "$cl_op" != "touch" ] && [ "$cl_op" != "setfattr" ] && [ "$cl_op" != "getfattr" ] then echo "rcancel_test_cleanup(): unsupported op: $cl_op" return @@ -237,7 +237,7 @@ rcancel_issue_writes_n_cancel() echo "Test: Writing to $wc_nr_files files on m0t1fs, for concurrent cancel" for ((i=0; i<$wc_nr_files; ++i)); do echo "dd if=$source_file of=$wc_file_base$i bs=$bs count=$count &" - dd if=$source_file of=$wc_file_base$i bs=$bs count=$count & + dd if="$source_file" of="$wc_file_base"$i bs=$bs count=$count & done dd_count=$(jobs | grep "dd.*wc_file_base" | wc -l) @@ -245,7 +245,7 @@ rcancel_issue_writes_n_cancel() if [ $dd_count -ne $wc_nr_files ] then echo "Failed to issue long running $wc_nr_files dd write requests" - rcancel_test_cleanup $wc_file_base $wc_nr_files "dd" + rcancel_test_cleanup "$wc_file_base" "$wc_nr_files" "dd" return 1 fi @@ -262,7 +262,7 @@ rcancel_issue_writes_n_cancel() if [ $dd_count -ne 0 ] then echo "Failed to complete $wc_nr_files dd requests" - rcancel_test_cleanup $wc_file_base $wc_nr_files "dd" + rcancel_test_cleanup "$wc_file_base" "$wc_nr_files" "dd" rcancel_session_restore_fop return 1 fi @@ -278,10 +278,10 @@ rcancel_cancel_during_write_test() local wt_rm_rc local wt_write_rc - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 # Cancel a session while running some parallel write operations - rcancel_issue_writes_n_cancel $wt_write_file_base $wt_write_nr_files || { + rcancel_issue_writes_n_cancel "$wt_write_file_base" $wt_write_nr_files || { unmount_and_clean return 1 } @@ -321,7 +321,7 @@ rcancel_cancel_during_write_test() echo "Test: ls for $wt_write_nr_files files after restore (written during cancel)" for ((i=0; i<$wt_write_nr_files; ++i)); do - ls -l $wt_write_file_base$i + ls -l "$wt_write_file_base"$i wt_ls_rc=$? echo "ls_rc: $wt_ls_rc" if [ $wt_ls_rc -ne 0 ] @@ -334,13 +334,13 @@ rcancel_cancel_during_write_test() echo "Test: read $wt_write_nr_files files after restore (written during cancel) (They receive either 'No such file or directory', 'EOF' or 'Input/output error' since some gobs/cobs may not be created)" for ((i=0; i<$wt_write_nr_files; ++i)); do - cmp $source_file $wt_write_file_base$i + cmp "$source_file" "$wt_write_file_base"$i echo "cmp $wt_write_file_base$i: rc $?" done echo "Test: rm $wt_write_nr_files files after restore (written during cancel) (Expected to fail for the files for which gob is not created)" for ((i=0; i<$wt_write_nr_files; ++i)); do - rm -f $wt_write_file_base$i + rm -f "$wt_write_file_base"$i wt_rm_rc=$? echo "rm -f $wt_write_file_base$i: rc $wt_rm_rc" if [ $wt_rm_rc -ne 0 ] @@ -351,7 +351,7 @@ rcancel_cancel_during_write_test() echo "Test: write to new $wt_write_nr_files files after restore" for ((i=0; i<$wt_write_nr_files; ++i)); do - dd if=$source_file of=$wt_write_new_file_base$i bs=$bs count=$count + dd if="$source_file" of="$wt_write_new_file_base"$i bs=$bs count=$count wt_write_rc=$? echo "Write to $wt_write_new_file_base$i: rc $wt_write_rc" if [ $wt_write_rc -ne 0 ] @@ -364,7 +364,7 @@ rcancel_cancel_during_write_test() echo "Test: ls new $wt_write_nr_files files after restore (written after restore)" for ((i=0; i<$wt_write_nr_files; ++i)); do - ls -l $wt_write_new_file_base$i + ls -l "$wt_write_new_file_base"$i wt_ls_rc=$? echo "ls_rc: $wt_ls_rc" if [ $wt_ls_rc -ne 0 ] @@ -377,7 +377,7 @@ rcancel_cancel_during_write_test() echo "Test: Read $wt_write_nr_files files after restore (written after restore)" for ((i=0; i<$wt_write_nr_files; ++i)); do - cmp $source_file $wt_write_new_file_base$i + cmp "$source_file" "$wt_write_new_file_base"$i wt_cmp_rc=$? echo "cmp $wt_write_new_file_base$i: rc $wt_cmp_rc" if [ $wt_cmp_rc -ne 0 ] @@ -390,7 +390,7 @@ rcancel_cancel_during_write_test() echo "Test: rm $wt_write_nr_files files after restore (written after restore)" for ((i=0; i<$wt_write_nr_files; ++i)); do - rm -f $wt_write_new_file_base$i + rm -f "$wt_write_new_file_base"$i wt_rm_rc=$? echo "rm -f $wt_write_new_file_base$i: rc $wt_rm_rc" if [ $wt_rm_rc -ne 0 ] @@ -412,7 +412,7 @@ rcancel_issue_reads_n_cancel() echo "Test: Reading from $rc_nr_files files on m0t1fs, for concurrent cancel" for ((i=0; i<$rc_nr_files; ++i)); do echo "dd if=$rc_file_base$i of=$rcancel_sandbox/$i bs=$bs count=$count &" - dd if=$rc_file_base$i of=$rcancel_sandbox/$i bs=$bs count=$count & + dd if="$rc_file_base"$i of="$rcancel_sandbox"/$i bs=$bs count=$count & done dd_count=$(jobs | grep "dd.*rc_file_base" | wc -l) @@ -420,7 +420,7 @@ rcancel_issue_reads_n_cancel() if [ $dd_count -ne $rc_nr_files ] then echo "Failed to issue long running $rc_nr_files dd read requests" - rcancel_test_cleanup $rc_file_base $rc_nr_files "dd" + rcancel_test_cleanup "$rc_file_base" "$rc_nr_files" "dd" return 1 fi @@ -434,7 +434,7 @@ rcancel_issue_reads_n_cancel() if [ $dd_count -ne 0 ] then echo "Failed to complete $rc_nr_files dd requests" - rcancel_test_cleanup $rc_file_base $rc_nr_files "dd" + rcancel_test_cleanup "$rc_file_base" "$rc_nr_files" "dd" rcancel_session_restore_fop return 1 fi @@ -447,22 +447,22 @@ rcancel_cancel_during_read_test() local rt_cmp_rc local rt_rm_rc - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 echo "Test: Have $rt_read_nr_files data files created on m0t1fs, to be used for read test" for ((i=0; i<$rt_read_nr_files; ++i)); do - touch $rt_read_file_base$i - dd if=$source_file of=$rt_read_file_base$i bs=$bs count=$count & + touch "$rt_read_file_base"$i + dd if="$source_file" of="$rt_read_file_base"$i bs=$bs count=$count & done wait echo "Files prepared for read test:" for ((i=0; i<$rt_read_nr_files; ++i)); do - ls -l $rt_read_file_base$i + ls -l "$rt_read_file_base"$i done # Cancel a session while running some parallel read operations - rcancel_issue_reads_n_cancel $rt_read_file_base $rt_read_nr_files || { + rcancel_issue_reads_n_cancel "$rt_read_file_base" $rt_read_nr_files || { unmount_and_clean return 1 } @@ -485,7 +485,7 @@ rcancel_cancel_during_read_test() # Test ls with canceled session echo "Test: ls for $rt_read_nr_files files before restore (Succeeds if "Operation canceled" is not received. Shall succeed for all, if rcancel_md_redundancy > 1)" for ((i=0; i<$rt_read_nr_files; ++i)); do - ls -l $rt_read_file_base$i + ls -l "$rt_read_file_base"$i echo "ls_rc: $?" done num=`grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' '` @@ -502,7 +502,7 @@ rcancel_cancel_during_read_test() echo "Test: read $rt_read_nr_files files after restore (written before cancel)" for ((i=0; i<$rt_read_nr_files; ++i)); do file_from_m0t1fs=$rt_read_file_base$i - cmp $source_file $file_from_m0t1fs + cmp "$source_file" "$file_from_m0t1fs" rt_cmp_rc=$? echo "cmp $file_from_m0t1fs: rc $rt_cmp_rc" if [ $rt_cmp_rc -ne 0 ] @@ -515,7 +515,7 @@ rcancel_cancel_during_read_test() echo "Test: rm $rt_read_nr_files files after restore (written before cancel)" for ((i=0; i<$rt_read_nr_files; ++i)); do - rm -f $rt_read_file_base$i + rm -f "$rt_read_file_base"$i rt_rm_rc=$? echo "rm -f $rt_read_file_base$i: rc $rt_rm_rc" if [ $rt_rm_rc -ne 0 ] @@ -542,7 +542,7 @@ rcancel_cancel_during_create_test() echo "Test: Create $create_nr_files files on m0t1fs" for ((i=0; i<$create_nr_files; ++i)); do echo "touch $create_file_base$i &" - touch $create_file_base$i & + touch "$create_file_base"$i & done create_count=$(jobs | grep "touch.*create_file_base" | wc -l) @@ -551,7 +551,7 @@ rcancel_cancel_during_create_test() then echo 'disable item_reply_received_fi drop_create_item_reply' > /sys/kernel/debug/motr/finject/ctl echo "Failed to issue long running $create_nr_files create requests" - rcancel_test_cleanup $create_file_base $create_nr_files "touch" + rcancel_test_cleanup "$create_file_base" $create_nr_files "touch" unmount_and_clean return 1 fi @@ -569,7 +569,7 @@ rcancel_cancel_during_create_test() if [ $create_count -ne 0 ] then echo "Failed to complete $create_nr_files create requests" - rcancel_test_cleanup $create_file_base $create_nr_files "touch" + rcancel_test_cleanup "$create_file_base" $create_nr_files "touch" rcancel_session_restore_fop unmount_and_clean return 1 @@ -578,7 +578,7 @@ rcancel_cancel_during_create_test() echo "Test: ls $create_nr_files files after cancel" for ((i=0; i<$create_nr_files; ++i)); do echo "ls -l $create_file_base$i" - ls -l $ct_create_file_base$i + ls -l "$ct_create_file_base"$i done rcancel_session_restore_fop @@ -595,7 +595,7 @@ rcancel_cancel_during_create_test() echo "Test: rm $create_nr_files files after restore" for ((i=0; i<$create_nr_files; ++i)); do - rm -f $create_file_base$i + rm -f "$create_file_base"$i rm_rc=$? echo "rm -f $create_file_base$i: rc $rm_rc" if [ $rm_rc -ne 0 ] @@ -614,20 +614,20 @@ rcancel_cancel_during_delete_test() local delete_nr_files=10 local delete_file_base="$MOTR_M0T1FS_MOUNT_DIR/0:5555" - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 echo "Test: Have $delete_nr_files files created on m0t1fs, to be used for delete op" i=0 - touch $delete_file_base$i # 0 size file, create half of those as empty + touch "$delete_file_base"$i # 0 size file, create half of those as empty for ((i=1; i<$delete_nr_files; ++i)); do - touch $delete_file_base$i - dd if=$source_file of=$delete_file_base$i bs=$bs count=$count & + touch "$delete_file_base"$i + dd if="$source_file" of="$delete_file_base"$i bs=$bs count=$count & done wait # Files prepared for delete test for ((i=0; i<$delete_nr_files; ++i)); do - ls -l $delete_file_base$i + ls -l "$delete_file_base"$i done echo "Test: Enable FP to drop delete reply items" @@ -636,7 +636,7 @@ rcancel_cancel_during_delete_test() echo "Test: Delete $delete_nr_files files from m0t1fs" for ((i=0; i<$delete_nr_files; ++i)); do echo "rm -f $delete_file_base$i &" - rm -f $delete_file_base$i & + rm -f "$delete_file_base"$i & done delete_count=$(jobs | grep "rm.*delete_file_base" | wc -l) @@ -645,7 +645,7 @@ rcancel_cancel_during_delete_test() then echo 'disable item_reply_received_fi drop_delete_item_reply' > /sys/kernel/debug/motr/finject/ctl echo "Failed to issue long running $delete_nr_files delete requests" - rcancel_test_cleanup $delete_file_base $delete_nr_files "rm" + rcancel_test_cleanup "$delete_file_base" $delete_nr_files "rm" unmount_and_clean return 1 fi @@ -658,12 +658,12 @@ rcancel_cancel_during_delete_test() wait # Ensure that all the file ops have either failed or finished - delete_count=$(pgrep -fc rm.*$delete_file_base) + delete_count=$(pgrep -fc rm.*"$delete_file_base") echo "delete processes running : $delete_count" if [ $delete_count -ne 0 ] then echo "Failed to complete $delete_nr_files delete requests" - rcancel_test_cleanup $delete_file_base $delete_nr_files "rm" + rcancel_test_cleanup "$delete_file_base" $delete_nr_files "rm" rcancel_session_restore_fop unmount_and_clean return 1 @@ -672,7 +672,7 @@ rcancel_cancel_during_delete_test() echo "Test: ls $delete_nr_files files after cancel" for ((i=0; i<$delete_nr_files; ++i)); do echo "ls -l $delete_file_base$i" - ls -l $delete_file_base$i + ls -l "$delete_file_base"$i done rcancel_session_restore_fop @@ -689,7 +689,7 @@ rcancel_cancel_during_delete_test() echo "Test: rm $delete_nr_files files after restore" for ((i=0; i<$delete_nr_files; ++i)); do - rm -f $delete_file_base$i + rm -f "$delete_file_base"$i rm_rc=$? echo "rm -f $delete_file_base$i: rc $rm_rc" if [ $rm_rc -ne 0 ] @@ -708,12 +708,12 @@ rcancel_cancel_during_setfattr_ops_test() local setfattr_nr_files=20 local setfattr_file_base="$MOTR_M0T1FS_MOUNT_DIR/0:6666" - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 echo "Test: Have $setfattr_nr_files files created on m0t1fs, to be used for setfattr op" for ((i=0; i<$setfattr_nr_files; ++i)); do echo "touch $setfattr_file_base$i" - touch $setfattr_file_base$i + touch "$setfattr_file_base"$i done echo "Test: Enable FP to drop setattr reply items" @@ -722,7 +722,7 @@ rcancel_cancel_during_setfattr_ops_test() echo "Test: setfattr for $setfattr_nr_files files on m0t1fs" for ((i=0; i<$setfattr_nr_files; ++i)); do echo "setfattr -n lid -v 4 $setfattr_file_base$i &" - setfattr -n lid -v 4 $setfattr_file_base$i & + setfattr -n lid -v 4 "$setfattr_file_base"$i & done setfattr_count=$(jobs | grep "setfattr.*setfattr_file_base" | wc -l) @@ -731,7 +731,7 @@ rcancel_cancel_during_setfattr_ops_test() then echo 'disable item_received_fi drop_setattr_item_reply' > /sys/kernel/debug/motr/finject/ctl echo "Failed to issue long running $setfattr_nr_files setfattr requests" - rcancel_test_cleanup $setfattr_file_base $setfattr_nr_files "setfattr" + rcancel_test_cleanup "$setfattr_file_base" $setfattr_nr_files "setfattr" unmount_and_clean return 1 fi @@ -750,7 +750,7 @@ rcancel_cancel_during_setfattr_ops_test() if [ $setfattr_count -ne 0 ] then echo "Failed to complete $setfattr_nr_files setfattr requests" - rcancel_test_cleanup $setfattr_file_base $setfattr_nr_files "setfattr" + rcancel_test_cleanup "$setfattr_file_base" $setfattr_nr_files "setfattr" rcancel_session_restore_fop unmount_and_clean return 1 @@ -771,7 +771,7 @@ rcancel_cancel_during_setfattr_ops_test() echo "Test: rm $setfattr_nr_files files after restore" for ((i=0; i<$setfattr_nr_files; ++i)); do - rm -f $setfattr_file_base$i + rm -f "$setfattr_file_base"$i rm_rc=$? echo "rm -f $setfattr_file_base$i: rc $rm_rc" if [ $rm_rc -ne 0 ] @@ -790,12 +790,12 @@ rcancel_cancel_during_getfattr_ops_test() local getfattr_nr_files=20 local getfattr_file_base="$MOTR_M0T1FS_MOUNT_DIR/0:7777" - mount_m0t1fs $MOTR_M0T1FS_MOUNT_DIR $mountopt || return 1 + mount_m0t1fs "$MOTR_M0T1FS_MOUNT_DIR" $mountopt || return 1 echo "Test: Have $getfattr_nr_files files created on m0t1fs, to be used for getfattr op" for ((i=0; i<$getfattr_nr_files; ++i)); do echo "touch $getfattr_file_base$i" - touch $getfattr_file_base$i + touch "$getfattr_file_base"$i done echo "Test: Enable FP to drop getattr reply items" @@ -804,7 +804,7 @@ rcancel_cancel_during_getfattr_ops_test() echo "Test: getfattr for $getfattr_nr_files files on m0t1fs" for ((i=0; i<$getfattr_nr_files; ++i)); do echo "getfattr -n lid $getfattr_file_base$i &" - getfattr -n lid $getfattr_file_base$i & + getfattr -n lid "$getfattr_file_base"$i & done getfattr_count=$(jobs | grep "getfattr.*getfattr_file_base" | wc -l) @@ -813,7 +813,7 @@ rcancel_cancel_during_getfattr_ops_test() then echo 'disable item_received_fi drop_getattr_item_reply' > /sys/kernel/debug/motr/finject/ctl echo "Failed to issue long running $getfattr_count getfattr requests" - rcancel_test_cleanup $getfattr_file_base $getfattr_nr_files "getfattr" + rcancel_test_cleanup "$getfattr_file_base" $getfattr_nr_files "getfattr" unmount_and_clean return 1 fi @@ -831,7 +831,7 @@ rcancel_cancel_during_getfattr_ops_test() if [ $getfattr_count -ne 0 ] then echo "Failed to complete $getfattr_nr_files getfattr ops" - rcancel_test_cleanup $getfattr_file_base $getfattr_nr_files "getfattr" + rcancel_test_cleanup "$getfattr_file_base" $getfattr_nr_files "getfattr" rcancel_session_restore_fop unmount_and_clean return 1 @@ -855,7 +855,7 @@ rcancel_cancel_during_getfattr_ops_test() echo "Test: rm $getfattr_nr_files files after restore" for ((i=0; i<$getfattr_nr_files; ++i)); do - rm -f $getfattr_file_base$i + rm -f "$getfattr_file_base"$i rm_rc=$? echo "rm -f $getfattr_file_base$i: rc $rm_rc" if [ $rm_rc -ne 0 ] @@ -956,7 +956,7 @@ rcancel_test() while_loop_i=`expr $while_loop_i \+ 1` # Wipe out contents from MOTR_TEST_LOGFILE - echo "" > $MOTR_TEST_LOGFILE + echo "" > "$MOTR_TEST_LOGFILE" rcancel_test_cases || { rcancel_post @@ -991,7 +991,7 @@ main() rcancel_motr_service_start || return 1 - rcancel_test 2>&1 | tee -a $MOTR_TEST_LOGFILE + rcancel_test 2>&1 | tee -a "$MOTR_TEST_LOGFILE" rc=${PIPESTATUS[0]} echo "rcancel_test rc $rc" if [ $rc -ne "0" ]; then diff --git a/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh b/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh index 4d41f1ab8aa..8b0fdc1fff4 100644 --- a/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh @@ -30,12 +30,12 @@ conf_ios_device_setup() if (($_id_count == 0)) then - eval $ids_out="'$ddev_id'" + eval "$ids_out"="'$ddev_id'" else - eval $ids_out="'$_ids, $ddev_id'" + eval "$ids_out"="'$_ids, $ddev_id'" fi - eval $id_count_out=$(( $_id_count + 1 )) + eval "$id_count_out"=$(( $_id_count + 1 )) #dev conf obj local ddev_obj="{0x64| (($ddev_id), $(($_DDEV_ID - 1)), 4, 1, 4096, 596000000000, 3, 4, \"/dev/loop$_DDEV_ID\")}" @@ -179,19 +179,19 @@ servers_stop() for pid in $pids; do echo -n "----- $pid stopping--------" - if checkpid $pid 2>&1; then + if checkpid "$pid" 2>&1; then # TERM first, then KILL if not dead - kill -TERM $pid &>/dev/null - proc=$(ps -o ppid= $pid) + kill -TERM "$pid" &>/dev/null + proc=$(ps -o ppid= "$pid") if [[ $proc -eq $$ ]]; then ## $pid is spawned by current shell wait $pid || rc=$? else sleep 5 - if checkpid $pid && sleep 5 && - checkpid $pid && sleep $delay && - checkpid $pid ; then - kill -KILL $pid &>/dev/null + if checkpid "$pid" && sleep 5 && + checkpid "$pid" && sleep $delay && + checkpid "$pid" ; then + kill -KILL "$pid" &>/dev/null sleep 1 fi fi @@ -247,13 +247,13 @@ motr_service() # start confd DIR=$MOTR_M0T1FS_TEST_DIR/confd - rm -rf $DIR - mkdir -p $DIR + rm -rf "$DIR" + mkdir -p "$DIR" ulimit -c unlimited local nr_mds=${#MDSEP[*]} local nr_ios=${#IOSEP[*]} - if [ $SINGLE_NODE -eq 1 ] ; then + if [ "$SINGLE_NODE" -eq 1 ] ; then nr_ios=1 nr_mds=1 fi @@ -267,7 +267,7 @@ motr_service() local ios=$(( $i + 1 )) local nr_dev=$nr_dev_per_ios DIR=$MOTR_M0T1FS_TEST_DIR/ios$ios - rm -rf $DIR + rm -rf "$DIR" mkdir -p $DIR if (($i < $remainder)) @@ -275,7 +275,7 @@ motr_service() nr_dev=$(($nr_dev_per_ios + 1)) fi - mkiosloopdevs $ios $nr_dev $DIR || return 1 + mkiosloopdevs $ios $nr_dev "$DIR" || return 1 done mkiosmddevs $nr_ios $P || return 1 @@ -309,7 +309,7 @@ EOF DIR=$MOTR_M0T1FS_TEST_DIR/confd CONFDB="$DIR/conf.xc" - build_conf $N $K $S $P $multiple_pools | tee $DIR/conf.xc + build_conf "$N" "$K" "$S" "$P" "$multiple_pools" | tee $DIR/conf.xc common_opts="-D db -S stobs -A linuxstob:addb-stobs \ -w $P -m $MAX_RPC_MSG_SIZE \ -q $TM_MIN_RECV_QUEUE_LEN -N 100663296 -C 262144 -K 100663296 -k 262144" @@ -319,7 +319,7 @@ EOF -c $CONFDB" cmd="cd $DIR && exec $prog_mkfs -F $opts |& tee -a m0mkfs.log" - echo $cmd + echo "$cmd" (eval "$cmd") # spawn confd @@ -346,16 +346,16 @@ EOF for ((i=0; i < $nr_mds; i++)) ; do local mds=$(( $i + 1 )) DIR=$MOTR_M0T1FS_TEST_DIR/mds$mds - rm -rf $DIR - mkdir -p $DIR + rm -rf "$DIR" + mkdir -p "$DIR" - tmid=$(echo ${MDSEP[$i]} | cut -d: -f3) + tmid=$(echo "${MDSEP[$i]}" | cut -d: -f3) ulimit -c unlimited cmd="cd $DIR && exec \ $prog_mkfs -F -T ad \ $common_opts -e $XPRT:${lnet_nid}:${MDSEP[$i]%:*:*}:$MKFS_PORTAL:$tmid \ -c $CONFDB |& tee -a m0mkfs.log" - echo $cmd + echo "$cmd" eval "$cmd" done @@ -365,7 +365,7 @@ EOF proc_fid="'<"$PROC_FID_CNTR:$i">'" DIR=$MOTR_M0T1FS_TEST_DIR/ios$ios - tmid=$(echo ${IOSEP[$i]} | cut -d: -f3) + tmid=$(echo "${IOSEP[$i]}" | cut -d: -f3) ulimit -c unlimited cmd="cd $DIR && exec \ $prog_mkfs -F -T $MOTR_STOB_DOMAIN \ @@ -395,12 +395,12 @@ EOF DIR=$MOTR_M0T1FS_TEST_DIR/ha cmd="cd $DIR && exec $prog_start $opts |& tee -a m0d.log" local m0d_log=$DIR/m0d.log - touch $m0d_log - echo $cmd + touch "$m0d_log" + echo "$cmd" (eval "$cmd") & # Wait for HA agent to start - while ! grep CTRL $MOTR_M0T1FS_TEST_DIR/ha/m0d.log > /dev/null; + while ! grep CTRL "$MOTR_M0T1FS_TEST_DIR"/ha/m0d.log > /dev/null; do sleep 2 done @@ -429,7 +429,7 @@ EOF echo $cmd local m0d_log=$DIR/m0d.log - touch $m0d_log + touch "$m0d_log" (eval "$cmd") & # let instance with RMS be the first initialised one; @@ -457,7 +457,7 @@ EOF echo $cmd local m0d_log=$DIR/m0d.log - touch $m0d_log + touch "$m0d_log" (eval "$cmd") & IOS4_CMD=$cmd done @@ -470,18 +470,18 @@ EOF $common_opts -e $XPRT:${lnet_nid}:$IOS_PVER2_EP \ -f $proc_fid \ -H ${lnet_nid}:$HA_EP |& tee -a m0d.log" - echo $cmd + echo "$cmd" local m0d_log=$DIR/m0d.log - touch $m0d_log + touch "$m0d_log" #Save IOS5, to start it again after controller HA event. IOS5_CMD=$cmd (eval "$cmd") & fi # Wait for confd to start - local confd_log=$MOTR_M0T1FS_TEST_DIR/confd/m0d.log - while ! grep CTRL $confd_log > /dev/null; do + local confd_log="$MOTR_M0T1FS_TEST_DIR/confd/m0d.log" + while ! grep CTRL "$confd_log" > /dev/null; do sleep 2 done echo "Motr confd started." @@ -492,7 +492,7 @@ EOF local mds=$(( $i + 1 )) DIR=$MOTR_M0T1FS_TEST_DIR/mds$mds local m0d_log=$DIR/m0d.log - while ! grep CTRL $m0d_log > /dev/null; do + while ! grep CTRL "$m0d_log" > /dev/null; do sleep 2 done done @@ -503,12 +503,12 @@ EOF local ios=$(( $i + 1 )) DIR=$MOTR_M0T1FS_TEST_DIR/ios$ios local m0d_log=$DIR/m0d.log - while ! grep CTRL $m0d_log > /dev/null; do + while ! grep CTRL "$m0d_log" > /dev/null; do sleep 2 done done if ((multiple_pools == 1)); then - while ! grep CTRL $MOTR_M0T1FS_TEST_DIR/ios5/m0d.log > /dev/null; + while ! grep CTRL "$MOTR_M0T1FS_TEST_DIR"/ios5/m0d.log > /dev/null; do sleep 2 done @@ -519,7 +519,7 @@ EOF } stop() { - servers_stop $prog_start || rc=$? + servers_stop "$prog_start" || rc=$? unprepare || rc=$? return $rc } diff --git a/m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1f.sh b/m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1f.sh index da35850792c..d3696ac7c36 100755 --- a/m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1f.sh +++ b/m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1f.sh @@ -61,8 +61,8 @@ sns_repair_test() local_write $src_bs $src_count || return $? for ((i=0; i < ${#file[*]}; i++)) ; do - _dd ${file[$i]} $unit_size ${file_size[$i]} || return $? - _md5sum ${file[$i]} || return $? + _dd "${file[$i]}" $unit_size "${file_size[$i]}" || return $? + _md5sum "${file[$i]}" || return $? done for ((i=0; i < ${#IOSEP[*]}; i++)) ; do @@ -184,7 +184,7 @@ main() fi echo "unmounting and cleaning.." - unmount_and_clean &>> $MOTR_TEST_LOGFILE + unmount_and_clean &>> "$MOTR_TEST_LOGFILE" motr_service stop || { echo "Failed to stop Motr Service." diff --git a/motr/st/utils/motr_device_util.sh b/motr/st/utils/motr_device_util.sh index feea9249b6c..97e03a91bcc 100755 --- a/motr/st/utils/motr_device_util.sh +++ b/motr/st/utils/motr_device_util.sh @@ -35,7 +35,7 @@ m0t1fs_st_dir=$motr_st_util_dir/../../../m0t1fs/linux_kernel/st motr_st_set_failed_devices() { - disk_state_set "failed" $1 || { + disk_state_set "failed" "$1" || { echo "Failed: pool_mach_set_failure..." return 1 } @@ -43,7 +43,7 @@ motr_st_set_failed_devices() motr_st_query_devices() { - disk_state_get $1 || { + disk_state_get "$1" || { echo "Failed: pool_mach_query..." return 1 } @@ -65,10 +65,10 @@ devices=$2 case "$cmd" in down) - motr_st_set_failed_devices $devices + motr_st_set_failed_devices "$devices" ;; query) - motr_st_query_devices $devices + motr_st_query_devices "$devices" ;; *) usage diff --git a/motr/st/utils/motr_dgmode_io_st.sh b/motr/st/utils/motr_dgmode_io_st.sh index ae08153e007..4226f7f7290 100755 --- a/motr/st/utils/motr_dgmode_io_st.sh +++ b/motr/st/utils/motr_dgmode_io_st.sh @@ -72,14 +72,14 @@ main() BLOCKSIZE=16384 #4096 BLOCKCOUNT=3 echo "dd if=/dev/urandom bs=$BLOCKSIZE count=$BLOCKCOUNT of=$src_file" - dd if=/dev/urandom bs=$BLOCKSIZE count=$BLOCKCOUNT of=$src_file \ - 2> $MOTR_TEST_LOGFILE || { + dd if=/dev/urandom bs=$BLOCKSIZE count=$BLOCKCOUNT of="$src_file" \ + 2> "$MOTR_TEST_LOGFILE" || { echo "Failed to create a source file" motr_service_stop return 1 } - mkdir $MOTR_TRACE_DIR + mkdir "$MOTR_TRACE_DIR" motr_service_start $N $K $S $P $stride @@ -90,7 +90,7 @@ main() # object. It has to be checked with S3 level or in motr trace logs. # write an object - io_conduct "WRITE" $src_file $OBJ_ID1 "false" + io_conduct "WRITE" "$src_file" $OBJ_ID1 "false" if [ $rc -ne "0" ] then echo "Healthy mode, write failed." @@ -99,14 +99,14 @@ main() echo "Healthy mode write succeeds." # read the written object - io_conduct "READ" $OBJ_ID1 $dest_file "false" + io_conduct "READ" $OBJ_ID1 "$dest_file" "false" rc=$? if [ $rc -ne "0" ] then echo "Healthy mode, read failed." error_handling $rc fi - diff $src_file $dest_file + diff "$src_file" "$dest_file" rc=$? if [ $rc -ne "0" ] then @@ -115,14 +115,14 @@ main() fi echo "Healthy mode, read file succeeds." # read the written object - io_conduct "READ" $OBJ_ID1 $dest_file $read_verify + io_conduct "READ" $OBJ_ID1 "$dest_file" $read_verify rc=$? if [ $rc -ne "0" ] then echo "Healthy mode, read verify failed." error_handling $rc fi - diff $src_file $dest_file + diff "$src_file" "$dest_file" rc=$? if [ $rc -ne "0" ] then @@ -142,8 +142,8 @@ main() } # Test degraded read - rm -f $dest_file - io_conduct "READ" $OBJ_ID1 $dest_file "false" + rm -f "$dest_file" + io_conduct "READ" $OBJ_ID1 "$dest_file" "false" rc=$? if [ $rc -ne "0" ] then @@ -151,17 +151,17 @@ main() error_handling $rc fi echo "Dgmode Read of 1st obj succeeds." - diff $src_file $dest_file + diff "$src_file" "$dest_file" rc=$? if [ $rc -ne "0" ] then echo "Obj read in degraded mode differs." error_handling $rc fi - rm -f $dest_file + rm -f "$dest_file" #Dgmode read of with Parity Verify. - io_conduct "READ" $OBJ_ID1 $dest_file $read_verify + io_conduct "READ" $OBJ_ID1 "$dest_file" $read_verify rc=$? if [ $rc -ne "0" ] then @@ -169,17 +169,17 @@ main() error_handling $rc fi echo "Dgmode Parity verify Read of 1st obj succeeds." - diff $src_file $dest_file + diff "$src_file" "$dest_file" rc=$? if [ $rc -ne "0" ] then echo "Obj read in degraded mode differs." error_handling $rc fi - rm -f $dest_file + rm -f "$dest_file" # Test write, when a disk is failed - io_conduct "WRITE" $src_file $OBJ_ID2 "false" + io_conduct "WRITE" "$src_file" $OBJ_ID2 "false" rc=$? if [ $rc -ne "0" ] then @@ -187,7 +187,7 @@ main() error_handling $rc fi echo "New Obj write succeeds." - rm -f $dest_file + rm -f "$dest_file" echo "Fail another disk" fail_device3=3 @@ -199,14 +199,14 @@ main() # Read a file from the new pool version. - io_conduct "READ" $OBJ_ID2 $dest_file "false" + io_conduct "READ" $OBJ_ID2 "$dest_file" "false" rc=$? if [ $rc -ne "0" ] then echo "Reading a file from a new pool version failed." error_handling $rc fi - diff $src_file $dest_file + diff "$src_file" "$dest_file" rc=$? if [ $rc -ne "0" ] then @@ -216,14 +216,14 @@ main() echo "Motr: Dgmod mode read from new pver succeeds." #Read in Parity Verify from new pool version. - io_conduct "READ" $OBJ_ID2 $dest_file $read_verify + io_conduct "READ" $OBJ_ID2 "$dest_file" $read_verify rc=$? if [ $rc -ne "0" ] then echo "Reading a file from a new pool version failed." error_handling $rc fi - diff $src_file $dest_file + diff "$src_file" "$dest_file" rc=$? if [ $rc -ne "0" ] then @@ -235,7 +235,7 @@ main() motr_inst_cnt=`expr $cnt - 1` for i in `seq 1 $motr_inst_cnt` do - echo "motr pids=${motr_pids[$i]}" >> $MOTR_TEST_LOGFILE + echo "motr pids=${motr_pids[$i]}" >> "$MOTR_TEST_LOGFILE" done motr_service_stop || rc=1 diff --git a/motr/st/utils/motr_rm_lock_cc_io.sh b/motr/st/utils/motr_rm_lock_cc_io.sh index fa52e9eec36..03e1de5e583 100755 --- a/motr/st/utils/motr_rm_lock_cc_io.sh +++ b/motr/st/utils/motr_rm_lock_cc_io.sh @@ -48,7 +48,7 @@ check_file_version() return 1 fi - diff $dest_file$j $src_file$i > /dev/null || { + diff "$dest_file"$j "$src_file"$i > /dev/null || { ((i++)) continue } @@ -85,11 +85,11 @@ main() rm -f $src_file $dest_file $src_file'1' dd if=/dev/urandom bs=$block_size count=$block_count of=$src_file \ - 2> $MOTR_TEST_LOGFILE || { + 2> "$MOTR_TEST_LOGFILE" || { motr_error_handling $? "Failed to create a source file" } dd if=/dev/urandom bs=$block_size count=$block_count of=$src_file'1' \ - 2> $MOTR_TEST_LOGFILE || { + 2> "$MOTR_TEST_LOGFILE" || { MOTR_error_handling $? "Failed to create a source file" } mkdir $MOTR_TRACE_DIR @@ -99,7 +99,7 @@ main() tmp_src="$src_file$i" rm -f $tmp_src dd if=/dev/urandom bs=$block_size count=$block_count of=$tmp_src \ - 2> $MOTR_TEST_LOGFILE || { + 2> "$MOTR_TEST_LOGFILE" || { motr_error_handling $? "Failed to create a source file" } SRC_FILES+=" $tmp_src" @@ -120,12 +120,12 @@ main() ############################################################################## echo "Read obj while write/update is in process." - $motr_st_util_dir/m0cp $MOTR_PARAMS_2 -o $object_id $src_file \ + "$motr_st_util_dir"/m0cp "$MOTR_PARAMS_2" -o $object_id $src_file \ -s $block_size -c $block_count -e & pid=$! sleep 2 - $motr_st_util_dir/m0cat $MOTR_PARAMS -o $object_id -s $block_size \ + "$motr_st_util_dir"/m0cat "$MOTR_PARAMS" -o $object_id -s $block_size \ -c $block_count -e $dest_file || { motr_error_handling $? "Failed to read object" } @@ -133,10 +133,10 @@ main() wait $pid diff $src_file $dest_file || { rc = $? - motr_error_handling $rc "Files are different when concurrent read/write" + motr_error_handling "$rc" "Files are different when concurrent read/write" } - $motr_st_util_dir/m0unlink $MOTR_PARAMS -o $object_id || { + "$motr_st_util_dir"/m0unlink "$MOTR_PARAMS" -o $object_id || { motr_error_handling $? "Failed to delete object" } @@ -144,13 +144,13 @@ main() ############################################################################### echo "Delete obj while write/update is in process." - $motr_st_util_dir/m0cp $MOTR_PARAMS_2 -o $object_id $src_file \ + "$motr_st_util_dir"/m0cp "$MOTR_PARAMS_2" -o $object_id $src_file \ -s $block_size -c $block_count -e & pid=$! sleep 2 - $motr_st_util_dir/m0unlink $MOTR_PARAMS -o $object_id -e || { + "$motr_st_util_dir"/m0unlink "$MOTR_PARAMS" -o $object_id -e || { motr_error_handling $? "Failed to delete object" } wait $pid @@ -158,50 +158,50 @@ main() ############################################################################### echo "Delete obj while read is in process." - $motr_st_util_dir/m0cp $MOTR_PARAMS -o $object_id $src_file \ + "$motr_st_util_dir"/m0cp "$MOTR_PARAMS" -o $object_id $src_file \ -s $block_size -c $block_count -e || { motr_error_handling $? "Failed to copy object" } - $motr_st_util_dir/m0cat $MOTR_PARAMS_2 -o $object_id -s $block_size \ + "$motr_st_util_dir"/m0cat "$MOTR_PARAMS_2" -o $object_id -s $block_size \ -c $block_count -e $dest_file & pid=$! sleep 2 - $motr_st_util_dir/m0unlink $MOTR_PARAMS -o $object_id -e || { + "$motr_st_util_dir"/m0unlink "$MOTR_PARAMS" -o $object_id -e || { motr_error_handling $? "Failed to delete object" } wait $pid diff $src_file $dest_file || { rc = $? - motr_error_handling $rc "Files are different when concurrent delete/write" + motr_error_handling "$rc" "Files are different when concurrent delete/write" } rm -f $dest_file ############################################################################# echo "Test exclusivity among Readers and Writers" - $motr_st_util_dir/m0cp $MOTR_PARAMS -o $object_id $src_file \ + "$motr_st_util_dir"/m0cp "$MOTR_PARAMS" -o $object_id $src_file \ -s $block_size -c $block_count -e || { motr_error_handling $? "Failed to copy object" } - $motr_st_util_dir/m0cat $MOTR_PARAMS_2 -o $object_id -s $block_size \ + "$motr_st_util_dir"/m0cat "$MOTR_PARAMS_2" -o $object_id -s $block_size \ -c $block_count -e $dest_file'1' & pid1=$! - $motr_st_util_dir/m0cat $MOTR_PARAMS_3 -o $object_id -s $block_size \ + "$motr_st_util_dir"/m0cat "$MOTR_PARAMS_3" -o $object_id -s $block_size \ -c $block_count -e $dest_file'2' & pid2=$! sleep 2 - $motr_st_util_dir/m0cp $MOTR_PARAMS -o $object_id $src_file'1' \ + "$motr_st_util_dir"/m0cp "$MOTR_PARAMS" -o $object_id $src_file'1' \ -s $block_size -c $block_count -e -u || { motr_error_handling $? "Failed to update the object" } wait $pid1 $pid2 - $motr_st_util_dir/m0unlink $MOTR_PARAMS -o $object_id -e || { + "$motr_st_util_dir"/m0unlink "$MOTR_PARAMS" -o $object_id -e || { motr_error_handling $? "Failed to delete object" } @@ -232,23 +232,23 @@ main() rm -f $dest_file'1' $dest_file'2' ############################################################################# echo "Test exclusivity among Writers" - $motr_st_util_dir/m0cp $MOTR_PARAMS -o $object_id $src_file \ + "$motr_st_util_dir"/m0cp "$MOTR_PARAMS" -o $object_id $src_file \ -s $block_size -c $block_count -e & pid1=$! sleep 2 - $motr_st_util_dir/m0cp $MOTR_PARAMS_2 -o $object_id $src_file'1' \ + "$motr_st_util_dir"/m0cp "$MOTR_PARAMS_2" -o $object_id $src_file'1' \ -s $block_size -c $block_count -e -u & pid2=$! sleep 2 - $motr_st_util_dir/m0cat $MOTR_PARAMS_3 -o $object_id -s $block_size \ + "$motr_st_util_dir"/m0cat "$MOTR_PARAMS_3" -o $object_id -s $block_size \ -c $block_count -e $dest_file || { motr_error_handling $? "Failed to read object" } wait $pid1 $pid2 - $motr_st_util_dir/m0unlink $MOTR_PARAMS -o $object_id -e || { + "$motr_st_util_dir"/m0unlink "$MOTR_PARAMS" -o $object_id -e || { motr_error_handling $? "Failed to delete object" } @@ -268,14 +268,14 @@ main() ############################################################################# echo "Launch multiple Writer and Reader threads." echo "To check the data read by reader threads is fresh." - $motr_st_util_dir/m0cc_cp_cat $MOTR_PARAMS -W $writer_numb \ + "$motr_st_util_dir"/m0cc_cp_cat "$MOTR_PARAMS" -W $writer_numb \ -R $reader_numb -o $object_id \ -s $block_size -c $block_count \ - $SRC_FILES $DEST_FILES || { + "$SRC_FILES" "$DEST_FILES" || { motr_error_handling $? "Failed concurrent read write" } - $motr_st_util_dir/m0unlink $MOTR_PARAMS -o $object_id -e || { + "$motr_st_util_dir"/m0unlink "$MOTR_PARAMS" -o $object_id -e || { motr_error_handling $? "Failed to delete object" } @@ -284,7 +284,7 @@ main() motr_error_handling $? "Stale data read" } - clean &>>$MOTR_TEST_LOGFILE + clean &>>"$MOTR_TEST_LOGFILE" motr_service_stop }