File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
sled-agent/src/support_bundle Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -836,7 +836,23 @@ impl<'a> SupportBundleManager<'a> {
836
836
}
837
837
838
838
// Finalize the transfer of the bundle
839
- tokio:: fs:: rename ( support_bundle_path_tmp, support_bundle_path) . await ?;
839
+ tokio:: fs:: rename ( & support_bundle_path_tmp, & support_bundle_path)
840
+ . await ?;
841
+
842
+ // Sync the data (and parent directory) to durable storage.
843
+ //
844
+ // The ordering of these "sync" calls doesn't matter *too* much, because
845
+ // Nexus won't mark the support bundle as ready unless the call to
846
+ // "finalize" returns successfully. If we crash while any of these files
847
+ // are only partially written, the checksum would prevent corrupted
848
+ // bundles from being used.
849
+ tokio:: fs:: File :: open ( & support_bundle_path) . await ?. sync_all ( ) . await ?;
850
+ if let Some ( parent) = support_bundle_path. parent ( ) {
851
+ // This really should never be "None"; there will always be a parent
852
+ // directory.
853
+ tokio:: fs:: File :: open ( parent) . await ?. sync_all ( ) . await ?;
854
+ }
855
+
840
856
return Ok ( metadata) ;
841
857
}
842
858
You can’t perform that action at this time.
0 commit comments