-# mount lustre on mds
-lustre_client=$(facet_active_host $SINGLEMDS)
-[ "$NFSVERSION" = "4" ] && cl_mnt_opt="${MOUNT_OPTS:+$MOUNT_OPTS,}32bitapi" ||
- cl_mnt_opt=""
-zconf_mount_clients $lustre_client $MOUNT "$cl_mnt_opt" || \
- error "mount lustre on $lustre_client failed"
+
+cleanup_exit () {
+ trap 0
+ cleanup
+ check_and_cleanup_lustre
+ exit
+}
+
+cleanup () {
+ cleanup_nfs "$NFS_CLIMNTPT" "$LUSTRE_CLIENT_NFSSRV" "$NFS_CLIENTS" ||
+ error_noexit false "failed to cleanup nfs"
+ zconf_umount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT force ||
+ error_noexit false "failed to umount lustre on"\
+ "$LUSTRE_CLIENT_NFSSRV"
+ # restore lustre mount
+ restore_mount $MOUNT ||
+ error_noexit false "failed to mount lustre"
+}
+
+trap cleanup_exit EXIT SIGHUP SIGINT
+
+zconf_mount $LUSTRE_CLIENT_NFSSRV $NFS_SRVMNTPT "$cl_mnt_opt" ||
+ error "mount lustre on $LUSTRE_CLIENT_NFSSRV failed"