bcache kernel warning when attaching device

Bug #1837788 reported by MikeB
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Invalid
Undecided
Mauricio Faria de Oliveira
Bionic
Fix Released
Undecided
Mauricio Faria de Oliveira
Disco
Fix Released
Undecided
Mauricio Faria de Oliveira
Eoan
Invalid
Undecided
Mauricio Faria de Oliveira

Bug Description

[Impact]

 * Users can get a Warning or even Oops the kernel if
   bcache/writeback_percent is set before attaching a
   caching device to the bcache device.

 * The fix is trivial, upstream, and consists of just
   checking whether the caching device is attached in
   order to set flags and schedule thread (which oops).

[Test Case]

 * See attachment 'setup-bcache-wb_percent-before-attach.sh'
   used in comment #5 and #6 to reproduce the problem(s).

 * for 'Warning':

   # make-bcache -B <BACKING DEVICE>
   # make-bcache -C <CACHE DEVICE>
   # echo 11 > /sys/block/<BACKING DEVICE>/bcache/writeback_percent
   # sleep 1
   # echo <CSET_UUID> > /sys/block/<BACKING DEVICE>/bcache/attach

 * for 'Oops':
   (steps above, but don't run last command / 'attach').

[Regression Potential]

 * Low. The fix is trivial, contained, and exclusive to bcache sysfs handler.

 * The modified path has been exercised with synthetic testing (script).

[Original Bug Description]

See attached dmesg, each time this server is rebooted it emits a concerning bcache warning.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: linux-image-4.15.0-54-generic 4.15.0-54.58
ProcVersionSignature: Ubuntu 4.15.0-54.58-generic 4.15.18
Uname: Linux 4.15.0-54-generic x86_64
AlsaVersion: Advanced Linux Sound Architecture Driver Version k4.15.0-54-generic.
AplayDevices: Error: [Errno 2] No such file or directory: 'aplay': 'aplay'
ApportVersion: 2.20.9-0ubuntu7.7
Architecture: amd64
ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord': 'arecord'
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/by-path', '/dev/snd/hwC0D2', '/dev/snd/pcmC0D2c', '/dev/snd/pcmC0D3c', '/dev/snd/pcmC0D3p', '/dev/snd/pcmC0D0c', '/dev/snd/pcmC0D0p', '/dev/snd/controlC0', '/dev/snd/hwC1D0', '/dev/snd/pcmC1D3p', '/dev/snd/controlC1', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
Card0.Amixer.info: Error: [Errno 2] No such file or directory: 'amixer': 'amixer'
Card0.Amixer.values: Error: [Errno 2] No such file or directory: 'amixer': 'amixer'
Card1.Amixer.info: Error: [Errno 2] No such file or directory: 'amixer': 'amixer'
Card1.Amixer.values: Error: [Errno 2] No such file or directory: 'amixer': 'amixer'
Date: Wed Jul 24 12:28:06 2019
InstallationDate: Installed on 2013-10-04 (2119 days ago)
InstallationMedia: Ubuntu-Server 13.10 "Saucy Salamander" - Beta amd64 (20130925.1)
MachineType: Supermicro X9DAi
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcFB: 0 EFI VGA
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-54-generic root=UUID=8577302d-1f37-40a6-afcd-385beb26059f ro nomodeset elevator=deadline nvme_core.default_ps_max_latency_us=0 nopti noibrs noibpb
RelatedPackageVersions:
 linux-restricted-modules-4.15.0-54-generic N/A
 linux-backports-modules-4.15.0-54-generic N/A
 linux-firmware 1.173.9
RfKill: Error: [Errno 2] No such file or directory: 'rfkill': 'rfkill'
SourcePackage: linux
UpgradeStatus: Upgraded to bionic on 2018-06-09 (409 days ago)
dmi.bios.date: 05/09/2015
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 3.2
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: X9DAi
dmi.board.vendor: Supermicro
dmi.board.version: 0123456789
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: Supermicro
dmi.chassis.version: 0123456789
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr3.2:bd05/09/2015:svnSupermicro:pnX9DAi:pvr0123456789:rvnSupermicro:rnX9DAi:rvr0123456789:cvnSupermicro:ct3:cvr0123456789:
dmi.product.family: To be filled by O.E.M.
dmi.product.name: X9DAi
dmi.product.version: 0123456789
dmi.sys.vendor: Supermicro

Revision history for this message
MikeB (mikeb-timetrex) wrote :
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Changed in linux (Ubuntu):
assignee: nobody → Mauricio Faria de Oliveira (mfo)
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (3.7 KiB)

This is the warning trigger line:

    int bch_cached_dev_writeback_start(struct cached_dev *dc)
    ...
        WARN_ON(test_and_set_bit(BCACHE_DEV_WB_RUNNING, &dc->disk.flags));
    ...

This commit fixes this problem:

    commit 1f0ffa67349c56ea54c03ccfd1e073c990e7411e
    Author: Coly Li <email address hidden>
    Date: Mon Jun 10 06:13:35 2019 +0800

        bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached

It is included in linux 5.2, so for now only Ubuntu Eoan has the fix;
I could reproduce the problem with Ubuntu Disco (5.0-based) kernel.

The problem can Oops the kernel (worse error) if the cache is not attached soon (reproduced below).

I'll provide a test kernel with the fix soon.

Steps to reproduce:
------------------

With attach (last line in script):

    $ sudo ./setup-bcache-wb_percent-before-attach.sh
    ...
    [ 36.130659] WARNING: CPU: 2 PID: 1288 at drivers/md/bcache/writeback.c:837 bch_cached_dev_writeback_start+0x156/0x164 [bcache]
    ...
    [ 36.155742] RIP: 0010:bch_cached_dev_writeback_start+0x156/0x164 [bcache]
    ...
    [ 36.182455] Call Trace:
    [ 36.183387] bch_cached_dev_attach+0x356/0x480 [bcache]
    [ 36.185104] ? bch_keybuf_init+0x70/0x70 [bcache]
    [ 36.186653] __cached_dev_store+0x59f/0x8b0 [bcache]
    [ 36.188274] bch_cached_dev_store+0x39/0xc0 [bcache]
    [ 36.189887] sysfs_kf_write+0x3b/0x40
    [ 36.191142] kernfs_fop_write+0x12e/0x1b0
    [ 36.192502] __vfs_write+0x1b/0x40
    [ 36.193686] vfs_write+0xab/0x1b0
    [ 36.194842] ksys_write+0x5c/0xd0
    [ 36.196026] __x64_sys_write+0x1a/0x20
    [ 36.197296] do_syscall_64+0x5a/0x110
    [ 36.198532] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 36.200158] RIP: 0033:0x7f69a1d09154
    ...
    [ 36.222967] ---[ end trace ec65e906cd03afa6 ]---
    [ 36.225017] bcache: bch_cached_dev_attach() Caching loop0 as bcache0 on set 57322d7a-1421-4dfc-a8cb-9c7b4e60c50a

