summaryrefslogtreecommitdiff
path: root/ufs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-04-28 23:01:57 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-04-28 23:01:57 +0000
commitbe295320f9ca9d6b01455c24a83495b07ece1057 (patch)
tree1ef40c722c2e54649ec650eaf70ce45b6bbbad61 /ufs
parent028b7d6d30d8a965036784826b15670a836a14bd (diff)
(write_all_disknodes): We have to really lock the nodes around the
calls to diskfs_set_node_times and write_node; this in turn forces us to have real refereces.
Diffstat (limited to 'ufs')
-rw-r--r--ufs/inode.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/ufs/inode.c b/ufs/inode.c
index 80a5fcff..afe712f5 100644
--- a/ufs/inode.c
+++ b/ufs/inode.c
@@ -412,15 +412,31 @@ write_all_disknodes ()
{
int n;
struct node *np;
-
+ struct item {struct item *next; struct node *np;} *list = 0;
+ struct item *i;
+
+ /* Acquire a reference on all the nodes in the hash table
+ and enter them into a list on the stack. */
spin_lock (&diskfs_node_refcnt_lock);
for (n = 0; n < INOHSZ; n++)
for (np = nodehash[n]; np; np = np->dn->hnext)
{
- diskfs_set_node_times (np);
- write_node (np);
+ np->references++;
+ i = alloc (sizeof (struct item));
+ i->next = list;
+ i->np = np;
+ list = i;
}
spin_unlock (&diskfs_node_refcnt_lock);
+
+ /* Update each node. */
+ for (i = list; i; i = i->next)
+ {
+ mutex_lock (&i->np->lock);
+ diskfs_set_node_times (i->np);
+ write_node (i->np);
+ diskfs_nput (i->np);
+ }
}
void