summaryrefslogtreecommitdiff
path: root/ftpfs
diff options
context:
space:
mode:
Diffstat (limited to 'ftpfs')
-rw-r--r--ftpfs/dir.c27
-rw-r--r--ftpfs/node.c8
2 files changed, 7 insertions, 28 deletions
diff --git a/ftpfs/dir.c b/ftpfs/dir.c
index 733a2dcf..2ea29b53 100644
--- a/ftpfs/dir.c
+++ b/ftpfs/dir.c
@@ -654,10 +654,8 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
{
/* If there's already a node, add a ref so that it doesn't go
away. */
- pthread_spin_lock (&netfs_node_refcnt_lock);
- if (e->node)
- e->node->references++;
- pthread_spin_unlock (&netfs_node_refcnt_lock);
+ if (e->node)
+ netfs_nref (e->node);
if (! e->node)
/* No node; make one and install it into E. */
@@ -682,11 +680,7 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
if (!err && dir->num_live_entries++ == 0)
/* Keep a reference to dir's node corresponding to
children. */
- {
- pthread_spin_lock (&netfs_node_refcnt_lock);
- dir->node->references++;
- pthread_spin_unlock (&netfs_node_refcnt_lock);
- }
+ netfs_nref (dir->node);
}
}
@@ -737,10 +731,8 @@ ftpfs_dir_null_lookup (struct ftpfs_dir *dir, struct node **node)
/* We've got a dir entry, get a node for it. */
{
/* If there's already a node, add a ref so that it doesn't go away. */
- pthread_spin_lock (&netfs_node_refcnt_lock);
if (e->node)
- e->node->references++;
- pthread_spin_unlock (&netfs_node_refcnt_lock);
+ netfs_nref (e->node);
if (! e->node)
/* No node; make one and install it into E. */
@@ -749,11 +741,7 @@ ftpfs_dir_null_lookup (struct ftpfs_dir *dir, struct node **node)
if (!err && dir->num_live_entries++ == 0)
/* Keep a reference to dir's node corresponding to children. */
- {
- pthread_spin_lock (&netfs_node_refcnt_lock);
- dir->node->references++;
- pthread_spin_unlock (&netfs_node_refcnt_lock);
- }
+ netfs_nref (dir->node);
}
if (! err)
@@ -783,10 +771,7 @@ ftpfs_dir_create (struct ftpfs *fs, struct node *node, const char *rmt_path,
return ENOMEM;
}
- /* Hold a reference to the new dir's node. */
- pthread_spin_lock (&netfs_node_refcnt_lock);
- node->references++;
- pthread_spin_unlock (&netfs_node_refcnt_lock);
+ netfs_nref (node);
hurd_ihash_init (&new->htable, offsetof (struct ftpfs_dir_entry, dir_locp));
hurd_ihash_set_gki (&new->htable, ihash_hash, ihash_compare);
diff --git a/ftpfs/node.c b/ftpfs/node.c
index 74cd402e..cc9bf433 100644
--- a/ftpfs/node.c
+++ b/ftpfs/node.c
@@ -84,10 +84,7 @@ netfs_node_norefs (struct node *node)
{
struct netnode *nn = node->nn;
- /* Ftpfs_detach_node does ref count frobbing (of other nodes), so we have
- to unlock NETFS_NODE_REFCNT_LOCK during it. */
- node->references++;
- pthread_spin_unlock (&netfs_node_refcnt_lock);
+ netfs_nref (node);
/* Remove NODE from any entry it is attached to. */
ftpfs_detach_node (node);
@@ -108,7 +105,4 @@ netfs_node_norefs (struct node *node)
free (nn);
free (node);
-
- /* Caller expects us to leave this locked... */
- pthread_spin_lock (&netfs_node_refcnt_lock);
}