Without attach (last line in script):
in a few seconds:

    $ sudo ./setup-bcache-wb_percent-before-attach.sh
    ...
    [ 30.623677] BUG: unable to handle kernel NULL pointer dereference at 0000000000000340
    [ 30.627527] #PF error: [normal kernel read fault]
    [ 30.629825] PGD 0 P4D 0
    [ 30.631194] Oops: 0000 [#1] SMP PTI
    ...
    [ 30.638818] Workqueue: events update_writeback_rate [bcache]
    [ 30.640543] RIP: 0010:update_writeback_rate+0x36/0x330 [bcache]
    ...
    [ 30.668496] Call Trace:
    [ 30.670003] ? __schedule+0x2d8/0x840
    [ 30.671998] process_one_work+0x20f/0x410
    [ 30.674163] worker_thread+0x34/0x400
    [ 30.676160] kthread+0x120/0x140
    [ 30.678014] ? process_one_work+0x410/0x410
    [ 30.680238] ? __kthread_parkme+0x70/0x70
    [ 30.682411] ret_from_fork+0x35/0x40
    ...
    [ 30.704646] ---[ end trace 1bbc1b34c704f1c5 ]---
    [ 30.707086] RIP: 0010:update_writeback_rate+0x36/0x330 [bcache]

Test script:

$ cat setup-bcache-wb_percent-before-attach.sh
#!/bin/sh

#set -ex

dmesg -C
echo 9 > /proc/sys/kernel/printk

FILE_BACKING=/backing.img
FILE_CACHING=/caching.img

dd if=/dev/zero of=$FILE_BACKING bs=1G seek=1 count=0
dd if=/dev/zero of=$...

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (3.7 KiB)

For reference, this is the Warning in the CurrentDmesg.txt file.

[ 71.925684] WARNING: CPU: 8 PID: 2977 at /build/linux-jmOa1Y/linux-4.15.0/drivers/md/bcache/writeback.c:603 bch_cached_dev_writeback_start+0x13f/0x1af [bcache]
[ 71.925686] Modules linked in: ebtable_filter ebtables ip6table_filter ip6_tables devlink iptable_filter nls_utf8 cifs ccm fscache bridge stp llc bonding nls_iso8859_1 intel_rapl sb_edac x86_pkg_temp_thermal intel_powerclamp kvm_intel kvm irqbypass ttm drm_kms_helper crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc drm fb_sys_fops syscopyarea sysfillrect sysimgblt aesni_intel mxm_wmi aes_x86_64 crypto_simd glue_helper uvcvideo cryptd snd_hda_codec_realtek snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel snd_hda_codec videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core snd_hda_core videodev media intel_cstate snd_hwdep snd_pcm snd_timer snd intel_rapl_perf input_leds soundcore shpchp serio_raw ioatdma mei_me lpc_ich mei mac_hid wmi sch_fq_codel vhost_net vhost tap coretemp
[ 71.925727] lp parport ip_tables x_tables autofs4 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid0 multipath linear bcache raid1 hid_generic usbhid hid igb i2c_algo_bit dca firewire_ohci isci ahci ptp firewire_core libahci crc_itu_t libsas pps_core nvme scsi_transport_sas nvme_core
[ 71.925751] CPU: 8 PID: 2977 Comm: bash Not tainted 4.15.0-54-generic #58-Ubuntu
[ 71.925752] Hardware name: Supermicro X9DAi/X9DAi, BIOS 3.2 05/09/2015
[ 71.925759] RIP: 0010:bch_cached_dev_writeback_start+0x13f/0x1af [bcache]
[ 71.925760] RSP: 0018:ffffa784c96abd08 EFLAGS: 00010287
[ 71.925761] RAX: ffff967af8bfdb00 RBX: ffff967af3660000 RCX: 0000000000000000
[ 71.925762] RDX: 0000000000000000 RSI: ffff967aff2a70a0 RDI: ffff966aff407780
[ 71.925763] RBP: ffffa784c96abd10 R08: 00000000000270a0 R09: ffffffffaecaf22d
[ 71.925764] R10: 0000000000000000 R11: 000000000000024b R12: ffff967af3660010
[ 71.925765] R13: ffff967af3660000 R14: ffff967af4320000 R15: ffff967af3660ac8
[ 71.925767] FS: 00007f7759f51740(0000) GS:ffff967aff280000(0000) knlGS:0000000000000000
[ 71.925768] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 71.925770] CR2: 00007fff24052e08 CR3: 0000001ff4410001 CR4: 00000000000626e0
[ 71.925771] Call Trace:
[ 71.925781] bch_cached_dev_attach+0x34b/0x510 [bcache]
[ 71.925787] ? kernfs_fop_write+0xcb/0x1a0
[ 71.925793] __cached_dev_store+0x5c1/0x6d0 [bcache]
[ 71.925798] ? __cached_dev_store+0x5c1/0x6d0 [bcache]
[ 71.925804] bch_cached_dev_store+0x39/0xc0 [bcache]
[ 71.925806] sysfs_kf_write+0x3c/0x50
[ 71.925808] kernfs_fop_write+0x125/0x1a0
[ 71.925811] __vfs_write+0x1b/0x40
[ 71.925813] vfs_write+0xb1/0x1a0
[ 71.925814] SyS_write+0x55/0xc0
[ 71.925819] do_syscall_64+0x73/0x130
[ 71.925825] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[ 71.925826] RIP: 0033:0x7f775962b154
[ 71.925827] RSP: 002b:00007fff76f6a788 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 71.925829] RAX: ffffffffffffffda RBX: 0000000000000025 RCX: 00007f775962b154
[ 71.925830] RDX: 0000000000000025 RSI: 000055c6907e0140 RDI: 00000000000000...

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (6.0 KiB)

