diff options
author | Miles Bader <miles@gnu.org> | 1995-10-19 20:18:39 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-10-19 20:18:39 +0000 |
commit | 1f2bdfe2e8595ca34669ab0cd7a464735c9c543b (patch) | |
tree | 1081d496b16519a56957ab51a052c004a86c0fe8 | |
parent | 0999f25a67e6f32ec7d01dd3570f8f41df2eb627 (diff) |
(diskfs_S_fsys_getroot): Hold DISKFS_FSYS_LOCK for reading.
-rw-r--r-- | libdiskfs/fsys-getroot.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c index a7492ed0..a1fa396a 100644 --- a/libdiskfs/fsys-getroot.c +++ b/libdiskfs/fsys-getroot.c @@ -52,6 +52,7 @@ diskfs_S_fsys_getroot (fsys_t controlport, flags &= O_HURD; + rwlock_reader_lock (&diskfs_fsys_lock); mutex_lock (&diskfs_root_node->lock); /* This code is similar (but not the same as) the code in @@ -69,16 +70,14 @@ diskfs_S_fsys_getroot (fsys_t controlport, gids, ngids, flags, _diskfs_translator_callback, retry, retryname, returned_port); - if (error && error != ENOENT) + if (error != ENOENT) { mutex_unlock (&diskfs_root_node->lock); + rwlock_reader_unlock (&diskfs_fsys_lock); + if (!error) + *returned_port_poly = MACH_MSG_TYPE_MOVE_SEND; return error; } - if (!error) - { - *returned_port_poly = MACH_MSG_TYPE_MOVE_SEND; - return 0; - } /* ENOENT means the translator was removed in the interim. */ error = 0; @@ -99,6 +98,7 @@ diskfs_S_fsys_getroot (fsys_t controlport, pathbuf[amt] = '\0'; mutex_unlock (&diskfs_root_node->lock); + rwlock_reader_unlock (&diskfs_fsys_lock); if (error) return error; @@ -151,6 +151,7 @@ diskfs_S_fsys_getroot (fsys_t controlport, if (error) { mutex_unlock (&diskfs_root_node->lock); + rwlock_reader_unlock (&diskfs_fsys_lock); return error; } @@ -170,6 +171,7 @@ diskfs_S_fsys_getroot (fsys_t controlport, ports_port_deref (newpi); mutex_unlock (&diskfs_root_node->lock); + rwlock_reader_unlock (&diskfs_fsys_lock); ports_port_deref (pt); |