bcache: bch_allocator_thread(): hung task timeout
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Fix Released
|
High
|
Andrea Righi | ||
Xenial |
Fix Released
|
High
|
Andrea Righi | ||
Bionic |
Fix Released
|
High
|
Andrea Righi | ||
Disco |
Fix Released
|
High
|
Andrea Righi | ||
Eoan |
Fix Released
|
High
|
Andrea Righi |
Bug Description
[Impact]
bcache_allocator() can call the following:
bch_allocator_
-> bch_prio_write()
-> bch_bucket_alloc()
-> wait on &ca->set-
But the wake up event on bucket_wait is supposed to come from bch_allocator_
[Test Case]
This is a simple script that can easily trigger the deadlock condition:
https:/
A better test case has been also provided in bug 1796292 (duplicate of this bug):
https:/
[Fix]
Fix by making the call to bch_prio_write() non-blocking, so that bch_allocator_
In addition to that it would be safe to also import other upstream bcache fixes (all clean cherry picks):
7e865eba00a3df2
80265d8dfd77792
ce4c3e19e520142
ecb37ce9baac653
04cbc21137bfa4d
5f2b18ec8e16434
20d3a518713e394
42361469ae84c85
f0d3814090ac77d
47344e330eabc15
9dfbdec7b7fea1f
4a4e443835a43a7
fd01991d5c20098
ca71df31661a051
f3641c3abd1da97
688892b3bc05e25
09a44ca2114737e
c4dc2497d50d9c6
a728eacbbdd229d
616486ab52ab7f9
1f0ffa67349c56e
eb8cbb6df38f6e5
9951379b0ca88c9
[Regression Potential]
The upstream fixes are all clean cherry picks from stable (most of them are small cleanups), so regression potential is minimal.
The only special patch is "UBUNTU: SAUCE: bcache: fix deadlock in bcache_allocator()" that is addressing the main deadlock bug (that seems to be a mainline bug - not fixed yet). We should spend more time trying to reproduce this deadlock with a mainline kernel and post the patch to the LKML for review / feedback.
However, considering that this patch seems to fix/prevent the specific deadlock problem reported in this bug (tested on the affected platform) it can be considered safe to apply it.
[Original Bug Report]
$ cat /proc/version_
Ubuntu 4.15.0-
$ lsb_release -rd
Description: Ubuntu Cosmic Cuttlefish (development branch)
Release: 18.10
$ apt-cache policy linux-image-`uname -r`
linux-image-
Installed: 4.15.0-29.31
Candidate: 4.15.0-29.31
Version table:
*** 4.15.0-29.31 500
500 http://
100 /var/lib/
3) mkfs.ext4 /dev/bcache0 returns successful creating an ext4 filesystem on top of a bcache device
4) mkfs.ext4 doesn't return and kernel prints hung process info
[ 58.018099] cloud-init[920]: Running command ['mkfs.ext4', '-F', '-L', 'root-fs', '-U', 'f01aec97-
[ 242.652018] INFO: task kworker/u4:0:5 blocked for more than 120 seconds.
[ 242.653767] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 242.655391] "echo 0 > /proc/sys/
[ 242.657397] INFO: task kworker/0:2:410 blocked for more than 120 seconds.
[ 242.659126] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 242.660980] "echo 0 > /proc/sys/
[ 242.663000] INFO: task bcache_
[ 242.664807] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 242.666516] "echo 0 > /proc/sys/
[ 242.668503] INFO: task bcache_
[ 242.670301] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 242.671936] "echo 0 > /proc/sys/
[ 242.673909] INFO: task mkfs.ext4:2803 blocked for more than 120 seconds.
[ 242.675414] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 242.677038] "echo 0 > /proc/sys/
[ 363.483998] INFO: task kworker/u4:0:5 blocked for more than 120 seconds.
[ 363.488441] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 363.489598] "echo 0 > /proc/sys/
[ 363.491043] INFO: task kworker/0:2:410 blocked for more than 120 seconds.
[ 363.492252] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 363.494085] "echo 0 > /proc/sys/
[ 363.495659] INFO: task bcache_
[ 363.496957] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 363.498454] "echo 0 > /proc/sys/
[ 363.499866] INFO: task bcache_
[ 363.501156] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 363.502597] "echo 0 > /proc/sys/
[ 363.504048] INFO: task mkfs.ext4:2803 blocked for more than 120 seconds.
[ 363.505505] Tainted: P O 4.15.0-29-generic #31-Ubuntu
[ 363.506677] "echo 0 > /proc/sys/
System has two virtio block devices. bcache was created like so:
make-bcache -C /dev/vdb
make-bcache -B /dev/vda2
resulting in /dev/bcache0
ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: linux-image-
ProcVersionSign
Uname: Linux 4.15.0-29-generic x86_64
AlsaDevices:
total 0
crw-rw---- 1 root audio 116, 1 Jul 31 15:52 seq
crw-rw---- 1 root audio 116, 33 Jul 31 15:52 timer
AplayDevices: Error: [Errno 2] No such file or directory: 'aplay': 'aplay'
ApportVersion: 2.20.10-0ubuntu7
Architecture: amd64
ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord': 'arecord'
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
CRDA: N/A
Date: Tue Jul 31 15:53:56 2018
IwConfig: Error: [Errno 2] No such file or directory: 'iwconfig': 'iwconfig'
Lsusb: Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
MachineType: QEMU Standard PC (i440FX + PIIX, 1996)
PciMultimedia:
ProcEnviron:
TERM=xterm
PATH=(custom, no user)
XDG_RUNTIME_
LANG=C.UTF-8
SHELL=/bin/bash
ProcFB:
ProcKernelCmdLine: BOOT_IMAGE=
RelatedPackageV
linux-
linux-
linux-firmware N/A
RfKill: Error: [Errno 2] No such file or directory: 'rfkill': 'rfkill'
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 04/01/2014
dmi.bios.vendor: SeaBIOS
dmi.bios.version: 1.11.1-1
dmi.chassis.type: 1
dmi.chassis.vendor: QEMU
dmi.chassis.
dmi.modalias: dmi:bvnSeaBIOS:
dmi.product.name: Standard PC (i440FX + PIIX, 1996)
dmi.product.
dmi.sys.vendor: QEMU
CVE References
Changed in linux (Ubuntu Bionic): | |
status: | New → In Progress |
Changed in linux (Ubuntu Cosmic): | |
status: | Confirmed → In Progress |
Changed in linux (Ubuntu Bionic): | |
importance: | Undecided → High |
assignee: | nobody → Joseph Salisbury (jsalisbury) |
Changed in linux (Ubuntu Cosmic): | |
assignee: | nobody → Joseph Salisbury (jsalisbury) |
tags: |
added: kernel-da-key removed: kernel-key |
Changed in linux (Ubuntu): | |
status: | In Progress → Confirmed |
Changed in linux (Ubuntu Bionic): | |
status: | In Progress → Confirmed |
Changed in linux (Ubuntu Cosmic): | |
status: | In Progress → Confirmed |
assignee: | Joseph Salisbury (jsalisbury) → nobody |
Changed in linux (Ubuntu Bionic): | |
assignee: | Joseph Salisbury (jsalisbury) → nobody |
Changed in linux (Ubuntu): | |
assignee: | Joseph Salisbury (jsalisbury) → nobody |
Changed in linux (Ubuntu Bionic): | |
assignee: | nobody → Andrea Righi (arighi) |
Changed in linux (Ubuntu Cosmic): | |
assignee: | nobody → Andrea Righi (arighi) |
Changed in linux (Ubuntu): | |
assignee: | nobody → Andrea Righi (arighi) |
tags: | added: cscc |
description: | updated |
summary: |
- mkfs.ext4 over /dev/bcache0 hangs + bcache: bch_allocator_thread(): hung task timeout |
Changed in linux (Ubuntu Disco): | |
assignee: | nobody → Andrea Righi (arighi) |
no longer affects: | linux (Ubuntu Cosmic) |
Changed in linux (Ubuntu Disco): | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in linux (Ubuntu Xenial): | |
status: | New → Confirmed |
importance: | Undecided → High |
assignee: | nobody → Andrea Righi (arighi) |
Changed in linux (Ubuntu Eoan): | |
status: | Confirmed → Fix Committed |
Changed in linux (Ubuntu Bionic): | |
status: | Confirmed → Fix Committed |
Changed in linux (Ubuntu Disco): | |
status: | Confirmed → Fix Committed |
Changed in linux (Ubuntu Xenial): | |
status: | Confirmed → Fix Committed |
Changed in linux (Ubuntu Bionic): | |
status: | Fix Committed → New |
Changed in linux (Ubuntu Bionic): | |
status: | New → Fix Committed |
This change was made by a bot.