}
run_test 87b "write replay with changed data (checksum resend)"
+test_88() { #bug 17485
+ mkdir -p $DIR/$tdir
+ mkdir -p $TMP/$tdir
+
+ lfs setstripe $DIR/$tdir -o 0 -c 1 || error "setstripe"
+
+ replay_barrier ost1
+ replay_barrier mds1
+
+ # exhaust precreations on ost1
+ local OST=$(lfs osts | grep ^0": " | awk '{print $2}' | sed -e 's/_UUID$//')
+ local mdtosc=$(get_mdtosc_proc_path $OST)
+ local last_id=$(do_facet mds1 lctl get_param -n osc.$mdtosc.prealloc_last_id)
+ local next_id=$(do_facet mds1 lctl get_param -n osc.$mdtosc.prealloc_next_id)
+ echo "before test: last_id = $last_id, next_id = $next_id"
+
+ echo "Creating to objid $last_id on ost $OST..."
+ createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2))
+
+ #create some files to use some uncommitted objids
+ last_id=$(($last_id + 1))
+ createmany -o $DIR/$tdir/f-%d $last_id 8
+
+ last_id2=$(do_facet mds1 lctl get_param -n osc.$mdtosc.prealloc_last_id)
+ next_id2=$(do_facet mds1 lctl get_param -n osc.$mdtosc.prealloc_next_id)
+ echo "before recovery: last_id = $last_id2, next_id = $next_id2"
+
+ shutdown_facet mds1
+ shutdown_facet ost1
+
+ reboot_facet mds1
+ change_active mds1
+ wait_for mds1
+ mount_facet mds1 || error "Restart of mds failed"
+
+ reboot_facet ost1
+ change_active ost1
+ wait_for ost1
+ mount_facet ost1 || error "Restart of ost1 failed"
+
+ clients_up
+
+ last_id2=$(do_facet mds1 lctl get_param -n osc.$mdtosc.prealloc_last_id)
+ next_id2=$(do_facet mds1 lctl get_param -n osc.$mdtosc.prealloc_next_id)
+ echo "after recovery: last_id = $last_id2, next_id = $next_id2"
+
+ # create new files, which should use new objids, and ensure the orphan
+ # cleanup phase for ost1 is completed at the same time
+ for i in `seq 8`; do
+ file_id=$(($last_id + 10 + $i))
+ dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
+ done
+
+ # if the objids were not recreated, then "ls" will failed for -ENOENT
+ ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
+
+ local file_id
+ # write into previously created files
+ for i in `seq 8`; do
+ file_id=$(($last_id + $i))
+ dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
+ cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
+ done
+
+ # compare the content
+ for i in `seq 8`; do
+ file_id=$(($last_id + $i))
+ cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id || error "the content" \
+ "of file is modified!"
+ done
+
+ rm -fr $TMP/$tdir
+}
+run_test 88 "MDS should not assign same objid to different files "
+
equals_msg `basename $0`: test complete, cleaning up
check_and_cleanup_lustre
[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true