Tested with bionic-proposed (problem exists)
---

# uname -rv
4.15.0-56-generic #62-Ubuntu SMP Wed Jul 24 20:18:55 UTC 2019

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 39.096888] bcache: register_bdev() registered backing device loop0/null 2>&1
[ 39.109511] bcache: run_cache_set() invalidating existing data
[ 39.121256] bcache: register_cache() registered cache device loop1
[ 43.083569] WARNING: CPU: 3 PID: 1207 at /build/linux-dHA1gi/linux-4.15.0/drivers/md/bcache/writeback.c:624 bch_cached_dev_writeback_sta$
t+0x13f/0x1b0 [bcache]
[ 43.092279] Modules linked in: bcache isofs nls_iso8859_1 kvm_intel kvm irqbypass input_leds joydev serio_raw sch_fq_codel ib_iser rdma_$
m iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ip_tables x_tables autofs4 btrfs zstd_compress raid10 raid456 as$
nc_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear psmouse virtio_blk virtio_net f$
oppy
[ 43.107715] CPU: 3 PID: 1207 Comm: setup-bcache-wb Not tainted 4.15.0-56-generic #62-Ubuntu
[ 43.111108] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 43.114797] RIP: 0010:bch_cached_dev_writeback_start+0x13f/0x1b0 [bcache]
[ 43.117589] RSP: 0018:ffffbcb4c13a3d28 EFLAGS: 00010283
[ 43.119762] RAX: ffff9e8171f74080 RBX: ffff9e8172610000 RCX: 0000000000000000
[ 43.122664] RDX: 0000000000000000 RSI: ffff9e817fda70a0 RDI: ffff9e8177003800
[ 43.125572] RBP: ffffbcb4c13a3d30 R08: 00000000000270a0 R09: ffffffff826afc1d
[ 43.128590] R10: 0000000000000000 R11: 0000000000000224 R12: ffff9e8172610010
[ 43.131574] R13: ffff9e8172610000 R14: ffff9e8172060000 R15: ffff9e8172610ac8
[ 43.134538] FS: 00007f2bb42dc540(0000) GS:ffff9e817fd80000(0000) knlGS:0000000000000000
[ 43.137983] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 43.140430] CR2: 00005608572738f0 CR3: 0000000235020000 CR4: 00000000000006e0
[ 43.143389] Call Trace:
[ 43.144575] bch_cached_dev_attach+0x335/0x4f0 [bcache]
[ 43.146835] __cached_dev_store+0x749/0x7e0 [bcache]
[ 43.148950] ? __cached_dev_store+0x749/0x7e0 [bcache]
[ 43.151144] bch_cached_dev_store+0x39/0xc0 [bcache]
[ 43.153266] sysfs_kf_write+0x3c/0x50
[ 43.154892] kernfs_fop_write+0x125/0x1a0
[ 43.156682] __vfs_write+0x1b/0x40
[ 43.158211] vfs_write+0xb1/0x1a0
[ 43.159710] SyS_write+0x55/0xc0
[ 43.161167] do_syscall_64+0x73/0x130
[ 43.162772] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[ 43.164891] RIP: 0033:0x7f2bb3ddc154
[ 43.166471] RSP: 002b:00007fffaa0a1628 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 43.169675] RAX: ffffffffffffffda RBX: 00005608572717f0 RCX: 00007f2bb3ddc154
[ 43.172573] RDX: 0000000000000025 RSI: 00005608572717f0 RDI: 0000000000000001
[ 43.175461] RBP: 0000000000000025 R08: 000000000000f000 R09: 000056085727394d
[ 43.178356] R10: 00000000000001b6 R11: 0000000000000246 R12: 0000000000000001
[ 43.180809] R13: 0000000000000025 R14: 7fffffffffffffff R15: 00007fffaa0a2f39
[ 43.182978] Code: 0a 00 00 0f 88 85 00 00 00 75 18 48 8b 35 22 8f 4d c3 48 8d 93 a0 0a 00 00 bf 00 20 00 00 e8 49 16 f2 c1 8b 83 80 0b 00
 00 eb...

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :
Download full text (7.3 KiB)

