summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-04-27 03:07:39 +0200
committerDavid Sterba <dsterba@suse.com>2016-05-10 09:46:16 +0200
commit523567168da04bae0f88802ddef49d00072c5d58 (patch)
tree9e5341242e6becf6a81a0bdea5ac080b3f1797a3 /fs/btrfs/compression.c
parentbtrfs: make find_workspace always succeed (diff)
downloadlinux-523567168da04bae0f88802ddef49d00072c5d58.tar.xz
linux-523567168da04bae0f88802ddef49d00072c5d58.zip
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 <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r--fs/btrfs/compression.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index c70625560265..658c39b70fba 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;