summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-10-19 19:47:59 +0000
committerMiles Bader <miles@gnu.org>1995-10-19 19:47:59 +0000
commit4674c4360ac70cf8394584270ac3b8c0776db0b1 (patch)
tree421ab0a7fbf6901f60d41af40163ffd34add8efe /libdiskfs
parent6208f711eab3fedc51fd677edca0b55aef565fc9 (diff)
(diskfs_fsys_lock): Now a rwlock.
(diskfs_shutdown): Lock DISKFS_FSYS_LOCK for writing.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/shutdown.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/libdiskfs/shutdown.c b/libdiskfs/shutdown.c
index 318050a6..d6730655 100644
--- a/libdiskfs/shutdown.c
+++ b/libdiskfs/shutdown.c
@@ -22,7 +22,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "priv.h"
#include <hurd/fsys.h>
-struct mutex diskfs_shutdown_lock = MUTEX_INITIALIZER;
+struct rwlock diskfs_fsys_lock = RWLOCK_INITIALIZER;
/* Shutdown the filesystem; flags are as for fsys_goaway. */
error_t
@@ -65,21 +65,12 @@ diskfs_shutdown (int flags)
return err;
}
- mutex_lock (&diskfs_shutdown_lock);
+ rwlock_writer_lock (&diskfs_fsys_lock);
/* Permit all the current RPC's to finish, and then
suspend new ones. */
ports_inhibit_class_rpcs (diskfs_protid_class);
- /* Unfortunately, we can't inhibit control ports, because
- we are running inside a control port RPC. What to do?
- ports_count_class will prevent new protid's from being created;
- that will happily block getroot and getfile. diskfs_shutdown_lock
- will block simultaneous attempts at goaway and set_options. Only
- syncfs remains; perhaps a special flag could be used, or it could
- also hold diskfs_shutdown_lock (which should probably then be
- renamed...). */
-
/* First, see if there are outstanding user ports. */
nports = ports_count_class (diskfs_protid_class);
if (((flags & FSYS_GOAWAY_FORCE) == 0)
@@ -87,7 +78,7 @@ diskfs_shutdown (int flags)
{
ports_enable_class (diskfs_protid_class);
ports_resume_class_rpcs (diskfs_protid_class);
- mutex_unlock (&diskfs_shutdown_lock);
+ rwlock_writer_unlock (&diskfs_fsys_lock);
return EBUSY;
}