Tested with disco-proposed (problem exists)
-----

# uname -rv
5.0.0-22-generic #23-Ubuntu SMP Tue Jul 23 17:23:54 UTC 2019

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 57.992319] bcache: register_bdev() registered backing device loop0/null 2>&1
[ 57.997331] bcache: run_cache_set() invalidating existing data
[ 58.009201] bcache: register_cache() registered cache device loop1
[ 58.009232] bcache: register_bcache() error /dev/loop0: device already registered (emitting change event)
[ 62.008954] WARNING: CPU: 2 PID: 1294 at drivers/md/bcache/writeback.c:837 bch_cached_dev_writeback_start+0x156/0x164 [bcache]
[ 62.014280] Modules linked in: bcache crc64 isofs nls_iso8859_1 kvm_intel kvm irqbypass input_leds joydev serio_raw sch_fq_codel ib_iser
rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ip_tables x_tables autofs4 btrfs zstd_compress raid10 raid$
56 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear psmouse virtio_blk virtio$
net net_failover failover floppy
[ 62.027201] CPU: 2 PID: 1294 Comm: setup-bcache-wb Not tainted 5.0.0-22-generic #23-Ubuntu
[ 62.029611] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 62.032236] RIP: 0010:bch_cached_dev_writeback_start+0x156/0x164 [bcache]
[ 62.034227] Code: 88 4c 0d 00 00 74 09 8b 83 e0 0c 00 00 5b 5d c3 48 8b 35 35 ee b6 e0 48 8d 93 08 0c 00 00 bf 00 20 00 00 e8 7c 81 3e d$
 eb dd <0f> 0b e9 55 ff ff ff b8 f4 ff ff ff eb 8c 48 c7 c7 e0 e1 8c c0 e8
