- local pre
- local post
- local var=${SINGLEMDS}_svc
-
- [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; }
- [ $CLIENTCOUNT -ge 2 ] || \
- { skip "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
-
- do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
- do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
-
- zconf_mount $CLIENT1 $MOUNT
- zconf_mount $CLIENT2 $MOUNT1
- zconf_mount $CLIENT2 $MOUNT2
- do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
- do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
-
- #
- # Save an MDT transaction number before recovery.
- #
- do_node $CLIENT1 touch $DIR1/$tfile
- pre=$(get_version $CLIENT1 $DIR/$tfile)
-
- #
- # Comments on the replay sequence state the expected result
- # of each request.
- #
- # "R" Replayed.
- # "U" Unable to replay.
- # "J" Rejected.
- #
- replay_barrier $SINGLEMDS
- do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
- do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
- do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
- do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
- do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
- do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
- do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
- zconf_umount $CLIENT2 $MOUNT2
- facet_failover $SINGLEMDS
-
- client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
- client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
-
- #
- # Check the MDT epoch. $post must be the first transaction
- # number assigned after recovery.
- #
- do_node $CLIENT2 chmod 666 $DIR1/$tfile
- post=$(get_version $CLIENT2 $DIR1/$tfile)
- if (($(($pre >> 32)) == $((post >> 32)))); then
- error "epoch not changed: pre $pre, post $post"
- fi
-
- if (($(($post & 0x00000000ffffffff)) != 1)); then
- error "transno should restart from one: got $post"
- fi
-
- do_node $CLIENT2 stat $DIR1/$tfile-a
- do_node $CLIENT2 stat $DIR1/$tfile-b
-
- do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
- $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
- do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
- $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
-
- zconf_umount $CLIENT2 $MOUNT1
+ local pre
+ local post
+ local var=${SINGLEMDS}_svc
+
+ [ $CLIENTCOUNT -ge 2 ] || \
+ { skip "Need two or more clients, have $CLIENTCOUNT" && \
+ exit 0; }
+
+ do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+ do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
+ zconf_mount $CLIENT1 $MOUNT
+ zconf_mount $CLIENT2 $MOUNT1
+ zconf_mount $CLIENT2 $MOUNT2
+ do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
+ do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
+
+ #
+ # Save an MDT transaction number before recovery.
+ #
+ do_node $CLIENT1 touch $DIR1/$tfile
+ pre=$(chk_get_version $CLIENT1 $DIR/$tfile)
+
+ #
+ # Comments on the replay sequence state the expected result
+ # of each request.
+ #
+ # "R" Replayed.
+ # "U" Unable to replay.
+ # "J" Rejected.
+ #
+ replay_barrier $SINGLEMDS
+ do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
+ do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
+ do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
+ do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
+ do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
+ do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
+ do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
+ zconf_umount $CLIENT2 $MOUNT2
+ facet_failover $SINGLEMDS
+
+ client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
+ client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
+
+ #
+ # Check the MDT epoch. $post must be the first transaction
+ # number assigned after recovery.
+ #
+ do_node $CLIENT2 chmod 666 $DIR1/$tfile
+ post=$(chk_get_version $CLIENT2 $DIR1/$tfile)
+ if (($(($pre >> 32)) == $((post >> 32)))); then
+ error "epoch not changed: pre $pre, post $post"
+ fi
+
+ if (($(($post & 0x00000000ffffffff)) != 1)); then
+ error "transno should restart from one: got $post"
+ fi
+
+ do_node $CLIENT2 stat $DIR1/$tfile-a
+ do_node $CLIENT2 stat $DIR1/$tfile-b
+
+ do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
+ $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
+ do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
+ $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
+
+ zconf_umount $CLIENT2 $MOUNT1