diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 27a562bad6e8..1af9b05328ce 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4108,6 +4108,15 @@ cache_acl: return 0; out: + /* + * We may have a read locked leaf and iget_failed() triggers inode + * eviction which needs to release the delayed inode and that needs + * to lock the delayed inode's mutex. This can cause a ABBA deadlock + * with a task running delayed items, as that require first locking + * the delayed inode's mutex and then modifying its subvolume btree. + * So release the path before iget_failed(). + */ + btrfs_release_path(path); iget_failed(vfs_inode); return ret; }