[ 62.039605] RSP: 0018:ffffae25012a3d38 EFLAGS: 00010207
[ 62.042135] RAX: ffff8ae1b1e915c0 RBX: ffff8ae1b20d0000 RCX: 0000000000000000
[ 62.045616] RDX: 0000000000000000 RSI: ffff8ae1b7b270a0 RDI: ffff8ae1b7403800
[ 62.049086] RBP: ffffae25012a3d40 R08: 00000000000270a0 R09: ffffffff9fcbc4cb
[ 62.052583] R10: ffffd2e708ce0bc0 R11: 0000000000000001 R12: ffff8ae1b20d0010
[ 62.056077] R13: ffff8ae1b20d0000 R14: ffff8ae1b20d0c30 R15: ffff8ae1b2180000
[ 62.059568] FS: 00007f1d4770e540(0000) GS:ffff8ae1b7b00000(0000) knlGS:0000000000000000
[ 62.063629] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 62.066534] CR2: 0000557518fb58f0 CR3: 00000002333fa000 CR4: 00000000000006e0
[ 62.070048] Call Trace:
[ 62.071530] bch_cached_dev_attach+0x356/0x480 [bcache]
[ 62.074201] ? bch_keybuf_init+0x70/0x70 [bcache]
[ 62.076666] __cached_dev_store+0x59f/0x8b0 [bcache]
[ 62.079234] bch_cached_dev_store+0x39/0xc0 [bcache]
[ 62.081786] sysfs_kf_write+0x3b/0x40
[ 62.083785] kernfs_fop_write+0x12e/0x1b0
[ 62.085921] __vfs_write+0x1b/0x40
[ 62.087809] vfs_write+0xab/0x1b0
[ 62.089649] ksys_write+0x5c/0xd0
[ 62.091497] __x64_sys_write+0x1a/0x20
[ 62.093520] do_syscall_64+0x5a/0x110
[ 62.095523] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 62.098106] RIP: 0033:0x7f1d4720e154
[ 62.100071] Code: 89 02 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 8d 05 b1 07 2e 00 8b 00 85 c0 75 13 b8 01 00 00 00
 0f 05 <48> 3d 00 f0 ff ff 77 54 f3 c3 66 90 41 54 55 49 89 d4 53 48 89 f5
