summaryrefslogtreecommitdiff
path: root/libdiskfs/dir-lookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/dir-lookup.c')
-rw-r--r--libdiskfs/dir-lookup.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 1efdf75c..923be033 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -310,9 +310,12 @@ diskfs_S_dir_lookup (struct protid *dircred,
pthread_mutex_lock (&dnp->lock);
else
{
- pthread_mutex_unlock (&np->lock);
- pthread_mutex_lock (&dnp->lock);
- pthread_mutex_lock (&np->lock);
+ if (pthread_mutex_trylock (&dnp->lock))
+ {
+ pthread_mutex_unlock (&np->lock);
+ pthread_mutex_lock (&dnp->lock);
+ pthread_mutex_lock (&np->lock);
+ }
}
}
}