[SRU] [B] [PATCH 0/1] fuse: fix deadlock with FUSE_PARALLEL_DIROPS

Andrea Righi andrea.righi at canonical.com
Thu Apr 11 17:00:25 UTC 2019


Buglink: https://bugs.launchpad.net/bugs/1823972

[Impact]

 * Enabling parallel dirops in fuse (FUSE_PARALLEL_DIROPS) may cause a race
   condition that leave fuse inode's mutex held, triggering a deadlock

 * The problem is that the lock and unlock paths are relying on
   get_fuse_conn(inode)->parallel_dirops to decide if the mutex needs to be
   acquired/released, but its value might be set in the lock path and unset in
   the unlock path (leaving the mutex held)

 * See also: https://github.com/hanwen/go-fuse/issues/281

[Test Case]

 * A test case that triggers the bug almost immediately can be found here
   https://github.com/hanwen/go-fuse/pull/288

[Fix]

 * Instead of relying on get_fuse_conn(inode)->parallel_dirops both in
   fuse_lock_inode() and fuse_unlock_inode(), only check this flag in the
   locking path and pass a variable to fuse_unlock_inode() to determine if the
   mutex was acquired or not

[Regression Potential]

 * Fix has been tested on the affected platform. It is an upstream fix that
   seems to affect only 4.7+ kernels, more exactly in our case only Bionic
   kernels (and derived) are affected. Cosmic and above already include
   this fix. So regression potential is minimal.

Miklos Szeredi (1):
      fuse: fix initial parallel dirops

 fs/fuse/dir.c    | 10 ++++++----
 fs/fuse/fuse_i.h |  4 ++--
 fs/fuse/inode.c  | 14 ++++++++++----
 3 files changed, 18 insertions(+), 10 deletions(-)




More information about the kernel-team mailing list