commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 12/15: libdiskfs: Shutdown pagers on startup_dosync.


From: Samuel Thibault
Subject: [hurd] 12/15: libdiskfs: Shutdown pagers on startup_dosync.
Date: Sun, 19 Nov 2017 15:27:06 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch dde
in repository hurd.

commit 89a49ec8b3a847f3b770cff6a4a80b98b94ad7bf
Author: Justus Winter <address@hidden>
Date:   Thu Aug 10 23:26:25 2017 +0200

    libdiskfs: Shutdown pagers on startup_dosync.
    
    * libdiskfs/init-startup.c (diskfs_S_startup_dosync): Simplify the
    code by just using 'diskfs_shutdown' with the force flag.  This also
    shuts down pagers, which potentially affects other tasks, but getting
    rid of the pagers allows us to commit a clean and consistent state to
    the disk before shutting down.  Crashing other tasks just before the
    system powers down seems like a small price to pay.
---
 libdiskfs/init-startup.c | 34 +---------------------------------
 1 file changed, 1 insertion(+), 33 deletions(-)

diff --git a/libdiskfs/init-startup.c b/libdiskfs/init-startup.c
index a2e3638..4251e0b 100644
--- a/libdiskfs/init-startup.c
+++ b/libdiskfs/init-startup.c
@@ -126,47 +126,15 @@ diskfs_startup_diskfs (mach_port_t bootstrap, int flags)
 error_t
 diskfs_S_startup_dosync (mach_port_t handle)
 {
-  error_t err = 0;
   struct port_info *pi
     = ports_lookup_port (diskfs_port_bucket, handle,
                         diskfs_shutdown_notification_class);
 
   if (!pi)
     return EOPNOTSUPP;
-
-  if (! diskfs_readonly)
-    {
-      /* First start a sync so that if something goes wrong
-        we at least get this much done. */
-      diskfs_sync_everything (0);
-      diskfs_set_hypermetadata (0, 0);
-
-      pthread_rwlock_wrlock (&diskfs_fsys_lock);
-
-      /* Permit all the current RPC's to finish, and then suspend new ones */
-      err = ports_inhibit_class_rpcs (diskfs_protid_class);
-      if (! err)
-       {
-         diskfs_sync_everything (1);
-         diskfs_set_hypermetadata (1, 1);
-         _diskfs_diskdirty = 0;
-
-         /* XXX: if some application writes something after that, we will
-          * crash. That is still better than creating pending writes before
-          * poweroff, and thus fsck on next reboot.
-          */
-         diskfs_readonly = 1;
-         diskfs_readonly_changed (1);
-
-         ports_resume_class_rpcs (diskfs_protid_class);
-       }
-
-      pthread_rwlock_unlock (&diskfs_fsys_lock);
-    }
-
   ports_port_deref (pi);
 
-  return err;
+  return diskfs_shutdown (FSYS_GOAWAY_FORCE || FSYS_GOAWAY_RECURSE);
 }
 
 /* This is called when we have an ordinary environment, complete

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]