commit ac590dcfe1f359bacc4e1be9008a02a2a74f0702
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Fri Jan 17 01:36:15 2025 +0100

    libdiskfs: Avoid crashing on system shutdown
    
    when processes which were upgraded didn't get restarted, and stop after
    making the filesystem readonly.

diff --git a/libdiskfs/node-drop.c b/libdiskfs/node-drop.c
index 6a8ebd6d..00c84408 100644
--- a/libdiskfs/node-drop.c
+++ b/libdiskfs/node-drop.c
@@ -38,11 +38,13 @@ diskfs_drop_node (struct node *np)
 {
   mode_t savemode;
 
-  if (np->dn_stat.st_nlink == 0)
+  /* XXX: if the filesystem is readonly, we cannot remove the files with no link
+     but e.g. memory mapping still in memory.  This notably happens when
+     upgrading packages without restarting the corresponding processes.  Fsck
+     will have to fix them.  */
+  if (np->dn_stat.st_nlink == 0 && !diskfs_readonly)
     {
       diskfs_check_readonly ();
-      // Pb when remounted readonly :/
-      assert_backtrace (!diskfs_readonly);
 
       if (np->dn_stat.st_mode & S_IPTRANS)
 	diskfs_set_translator (np, 0, 0, 0);