[ 62.108931] RSP: 002b:00007ffddf05ed58 EFLAGS: 00000246 ORIG_RAX...

Read more...

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Tested with eoan-proposed (problem does not exist)
----

root@bionic-bcache:~# uname -rv
5.2.0-9-generic #10-Ubuntu SMP Sat Jul 20 14:05:52 UTC 2019

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 54.032674] bcache: register_bdev() registered backing device loop0
[ 54.036972] bcache: run_cache_set() invalidating existing data
[ 54.051598] bcache: register_cache() registered cache device loop1
[ 54.065354] bcache: register_bcache() error /dev/loop1: device already registered
[ 58.038440] bcache: bch_cached_dev_attach() Caching loop0 as bcache0 on set cae17283-45ee-4aa1-9fb1-00ad889c02e5

# reboot
# # comment last line in script.

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 28.140043] bcache: register_bdev() registered backing device loop0
[ 41.927908] bcache: bcache_device_free() bcache0 stopped
[ 77.142936] bcache: register_bdev() registered backing device loop0
[ 77.160954] bcache: run_cache_set() invalidating existing data
[ 77.172800] bcache: register_cache() registered cache device loop1
[ 77.172886] bcache: register_bcache() error /dev/loop0: device already registered (emitting change event)

Changed in linux (Ubuntu Eoan):
status: Confirmed → Invalid
Changed in linux (Ubuntu Disco):
assignee: nobody → Mauricio Faria de Oliveira (mfo)
Changed in linux (Ubuntu Bionic):
assignee: nobody → Mauricio Faria de Oliveira (mfo)
status: New → Confirmed
Changed in linux (Ubuntu Disco):
status: New → Confirmed
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Tested with bionic-proposed + patch (problem does not happen)
---

Test kernel available in:
  https://people.canonical.com/~mfo/lp1837788/linux_4.15.0-56.62+test20190725b1_amd64/

# uname -rv
4.15.0-56-generic #62+test20190725b1 SMP Thu Jul 25 12:44:16 -03 2019

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
#
[ 61.772497] bcache: register_bdev() registered backing device loop0/null 2>&1
[ 61.789479] bcache: run_cache_set() invalidating existing data
[ 61.799599] bcache: register_cache() registered cache device loop1
[ 65.772621] bcache: bch_cached_dev_attach() Caching loop0 as bcache0 on set 2c09c59b-35b1-4da7-8225-d143c1ea81d2

# reboot
# # comment last line in script.

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
#
[ 36.853197] bcache: register_bdev() registered backing device loop0/null 2>&1
[ 36.885302] bcache: run_cache_set() invalidating existing data
[ 36.896425] bcache: register_cache() registered cache device loop1
(wait a few seconds)
(ok no oops anymore)

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Tested with disco-proposed + patch (problem does not happen)
---

# uname -rv
5.0.0-22-generic #23+test20190725b1 SMP Mon Jul 29 14:43:55 -03 2019

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 69.567775] bcache: register_bdev() registered backing device loop0/null 2>&1
[ 69.577141] bcache: run_cache_set() invalidating existing data
[ 69.591172] bcache: register_cache() registered cache device loop1
[ 69.591517] bcache: register_bcache() error /dev/loop0: device already registered (emitting change event)
[ 73.570620] bcache: bch_cached_dev_attach() Caching loop0 as bcache0 on set 0ed05289-ed85-40da-bcf4-3991f2e18e03
#

