diff rust/hg-core/src/repo.rs @ 50180:be019ac8c1e4 stable

dirstate-v2: don't mmap the data file when on NFS `mmap` on NFS will trigger a SIGBUS when the mmap'ed file is deleted, which wouldn't work in our case. Also, the performance advantage of using mmap on NFS is debatable at best.
author Rapha?l Gom?s <rgomes@octobus.net>
date Mon, 28 Nov 2022 12:33:20 +0100
parents 13dfad0f9f7a
children f5e4248e5bce
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs	Thu Dec 08 16:38:39 2022 +0100
+++ b/rust/hg-core/src/repo.rs	Mon Nov 28 12:33:20 2022 +0100
@@ -320,7 +320,14 @@
                 .set(Some(docket.uuid.to_owned()));
             let data_size = docket.data_size();
             let metadata = docket.tree_metadata();
-            if let Some(data_mmap) = self
+            if crate::vfs::is_on_nfs_mount(docket.data_filename()) {
+                // Don't mmap on NFS to prevent `SIGBUS` error on deletion
+                OwningDirstateMap::new_v2(
+                    self.hg_vfs().read(docket.data_filename())?,
+                    data_size,
+                    metadata,
+                )
+            } else if let Some(data_mmap) = self
                 .hg_vfs()
                 .mmap_open(docket.data_filename())
                 .io_not_found_as_none()?