From: Josef Bacik Date: Fri, 14 Jun 2013 20:58:23 +0000 (-0400) Subject: Btrfs: unlock extent range on enospc in compressed submit X-Git-Tag: v3.11-rc1~70^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fdf8e2ea3cba9ef03087482b11258d844d6cbea3;p=platform%2Fupstream%2Fkernel-adaptation-pc.git Btrfs: unlock extent range on enospc in compressed submit A user reported a deadlock where the async submit thread was blocked on the lock_extent() lock, and then everybody behind him was locked on the page lock for the page he was holding. Looking at the code I noticed we do not unlock the extent range when we get ENOSPC and goto retry. This is bad because we immediately try to lock that range again to do the cow, which will cause a deadlock. Fix this by unlocking the range. Thanks, Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a2df469..509112d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -700,8 +700,12 @@ retry: async_extent->nr_pages = 0; async_extent->pages = NULL; - if (ret == -ENOSPC) + if (ret == -ENOSPC) { + unlock_extent(io_tree, async_extent->start, + async_extent->start + + async_extent->ram_size - 1); goto retry; + } goto out_free; }