(no warning message)

# reboot
# # comment last line in script.

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
#

[ 40.045968] bcache: register_bdev() registered backing device loop0ev/null 2>&
[ 40.050914] bcache: run_cache_set() invalidating existing data
[ 40.060793] bcache: register_cache() registered cache device loop1
[ 40.068735] bcache: register_bcache() error /dev/loop1: device already registered

(wait a few seconds)
(ok no oops anymore)

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Attaching test-case script.

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Patches sent to the kernel-team mailing list:

[B][PATCH] bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached
https://lists.ubuntu.com/archives/kernel-team/2019-July/102653.html

[D][PATCH] bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached
https://lists.ubuntu.com/archives/kernel-team/2019-July/102654.html

description: updated
Changed in linux (Ubuntu Bionic):
status: Confirmed → In Progress
Changed in linux (Ubuntu Disco):
status: Confirmed → In Progress
Changed in linux (Ubuntu Disco):
status: In Progress → Fix Committed
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-disco' to 'verification-done-disco'. If the problem still exists, change the tag 'verification-needed-disco' to 'verification-failed-disco'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-disco
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Verification successful with disco-proposed.
No warning nor oops anymore.

# rmadison -s disco-proposed linux
 linux | 5.0.0-26.27 | disco-proposed | source

# uname -rv
5.0.0-26-generic #27-Ubuntu SMP Tue Aug 13 17:47:39 UTC 2019

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 171.879953] bcache: register_bdev() registered backing device loop0
[ 171.920116] bcache: run_cache_set() invalidating existing data
[ 171.931843] bcache: register_cache() registered cache device loop1
[ 175.906911] bcache: bch_cached_dev_attach() Caching loop0 as bcache0 on set 18fa9221-da9c-4e69-8b23-6eb093030c30

# reboot
# # comment last line in script.

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 91.990987] bcache: register_bdev() registered backing device loop0
[ 94.001825] bcache: run_cache_set() invalidating existing data
[ 94.018920] bcache: register_cache() registered cache device loop1
# sleep 10
#

tags: added: verification-done-disco
removed: verification-needed-disco
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-bionic' to 'verification-done-bionic'. If the problem still exists, change the tag 'verification-needed-bionic' to 'verification-failed-bionic'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-bionic
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Verification successful with bionic-proposed.
No warning nor oops anymore.

# uname -rv
4.15.0-59-generic #66-Ubuntu SMP Wed Aug 14 10:56:44 UTC 2019

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 105.696881] bcache: register_bdev() registered backing device loop0
[ 105.703809] bcache: run_cache_set() invalidating existing data
[ 105.714280] bcache: register_cache() registered cache device loop1
[ 109.677765] bcache: bch_cached_dev_attach() Caching loop0 as bcache0 on set 3fd195b5-7334-4759-81d9-0faadc042f59
#

# reboot
# # comment last line in script.

# ./setup-bcache-wb_percent-before-attach.sh >/dev/null 2>&1
[ 21.645209] bcache: register_bdev() registered backing device loop0
[ 21.697858] bcache: run_cache_set() invalidating existing data
[ 21.709142] bcache: register_cache() registered cache device loop1
# sleep 10
#

tags: added: verification-done-bionic
removed: verification-needed-bionic
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (34.4 KiB)

This bug was fixed in the package linux - 5.0.0-27.28

