@@ -891,6 +891,22 @@ fn zfs_get(dataset: &str, prop: &str) -> Result<String> {
891891 Ok ( l[ 0 ] . to_string ( ) )
892892}
893893
894+ fn zfs_set ( dataset : & str , prop : & str , value : & str ) -> Result < ( ) > {
895+ let out = Command :: new ( "/sbin/zfs" )
896+ . arg ( "set" )
897+ . arg ( format ! ( "{prop}={value}" ) )
898+ . arg ( dataset)
899+ . env_clear ( )
900+ . current_dir ( "/" )
901+ . output ( ) ?;
902+
903+ if !out. status . success ( ) {
904+ bail ! ( "zfs set {prop:?}={value:?} {dataset:?}: {}" , out. info( ) ) ;
905+ }
906+
907+ Ok ( ( ) )
908+ }
909+
894910fn zfs_create_volume ( dataset : & str , size_mb : u32 ) -> Result < ( ) > {
895911 let out = Command :: new ( "/sbin/zfs" )
896912 . arg ( "create" )
@@ -948,6 +964,33 @@ fn ensure_dump_device(mbsz: u32) -> Result<()> {
948964 Ok ( ( ) )
949965}
950966
967+ #[ cfg( target_os = "illumos" ) ]
968+ fn rpool_disable_sync ( ) -> Result < ( ) > {
969+ if !zfs_exists ( "rpool" ) ? {
970+ /*
971+ * If the system does not have a root pool, there is no point trying to
972+ * disable sync. Note that technically a system could boot from a pool
973+ * with any name, not just "rpool"; in practice the images we use on
974+ * buildomat systems all use "rpool" today.
975+ */
976+ println ! ( "skipping sync disable as system has no rpool" ) ;
977+ } else {
978+ zfs_set ( "rpool" , "sync" , "disabled" ) ?;
979+
980+ println ! ( "sync was disabled on rpool!" ) ;
981+ }
982+
983+ Ok ( ( ) )
984+ }
985+
986+ #[ cfg( not( target_os = "illumos" ) ) ]
987+ fn rpool_disable_sync ( ) -> Result < ( ) > {
988+ /*
989+ * Sure, whatever you say!
990+ */
991+ Ok ( ( ) )
992+ }
993+
951994enum Stage {
952995 Ready ,
953996 Download ( mpsc:: Receiver < download:: Activity > ) ,
@@ -1163,6 +1206,7 @@ async fn cmd_run(mut l: Level<()>) -> Result<()> {
11631206 let mut dump_device_configured = false ;
11641207 let mut post_diag_script: Option < String > = None ;
11651208 let mut pre_diag_done = false ;
1209+ let mut sync_disabled = false ;
11661210
11671211 /*
11681212 * Check for a file containing a description of the job we are running. If
@@ -1224,6 +1268,14 @@ async fn cmd_run(mut l: Level<()>) -> Result<()> {
12241268 dump_device_configured = true ;
12251269 }
12261270 }
1271+
1272+ if !sync_disabled && md. rpool_disable_sync ( ) {
1273+ if let Err ( e) = rpool_disable_sync ( ) {
1274+ println ! ( "ERROR: disabling sync on rpool: {e}" ) ;
1275+ }
1276+
1277+ sync_disabled = true ;
1278+ }
12271279 }
12281280
12291281 if do_ping {
0 commit comments