Package: fusedav
Version: 0.2-3
Severity: normal
Tags: upstream patch

I've noticed fusedav is getting stuck on futexes sometimes.   While
eyeballing the code, I've found one possible source of deadlock on
stat_cache_mutex:

        stat_cache_get() - locks stat_cache_mutex
          file_cache_unref()
            file_cache_sync_unlocked()
              stat_cache_invalidate() -> locks stat_cache_mutex again

I'm testing with the attached patch, but I hope there can be
a better fix than using a recursive mutex.

-- System Information:
Debian Release: 6.0.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages fusedav depends on:
ii  fuse-utils                    2.8.4-1.1  Filesystem in USErspace (utilities
ii  libc6                         2.11.3-4   Embedded GNU C Library: Shared lib
ii  libfuse2                      2.8.4-1.1  Filesystem in USErspace library
ii  libneon27-gnutls              0.29.3-3   An HTTP and WebDAV client library 

fusedav recommends no packages.

fusedav suggests no packages.

-- no debconf information
diff --git a/src/statcache.c b/src/statcache.c
index d556f37..879d8a0 100644
--- a/src/statcache.c
+++ b/src/statcache.c
@@ -63,7 +63,7 @@ struct cache_entry {
 };
 
 static struct cache_entry *cache = NULL;
-static pthread_mutex_t stat_cache_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t stat_cache_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
 static pthread_mutex_t dir_cache_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static uint32_t calc_hash(const char *s) {

Reply via email to