---------------
linux (5.0.0-27.28) disco; urgency=medium

  * disco/linux: 5.0.0-27.28 -proposed tracker (LP: #1840816)

  * [Potential Regression] System crashes when running ftrace test in
    ubuntu_kernel_selftests (LP: #1840750)
    - x86/kprobes: Set instruction page as executable

linux (5.0.0-26.27) disco; urgency=medium

  * disco/linux: 5.0.0-26.27 -proposed tracker (LP: #1839972)

  * Packaging resync (LP: #1786013)
    - [Packaging] update helper scripts

  * alsa/hdmi: add icelake hdmi audio support for a Dell machine (LP: #1836916)
    - ALSA: hda: hdmi - add Icelake support
    - ALSA: hda/hdmi - Remove duplicated define
    - ALSA: hda/hdmi - Fix i915 reverse port/pin mapping

  * input/mouse: alps trackpoint-only device doesn't work (LP: #1836752)
    - Input: alps - don't handle ALPS cs19 trackpoint-only device
    - Input: alps - fix a mismatch between a condition check and its comment

  * [18.04 FEAT] Enhanced hardware support (LP: #1836857)
    - s390: report new CPU capabilities
    - s390: add alignment hints to vector load and store

  * System does not auto detect disconnection of external monitor (LP: #1835001)
    - drm/i915: Add support for retrying hotplug
    - drm/i915: Enable hotplug retry

  * [18.04 FEAT] Enhanced CPU-MF hardware counters - kernel part (LP: #1836860)
    - s390/cpum_cf: Add support for CPU-MF SVN 6
    - s390/cpumf: Add extended counter set definitions for model 8561 and 8562

  * EeePC 1005px laptop backlight is off after system boot up (LP: #1837117)
    - platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from
      asus_nb_wmi

  * br_netfilter: namespace sysctl operations (LP: #1836910)
    - netfilter: bridge: port sysctls to use brnf_net
    - netfilter: bridge: namespace bridge netfilter sysctls
    - netfilter: bridge: prevent UAF in brnf_exit_net()

  * ideapad_laptop disables WiFi/BT radios on Lenovo Y540 (LP: #1837136)
    - platform/x86: ideapad-laptop: Remove no_hw_rfkill_list

  * shiftfs: allow overlayfs (LP: #1838677)
    - SAUCE: shiftfs: enable overlayfs on shiftfs

  * bcache: bch_allocator_thread(): hung task timeout (LP: #1784665)
    - bcache: never writeback a discard operation
    - bcache: improve bcache_reboot()
    - SAUCE: bcache: fix deadlock in bcache_allocator

  * Regressions in CMA allocation rework (LP: #1839395)
    - dma-contiguous: do not overwrite align in dma_alloc_contiguous()
    - dma-contiguous: page-align the size in dma_free_contiguous()

  * CVE-2019-3900
    - vhost: introduce vhost_exceeds_weight()
    - vhost_net: fix possible infinite loop
    - vhost: vsock: add weight support
    - vhost: scsi: add weight support

  * Disco update: 5.0.21 upstream stable release (LP: #1837518)
    - bonding/802.3ad: fix slave link initialization transition states
    - cxgb4: offload VLAN flows regardless of VLAN ethtype
    - inet: switch IP ID generator to siphash
    - ipv4/igmp: fix another memory leak in igmpv3_del_delrec()
    - ipv4/igmp: fix build error if !CONFIG_IP_MULTICAST
    - ipv6: Consider sk_bound_dev_if when binding a raw socket to an address
    - ipv6: Fix redi...

Changed in linux (Ubuntu Disco):
status: Fix Committed → Fix Released
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

This fix is released for bionic and disco. Setting both as such.
For some reason the SRU machinery didn't pick it to this LP bug.

Bionic:

~/git/ubuntu-bionic$ git log --oneline origin/master -- drivers/md/bcache/ | grep 'bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached'
474349a526e5 bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached

~/git/ubuntu-bionic$ git describe --contains 474349a526e5
Ubuntu-4.15.0-59.66~816

Disco:

~/git/ubuntu-disco$ git log --oneline origin/master -- drivers/md/bcache/ | grep 'bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached'
41044186a4a5 bcache: only set BCACHE_DEV_WB_RUNNING when cached device attached

~/git/ubuntu-disco$ git describe --contains 41044186a4a5
Ubuntu-5.0.0-26.27~543

Changed in linux (Ubuntu Bionic):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.