bcache kernel oops if creating with 8K block size

Bug #1662407 reported by mahmoh
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bcache-tools (Ubuntu)
Triaged
Undecided
Unassigned

Bug Description

# make-bcache -C /dev/nvme0n1p5 -B /dev/sda4 --discard --writeback -w 8K --wipe-bcache
UUID: 77b47d90-77df-4c72-ac98-f4016cbb637b
Set UUID: de69c5aa-4cd1-41e9-86c2-48054c36bca9
version: 0
nbuckets: 24576
block_size: 16
bucket_size: 1024
nr_in_set: 1
nr_this_dev: 0
first_bucket: 1
UUID: cfcf5483-7ae5-4bf7-aaa1-e80a7ed3e49b
Set UUID: de69c5aa-4cd1-41e9-86c2-48054c36bca9
version: 1
block_size: 16
data_offset: 16

Results in:
...
Feb 7 03:42:09 ubuntu kernel: [ 654.832820] bcache: bch_journal_replay() journal replay done, 0 keys in 1 entries, seq 1
Feb 7 03:42:09 ubuntu kernel: [ 654.833029] bcache: register_cache() registered cache device nvme0n1p5
Feb 7 03:42:50 ubuntu kernel: [ 695.322129] bcache: cache_set_free() Cache set 3382ccca-4893-4933-b4f1-8286d7e09d20 unregistered
Feb 7 03:43:17 ubuntu kernel: [ 722.935068] bcache: bch_journal_replay() journal replay done, 0 keys in 1 entries, seq 2
Feb 7 03:43:17 ubuntu kernel: [ 722.937292] bcache: register_cache() registered cache device nvme0n1p5
Feb 7 03:44:35 ubuntu kernel: [ 800.815538] bcache: cache_set_free() Cache set 3382ccca-4893-4933-b4f1-8286d7e09d20 unregistered
Feb 7 03:44:57 ubuntu kernel: [ 822.495862] bcache: register_bcache() error opening /dev/nvme0n1p5: Bad block/bucket size
Feb 7 03:44:57 ubuntu kernel: [ 822.511403] bcache: register_bdev() registered backing device sda4
Feb 7 03:44:57 ubuntu kernel: [ 822.512207] BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
Feb 7 03:44:57 ubuntu kernel: [ 822.512235] IP: [<ffffffff812482f0>] bdev_read_page+0x10/0xb0
Feb 7 03:44:57 ubuntu kernel: [ 822.512256] PGD 0
Feb 7 03:44:57 ubuntu kernel: [ 822.512263] Oops: 0000 [#1] SMP
Feb 7 03:44:57 ubuntu kernel: [ 822.512275] Modules linked in: bcache drbg ansi_cprng ctr ccm rfcomm bnep hid_multitouch snd_hda_codec_hdmi i2c_designware_platform i2c_designware_core dell_wmi dell_led snd_hda_codec_realtek snd_hda_codec_generic arc4 dell_rbtn dell_laptop dcdbas dell_smm_hwmon intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_intel snd_hda_codec snd_hda_core kvm_intel snd_hwdep kvm snd_pcm irqbypass crct10dif_pclmul iwlmvm crc32_pclmul aesni_intel mac80211 aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd snd_seq_midi snd_seq_midi_event snd_rawmidi iwlwifi rtsx_pci_ms snd_seq memstick cfg80211 snd_seq_device input_leds joydev snd_timer serio_raw snd uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 soundcore videobuf2_core v4l2_common videodev cdc_acm media btusb btrtl idma64 mei_me virt_dma mei shpchp processor_thermal_device intel_soc_dts_iosf intel_lpss_pci int3403_thermal hci_uart btbcm btqca btintel bluetooth intel_hid dell_smo8800 sparse_keymap int3402_thermal int340x_thermal_zone intel_lpss_acpi int3400_thermal acpi_als intel_lpss mac_hid acpi_pad acpi_thermal_rel kfifo_buf industrialio parport_pc ppdev lp parport autofs4 overlay nls_utf8 isofs nls_iso8859_1 dm_mirror dm_region_hash dm_log uas usb_storage rtsx_pci_sdmmc nouveau i915_bpo mxm_wmi intel_ips ttm i2c_algo_bit psmouse drm_kms_helper syscopyarea sysfillrect sysimgblt nvme fb_sys_fops rtsx_pci drm ahci libahci i2c_hid hid pinctrl_sunrisepoint pinctrl_intel wmi video fjes
Feb 7 03:44:57 ubuntu kernel: [ 822.512758] CPU: 7 PID: 14484 Comm: systemd-udevd Not tainted 4.4.0-31-generic #50-Ubuntu
Feb 7 03:44:57 ubuntu kernel: [ 822.512781] Hardware name: Dell Inc. Precision 5510/08R8KJ, BIOS 1.2.19 12/22/2016
Feb 7 03:44:57 ubuntu kernel: [ 822.512802] task: ffff880891ac3b00 ti: ffff8800340a0000 task.ti: ffff8800340a0000
Feb 7 03:44:57 ubuntu kernel: [ 822.512822] RIP: 0010:[<ffffffff812482f0>] [<ffffffff812482f0>] bdev_read_page+0x10/0xb0
Feb 7 03:44:57 ubuntu kernel: [ 822.512846] RSP: 0018:ffff8800340a3a80 EFLAGS: 00010287
Feb 7 03:44:57 ubuntu kernel: [ 822.512861] RAX: 0000000000000004 RBX: 0000000000000000 RCX: 0000000000000004
Feb 7 03:44:57 ubuntu kernel: [ 822.512880] RDX: ffffea001f190c40 RSI: fff88081a9189200 RDI: 0000000000000000
Feb 7 03:44:57 ubuntu kernel: [ 822.512899] RBP: ffff8800340a3aa0 R08: ffff8800340a3bb8 R09: ffff8800340a3bb0
Feb 7 03:44:57 ubuntu kernel: [ 822.512918] R10: ffff8808922a1130 R11: fff88081a9189200 R12: 0000000000000000
Feb 7 03:44:57 ubuntu kernel: [ 822.512937] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Feb 7 03:44:57 ubuntu kernel: [ 822.512956] FS: 00007f9af701e8c0(0000) GS:ffff8808bddc0000(0000) knlGS:0000000000000000
Feb 7 03:44:57 ubuntu kernel: [ 822.512978] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Feb 7 03:44:57 ubuntu kernel: [ 822.512994] CR2: 0000000000000098 CR3: 00000000340bb000 CR4: 00000000003406e0
Feb 7 03:44:57 ubuntu kernel: [ 822.513013] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Feb 7 03:44:57 ubuntu kernel: [ 822.513032] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Feb 7 03:44:57 ubuntu kernel: [ 822.513051] Stack:
Feb 7 03:44:57 ubuntu kernel: [ 822.513058] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
Feb 7 03:44:57 ubuntu kernel: [ 822.513082] ffff8800340a3b78 ffffffff8124ef9b ffff8800340a3ae0 ffff8800340a3ba8
Feb 7 03:44:57 ubuntu kernel: [ 822.513105] 0000000000000000 ffff8800340a3bb8 ffff8800340a3bb0 ffffffff81247c20
Feb 7 03:44:57 ubuntu kernel: [ 822.513129] Call Trace:
Feb 7 03:44:57 ubuntu kernel: [ 822.513139] [<ffffffff8124ef9b>] do_mpage_readpage+0x52b/0x7a0
Feb 7 03:44:57 ubuntu kernel: [ 822.513156] [<ffffffff81247c20>] ? I_BDEV+0x20/0x20
Feb 7 03:44:57 ubuntu kernel: [ 822.513172] [<ffffffff8119e5de>] ? lru_cache_add+0xe/0x10
Feb 7 03:44:57 ubuntu kernel: [ 822.513188] [<ffffffff8124f322>] mpage_readpages+0x112/0x190
Feb 7 03:44:57 ubuntu kernel: [ 822.513204] [<ffffffff81247c20>] ? I_BDEV+0x20/0x20
Feb 7 03:44:57 ubuntu kernel: [ 822.513218] [<ffffffff81247c20>] ? I_BDEV+0x20/0x20
Feb 7 03:44:57 ubuntu kernel: [ 822.513234] [<ffffffff811e11ac>] ? alloc_pages_current+0x8c/0x110
Feb 7 03:44:57 ubuntu kernel: [ 822.513252] [<ffffffff812487bd>] blkdev_readpages+0x1d/0x20
Feb 7 03:44:57 ubuntu kernel: [ 822.513268] [<ffffffff8119c686>] __do_page_cache_readahead+0x196/0x230
Feb 7 03:44:57 ubuntu kernel: [ 822.513288] [<ffffffff810e7dc7>] ? call_rcu_sched+0x17/0x20
Feb 7 03:44:57 ubuntu kernel: [ 822.513304] [<ffffffff813f6d52>] ? radix_tree_lookup_slot+0x22/0x50
Feb 7 03:44:57 ubuntu kernel: [ 822.513323] [<ffffffff8119ca8a>] force_page_cache_readahead+0xaa/0x100
Feb 7 03:44:57 ubuntu kernel: [ 822.513342] [<ffffffff8119cb1f>] page_cache_sync_readahead+0x3f/0x50
Feb 7 03:44:57 ubuntu kernel: [ 822.513360] [<ffffffff8118f5bd>] generic_file_read_iter+0x4ad/0x5c0
Feb 7 03:44:57 ubuntu kernel: [ 822.513379] [<ffffffff815c357a>] ? sd_ioctl+0x4a/0x110
Feb 7 03:44:57 ubuntu kernel: [ 822.513394] [<ffffffff81248a95>] blkdev_read_iter+0x35/0x40
Feb 7 03:44:57 ubuntu kernel: [ 822.513411] [<ffffffff8120cbc4>] new_sync_read+0x94/0xd0
Feb 7 03:44:57 ubuntu kernel: [ 822.513427] [<ffffffff8120cc26>] __vfs_read+0x26/0x40
Feb 7 03:44:57 ubuntu kernel: [ 822.513442] [<ffffffff8120d1e6>] vfs_read+0x86/0x130
Feb 7 03:44:57 ubuntu kernel: [ 822.513457] [<ffffffff8120df35>] SyS_read+0x55/0xc0
Feb 7 03:44:57 ubuntu kernel: [ 822.513472] [<ffffffff8182db32>] entry_SYSCALL_64_fastpath+0x16/0x71
Feb 7 03:44:57 ubuntu kernel: [ 822.513489] Code: 83 f8 a1 0f 45 d8 89 d8 5b 41 5c 5d c3 0f 1f 40 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 41 56 41 55 41 54 53 <48> 8b 87 98 00 00 00 4c 8b b0 c0 03 00 00 49 83 7e 10 00 74 77
Feb 7 03:44:57 ubuntu kernel: [ 822.513603] RIP [<ffffffff812482f0>] bdev_read_page+0x10/0xb0
Feb 7 03:44:57 ubuntu kernel: [ 822.513621] RSP <ffff8800340a3a80>
Feb 7 03:44:57 ubuntu kernel: [ 822.513631] CR2: 0000000000000098
Feb 7 03:44:57 ubuntu kernel: [ 822.520392] ---[ end trace 2180ab74f37e6694 ]---

Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

Linux ubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
mahmoh (mahmoh) wrote :

Oddly I get this error that you would this should apply to the failure case:

# make-bcache -C /dev/nvme0n1p5 -B /dev/sda4 --discard --writeback -w 4K -b 2048
Bucket size cannot be smaller than block size

P.S. pool/main/b/bcache-tools/bcache-tools_1.0.8-2_amd64.deb

Joshua Powers (powersj)
Changed in bcache-tools (Ubuntu):
status: New → Incomplete
status: Incomplete → Triaged
Revision history for this message
Robert Collins (lifeless) wrote :

I can reproduce adding such a cache triggering an OOPS in 18.10:

make-bcache -o 7741440 -w 8k -B /dev/md127 -C /dev/nvme0n1p2

RIP 0010:create_empty_buffers+0x29/0x110
CallTrace
create_page_buffers
block_read_full_page
check_disk_change
__add_to_page_cache_locked
blkdev_readpage
...

Revision history for this message
Robert Collins (lifeless) wrote :
Download full text (5.8 KiB)

[ 2938.649666] bcache: register_bcache() error /dev/nvme0n1p2: Bad block/bucket size
[ 2945.532897] bcache: register_bdev() registered backing device md127
[ 2945.533124] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[ 2945.533863] PGD 0 P4D 0
[ 2945.535162] Oops: 0000 [#1] SMP NOPTI
[ 2945.536474] CPU: 13 PID: 3773 Comm: bcache-register Not tainted 4.18.0-10-generic #11-Ubuntu
[ 2945.537785] Hardware name: System manufacturer System Product Name/PRIME X399-A, BIOS 0808 10/12/2018
[ 2945.539297] RIP: 0010:create_empty_buffers+0x29/0x110
[ 2945.540623] Code: 90 0f 1f 44 00 00 55 48 89 e5 41 55 49 89 d5 ba 01 00 00 00 41 54 53 48 89 fb e8 92 f5 ff ff 49 89 c4 48 89 c2 eb 03 48 89 ca <48> 8b 4a 08 4c 09 2a 48 85 c9 75 f1 4c 89 62 08 48 8b 43 18 48 8d
[ 2945.542015] RSP: 0018:ffffb90b874777d0 EFLAGS: 00010282
[ 2945.543408] RAX: 0000000000000000 RBX: ffffe1309f8b1140 RCX: 000000000000000d
[ 2945.544793] RDX: 0000000000000000 RSI: 0000000000002000 RDI: ffffe1309f8b1140
[ 2945.546727] RBP: ffffb90b874777e8 R08: dead0000000000ff R09: 0000000000000011
[ 2945.548121] R10: ffffffffffffffff R11: 0000000000000000 R12: 0000000000000000
[ 2945.549515] R13: 0000000000000000 R14: 00000000006200c0 R15: ffffe1309f8b1140
[ 2945.550888] FS: 00007f7d07190540(0000) GS:ffff9e0f5cd40000(0000) knlGS:0000000000000000
[ 2945.552266] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2945.553646] CR2: 0000000000000008 CR3: 00000007e788c000 CR4: 00000000003406e0
[ 2945.555027] Call Trace:
[ 2945.556399] create_page_buffers+0x51/0x60
[ 2945.557799] block_read_full_page+0x4d/0x330
[ 2945.559191] ? check_disk_change+0x70/0x70
[ 2945.560562] ? __add_to_page_cache_locked+0x1e3/0x240
[ 2945.561935] blkdev_readpage+0x18/0x20
[ 2945.563304] do_read_cache_page+0x2b4/0x5b0
[ 2945.564684] ? blkdev_writepages+0x10/0x10
[ 2945.566052] read_cache_page+0x15/0x20
[ 2945.567562] read_dev_sector+0x2d/0xd0
[ 2945.568920] read_lba+0xcd/0x220
[ 2945.570259] ? find_valid_gpt+0xd1/0x560
[ 2945.571601] find_valid_gpt+0xf1/0x560
[ 2945.572939] ? string+0x61/0x80
[ 2945.574286] efi_partition+0x89/0x3a3
[ 2945.575608] ? snprintf+0x49/0x60
[ 2945.576916] ? find_valid_gpt+0x560/0x560
[ 2945.578224] check_partition+0x139/0x236
[ 2945.580162] rescan_partitions+0xaf/0x290
[ 2945.581469] ? down_write+0x12/0x40
[ 2945.582775] __blkdev_get+0x367/0x500
[ 2945.584081] blkdev_get+0x10c/0x330
[ 2945.585380] ? unlock_new_inode+0x4b/0x60
[ 2945.586706] ? bdget+0x110/0x130
[ 2945.588005] __device_add_disk+0x392/0x430
[ 2945.589307] device_add_disk+0x13/0x20
[ 2945.590616] bch_cached_dev_run.part.31+0x42/0x1b0 [bcache]
[ 2945.591917] register_bcache.cold.49+0x20d/0x212 [bcache]
[ 2945.593249] ? __seccomp_filter+0x49/0x4b0
[ 2945.594571] kobj_attr_store+0x12/0x20
[ 2945.596000] ? _cond_resched+0x19/0x30
[ 2945.597279] ? kobj_attr_store+0x12/0x20
[ 2945.598549] sysfs_kf_write+0x3b/0x50
[ 2945.599800] kernfs_fop_write+0x12e/0x1b0
[ 2945.601057] __vfs_write+0x1b/0x40
[ 2945.602350] vfs_write+0xab/0x1b0
[ 2945.603610] ksys_write+0x55/0xc0
[ 2945.604857] __x64_sys_write+0x1a/0x20
[ 2945.606100] do_syscall_64+0x5a/0x110
[ 2945.607334] entry_SYSCALL_6...

Read more...

Revision history for this message
Robert Collins (lifeless) wrote :

This should perhaps be moved to the kernel; its not clear that userspace is doing anything wrong. I've filed #1809748 for now.

Revision history for this message
Robert Collins (lifeless) wrote :

sb.magic ok
sb.first_sector 8 [match]
sb.csum 5A3217E583DB5B86 [match]
sb.version 0 [cache device]

dev.label (empty)
dev.uuid 2a9e0dfd-acd0-4750-85ae-b347d7580e2b
dev.sectors_per_block 16
dev.sectors_per_bucket 1024
dev.cache.first_sector 1024
dev.cache.cache_sectors 209714176
dev.cache.total_sectors 209715200
dev.cache.ordered no
dev.cache.discard no
dev.cache.pos 0
dev.cache.replacement 0 [lru]

cset.uuid 24283111-591b-4fb8-9428-8f5db4cb5a87

Revision history for this message
Robert Collins (lifeless) wrote :

after doing a wipefs on the cache drive the BUG still occured; wipefs's the backing drive corrected that. I haven't yet tried wiping just the backing drive.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I agree that this looks much more like a kernel bug.
You could have added a task here - but I'll make it a dup so that overall only bug 1809748 to look at.

There as a hint I think the kernel Team usually wants tha automated report adding the exact versions as you were asked in the bot comment https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1809748/comments/2

Providing this there might help to get it finally started.

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.