From: David Sterba Date: Wed, 27 Apr 2016 01:07:39 +0000 (+0200) Subject: btrfs: make find_workspace warn if there are no workspaces X-Git-Tag: v4.7~100^2~15^2~3^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=523567168da04bae0f88802ddef49d00072c5d58;p=platform%2Fkernel%2Flinux-amlogic.git btrfs: make find_workspace warn if there are no workspaces Be verbose if there are no workspaces at all, ie. the module init time preallocation failed. Signed-off-by: David Sterba --- diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index c706255..658c39b 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -834,7 +834,21 @@ again: * workspace preallocated for each type and the compression * time is bounded so we get to a workspace eventually. This * makes our caller's life easier. + * + * To prevent silent and low-probability deadlocks (when the + * initial preallocation fails), check if there are any + * workspaces at all. */ + if (atomic_read(total_ws) == 0) { + static DEFINE_RATELIMIT_STATE(_rs, + /* once per minute */ 60 * HZ, + /* no burst */ 1); + + if (__ratelimit(&_rs)) { + printk(KERN_WARNING + "no compression workspaces, low memory, retrying"); + } + } goto again; } return workspace;