+ rm -rf $DIR/$tdir
+ return $rc
+}
+
+test_7a() {
+ first="createmany -o $DIR/$tdir/$tfile- 1"
+ lost="rm $MOUNT2/$tdir/$tfile-0"
+ last="createmany -o $DIR/$tdir/$tfile- 1"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1"
+ lost="rm $MOUNT2/$tdir/$tfile-0"
+ last="mkdir $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
+
+ first="mkdir $DIR/$tdir/$tfile-0"
+ lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
+ last="createmany -o $DIR/$tdir/$tfile- 1"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
+ return 0
+}
+run_test 7a "create, {lost}, create"
+
+test_7b() {
+ first="createmany -o $DIR/$tdir/$tfile- 1"
+ lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="rm $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7b.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1"
+ lost="touch $MOUNT2/$tdir/$tfile; mv $MOUNT2/$tdir/$tfile $MOUNT2/$tdir/$tfile-0"
+ last="rm $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7b.2 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1"
+ lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
+ last="rmdir $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7b.3 failed"
+ return 0
+}
+run_test 7b "create, {lost}, unlink"
+
+test_7c() {
+ first="createmany -o $DIR/$tdir/$tfile- 1"
+ lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7c.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2"
+ lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
+ last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7c.2 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile-1-0"
+ lost="rmdir $MOUNT2/$tdir/$tfile-1-0; createmany -o $MOUNT2/$tdir/$tfile-1- 1"
+ last="mv $DIR/$tdir/$tfile-1-0 $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7c.3 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1"
+ lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile"
+ last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7c.4 failed"
+ return 0
+}
+run_test 7c "create, {lost}, rename"
+
+test_7d() {
+ first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
+ last="createmany -o $DIR/$tdir/$tfile- 1"
+ test_7_cycle "$first" "$lost" "$last" && error "Test 7d.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
+ lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0"
+ last="mkdir $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" && error "Test 7d.2 failed"
+
+ first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1; mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
+ last="createmany -o $DIR/$tdir/$tfile- 1"
+ test_7_cycle "$first" "$lost" "$last" && error "Test 7d.3 failed"
+ return 0
+}
+run_test 7d "unlink, {lost}, create"
+
+test_7e() {
+ first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0;createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="rm $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7e.1 failed"
+
+ first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
+ lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
+ last="rmdir $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7e.2 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
+ lost="mkdir $MOUNT2/$tdir/$tfile-0"
+ last="rmdir $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7e.3 failed"
+
+ first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="rm $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7e.4 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
+ lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
+ last="rm $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7e.5 failed"
+ return 0
+}
+run_test 7e "unlink, {lost}, unlink"
+
+test_7f() {
+ first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7f.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7f.2 failed"
+
+ first="mkdir $DIR/$tdir/$tfile; createmany -o $DIR/$tdir/$tfile- 1; rmdir $DIR/$tdir/$tfile"
+ lost="mkdir $MOUNT2/$tdir/$tfile"
+ last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7f.3 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
+ lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
+ last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7f.4 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
+ lost="mkdir $MOUNT2/$tdir/$tfile-0"
+ last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7f.5 failed"
+ return 0
+}
+run_test 7f "unlink, {lost}, rename"
+
+test_7g() {
+ first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0"
+ last="createmany -o $DIR/$tdir/$tfile- 1"
+ test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
+ last="mkdir $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ if [ "$MDS1_VERSION" -lt $(version_code 2.5.1) ]; then
+ test_7_cycle "$first" "$lost" "$last" ||
+ error "Test 7g.3 failed"
+ else #LU-4442 LU-3528
+ test_7_cycle "$first" "$lost" "$last" &&
+ error "Test 7g.3 failed"
+ fi
+ return 0
+}
+run_test 7g "rename, {lost}, create"
+
+test_7h() {
+ first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="rm $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7h.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
+ lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="rm $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7h.2 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
+ lost="rm $MOUNT2/$tdir/$tfile/$tfile-0"
+ last="rmdir $DIR/$tdir/$tfile"
+ #test_7_cycle "$first" "$lost" "$last" || error "Test 7h.3 failed"
+ return 0
+}
+run_test 7h "rename, {lost}, unlink"
+
+test_7i() {
+ first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
+ last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
+ lost="mkdir $MOUNT2/$tdir/$tfile-0"
+ last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 3; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
+ lost="mv $MOUNT2/$tdir/$tfile-2 $MOUNT2/$tdir/$tfile-0"
+ last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-2"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7i.3 failed"
+
+ first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
+ lost="rm $MOUNT2/$tdir/$tfile-1"
+ last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-1"
+ test_7_cycle "$first" "$lost" "$last" || error "Test 7i.4 failed"