Skip to content

Commit ae55b9e

Browse files
committed
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 <[email protected]>
1 parent 3b501d1 commit ae55b9e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

fs/btrfs/compression.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,21 @@ static struct list_head *find_workspace(int type)
834834
* workspace preallocated for each type and the compression
835835
* time is bounded so we get to a workspace eventually. This
836836
* makes our caller's life easier.
837+
*
838+
* To prevent silent and low-probability deadlocks (when the
839+
* initial preallocation fails), check if there are any
840+
* workspaces at all.
837841
*/
842+
if (atomic_read(total_ws) == 0) {
843+
static DEFINE_RATELIMIT_STATE(_rs,
844+
/* once per minute */ 60 * HZ,
845+
/* no burst */ 1);
846+
847+
if (__ratelimit(&_rs)) {
848+
printk(KERN_WARNING
849+
"no compression workspaces, low memory, retrying");
850+
}
851+
}
838852
goto again;
839853
}
840854
return workspace;

0 commit comments

Comments
 (0)