- # create test directory
- TESTDIR=$DIR/d0.$TESTSUITE
- mkdir -p $TESTDIR || error "mkdir $TESTDIR failed"
-
- # create some dirs and files on the filesystem
- create_files $TESTDIR $NUMDIRS $NUMFILES
-
- # get the objids for files in group $OBJGRP on the OST with index $OSTIDX
- OST_REMOVE=$(get_objects $OSTIDX $OBJGRP \
- $(seq -f $TESTDIR/testfile.%g $NUMFILES))
-
- # get the node name and target device for the OST with index $OSTIDX
- OSTNODE=$(get_ost_node $OSTIDX) || error "get_ost_node by index $OSTIDX failed"
- OSTDEV=$(get_ost_dev $OSTNODE $OSTIDX) ||
- error "get_ost_dev $OSTNODE $OSTIDX failed"
-
- # get the file names to be duplicated on the MDS
- MDS_DUPE=$(get_files dup $TESTDIR $NUMFILES) || error "$MDS_DUPE"
- # get the file names to be removed from the MDS
- MDS_REMOVE=$(get_files remove $TESTDIR $NUMFILES) || error "$MDS_REMOVE"
-
- stopall -f || error "cleanupall failed"
-
- # remove objects associated with files in group $OBJGRP
- # on the OST with index $OSTIDX
- remove_objects $OSTDEV $OBJGRP $OST_REMOVE ||
- error "removing objects failed"
-
- # remove files from MDS
- remove_files $SINGLEMDS $MDTDEV $MDS_REMOVE || error "removing files failed"
-
- # create EAs on files so objects are referenced from different files
- duplicate_files $SINGLEMDS $MDTDEV $MDS_DUPE ||
- error "duplicating files failed"
- FSCK_MAX_ERR=1 # file system errors corrected
+ # create test directory
+ mkdir -p $TESTDIR || error "mkdir $TESTDIR failed"
+
+ # create some dirs and files on the filesystem
+ create_files $TESTDIR $NUMDIRS $NUMFILES
+
+ # get objids for files in group $OBJGRP on the OST with index $OSTIDX
+ echo "objects to be removed, leaving dangling references:"
+ OST_REMOVE=$(get_objects $OSTIDX $OBJGRP \
+ $(seq -f $TESTDIR/testfile.%g $NUMFILES))
+
+ # get the node name and target device for the OST with index $OSTIDX
+ OSTNODE=$(facet_active_host ost$((OSTIDX + 1)))
+ OSTDEV=$(get_ost_dev $OSTNODE $OSTIDX) ||
+ error "get_ost_dev $OSTNODE $OSTIDX failed"
+
+ # get the file names to be duplicated on the MDS
+ echo "files to be duplicated, leaving double-referenced objects:"
+ MDS_DUPE=$(get_files dup $TESTDIR $NUMFILES) || error "$MDS_DUPE"
+ # get the file names to be removed from the MDS
+ echo "files to be removed, leaving orphan objects:"
+ MDS_REMOVE=$(get_files remove $TESTDIR $NUMFILES) || error "$MDS_REMOVE"
+
+ stopall -f || error "cleanupall failed"
+
+ # remove objects associated with files in group $OBJGRP
+ # on the OST with index $OSTIDX
+ remove_objects ost$((OSTIDX + 1)) $OSTDEV $OBJGRP $OST_REMOVE ||
+ error "removing objects failed"
+
+ # remove files from MDS
+ remove_files $SINGLEMDS $MDTDEV $MDS_REMOVE ||
+ error "removing files failed"
+
+ # create EAs on files so objects are referenced from different files
+ duplicate_files $SINGLEMDS $MDTDEV $MDS_DUPE ||
+ error "duplicating files failed"
+ FSCK_MAX_ERR=1 # file system errors corrected