From 57248b8f03a1544507034345eeeced1b6c2007b8 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 26 Feb 2001 10:43:05 +0000 Subject: 2001-02-26 Roland McGrath * node.c (diskfs_free_node): Reset hnext's hprevp. (diskfs_node_norefs): Likewise. (diskfs_cached_lookup): Fix insane code for finding existing node ptr. --- tmpfs/node.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tmpfs') diff --git a/tmpfs/node.c b/tmpfs/node.c index 59a9bc37..aae59c74 100644 --- a/tmpfs/node.c +++ b/tmpfs/node.c @@ -69,6 +69,8 @@ diskfs_free_node (struct node *np, mode_t mode) break; } *np->dn->hprevp = np->dn->hnext; + if (np->dn->hnext != 0) + np->dn->hnext->dn->hprevp = np->dn->hprevp; free (np->dn); np->dn = 0; @@ -112,6 +114,8 @@ diskfs_node_norefs (struct node *np) /* Remove this node from the cache list rooted at `all_nodes'. */ *np->dn->hprevp = np->dn->hnext; + if (np->dn->hnext != 0) + np->dn->hnext->dn->hprevp = np->dn->hprevp; np->dn->hnext = 0; np->dn->hprevp = 0; } @@ -152,9 +156,9 @@ diskfs_cached_lookup (int inum, struct node **npp) struct disknode *dn = (void *) inum; struct node *np; - if (dn->hnext != 0) /* There is already a node. */ + if (dn->hprevp != 0) /* There is already a node. */ { - np = (void *) dn->hnext - offsetof (struct disknode, hnext); + np = *dn->hprevp; assert (np->dn == dn); assert (*dn->hprevp == np); spin_lock (&diskfs_node_refcnt_lock); -- cgit v1.2.3