I'm getting some noise in my logs when shutting down bcache. My system: Linux gentoo 4.12.7-gentoo #1 SMP Sun Aug 13 22:56:20 CEST 2017 x86_64 Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz GenuineIntel GNU/Linux Running as dom0 under Xen-4.9.0
My shutdown script loops over the bcache devices like so: --- for f in /sys/fs/bcache/854fc80e-5499-413f-b90b-87a803eaca7e/bdev*; do bdev=$(basename $f ) if [ -e $f/stop ]; then logger -t "init.d/probe-home-partition" -p daemon.warning\ "Stopping $bdev" einfo "Stopping $bdev" if ! echo 1 > $f/stop ; then ewarn "Could not stop $bdev" logger -t "init.d/probe-home-partition" -p daemon.warning\ "Could not stop $bdev" fi usleep 300 sleep 1 else einfo "$bdev not cached?" logger -t "init.d/probe-home-partition" -p daemon.warning \ "$bdev not cached ?" fi done ----- This gives me in daemon.log: ----- Aug 14 09:31:21 gentoo init.d/probe-home-partition: Stopping bdev15 Aug 14 09:31:22 gentoo init.d/probe-home-partition: Stopping bdev16 Aug 14 09:31:23 gentoo init.d/probe-home-partition: Stopping bdev17 Aug 14 09:31:24 gentoo init.d/probe-home-partition: Stopping bdev18 Aug 14 09:31:25 gentoo init.d/probe-home-partition: Stopping bdev19 Aug 14 09:31:26 gentoo init.d/probe-home-partition: Stopping cache set ----- But it seems bcache is doing something weird, stopping a device called bcache0, which I do not have, before stopping the first of my bcache devices. ALL runs of "echo 1 > $device/stop" provoke a warning in lib/idr.c on that same line. It may be that my stopping of the bcache devices is wrong, un-necessary and misguided, but it should still work the way I am doing it, should it not? ---kern.log:--- ... [140395.421994] nfsd: last server has exited, flushing export cache [140397.011932] XFS (bcache16): Unmounting Filesystem [140397.248911] bcache: bcache_device_free() bcache0 stopped [140398.300187] bcache: bcache_device_free() bcache16 stopped [140398.381951] ida_remove called for id=16 which is not allocated. [140398.381975] ------------[ cut here ]------------ [140398.381985] WARNING: CPU: 1 PID: 4378 at lib/idr.c:383 ida_remove+0xde/0xef [140398.381987] Modules linked in: xt_physdev iptable_filter ip_tables x_tables nfsd auth_rpcgss oid_registry nfsv4 dns_resolver nfsv3 nfs_acl iTCO_wdt iTCO_vendor_support binfmt_misc tun usbip_host usbip_core pktcdvd xen_wdt xen_blkback intel_rapl amdgpu intel_powerclamp crc32c_intel serio_raw drm_kms_helper pcspkr syscopyarea sysfillrect sysimgblt fb_sys_fops ttm lpc_ich i2c_i801 snd_hda_codec_realtek drm snd_hda_codec_generic bcache snd_usb_audio snd_usbmidi_lib snd_hda_intel snd_rawmidi snd_hda_codec snd_seq_device snd_hwdep snd_hda_core snd_pcm snd_timer snd cp210x usbserial nct6775 input_leds hwmon_vid shpchp ipmi_ssif wmi acpi_power_meter dm_zero dm_thin_pool dm_persistent_data dm_bio_prison dm_service_time dm_round_robin dm_queue_length dm_multipath dm_log_userspace cn virtio_pci virtio_scsi [140398.382056] virtio_blk virtio_console virtio_balloon xts aes_x86_64 cbc sha512_generic sha1_generic libiscsi scsi_transport_iscsi macvlan virtio_net virtio_ring virtio e1000 fuse overlay nfs lockd grace sunrpc fscache jfs multipath linear raid10 raid1 raid0 dm_raid raid456 async_raid6_recov async_memcpy async_pq async_xor xor async_tx raid6_pq dm_snapshot dm_bufio dm_crypt dm_mirror dm_region_hash dm_log dm_mod dax hid_sunplus hid_sony hid_samsung hid_pl hid_petalynx hid_monterey hid_microsoft hid_logitech ff_memless hid_gyration hid_ezkey hid_cypress hid_chicony hid_cherry hid_a4tech sl811_hcd xhci_plat_hcd ohci_pci ohci_hcd uhci_hcd aic94xx lpfc qla2xxx aacraid sx8 DAC960 hpsa cciss 3w_9xxx 3w_xxxx mptsas mptfc scsi_transport_fc mptspi mptscsih mptbase atp870u dc395x qla1280 imm parport dmx3191d [140398.382139] sym53c8xx gdth initio BusLogic arcmsr aic7xxx aic79xx sg pdc_adma sata_inic162x sata_mv sata_qstor sata_vsc sata_uli sata_sis sata_sx4 sata_nv sata_via sata_svw sata_sil24 sata_sil sata_promise pata_sis usbhid led_class igb ptp dca i2c_algo_bit ehci_pci ehci_hcd xhci_pci megaraid_sas xhci_hcd [140398.382175] CPU: 1 PID: 4378 Comm: kworker/1:2 Not tainted 4.12.6-gentoo #1 [140398.382177] Hardware name: ASUSTeK COMPUTER INC. Z10PE-D8 WS/Z10PE-D8 WS, BIOS 3407 03/10/2017 [140398.382190] Workqueue: events cached_dev_free [bcache] [140398.382193] task: ffff880216b24240 task.stack: ffffc900431e4000 [140398.382197] RIP: e030:ida_remove+0xde/0xef [140398.382199] RSP: e02b:ffffc900431e7db0 EFLAGS: 00010082 [140398.382202] RAX: 0000000000000033 RBX: 0000000000000012 RCX: 0000000000000000 [140398.382204] RDX: ffff880249654450 RSI: ffff88024964dc08 RDI: ffff88024964dc08 [140398.382205] RBP: ffffc900431e7e10 R08: 0000000000000000 R09: 00000000000448da [140398.382207] R10: 0000000000001668 R11: ffffffff81f1dad0 R12: ffffffffc08114c8 [140398.382209] R13: ffffffffc08114c0 R14: 00000000000000fa R15: 0000000000000010 [140398.382223] FS: 0000000000000000(0000) GS:ffff880249640000(0000) knlGS:ffff880249640000 [140398.382225] CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033 [140398.382227] CR2: 00007fb681059eb0 CR3: 000000020a7b9000 CR4: 0000000000042660 [140398.382230] Call Trace: [140398.382238] ida_simple_remove+0x2f/0x45 [140398.382247] bcache_device_free+0x8c/0xc4 [bcache] [140398.382255] cached_dev_free+0x6b/0xe1 [bcache] [140398.382261] process_one_work+0x16f/0x281 [140398.382265] ? rescuer_thread+0x24e/0x24e [140398.382268] worker_thread+0x1a4/0x257 [140398.382272] ? rescuer_thread+0x24e/0x24e [140398.382275] kthread+0xfc/0x101 [140398.382278] ? init_completion+0x24/0x24 [140398.382284] ret_from_fork+0x25/0x30 [140398.382287] Code: 00 75 2a 4c 89 f7 e8 79 52 d5 ff 48 8d 75 b0 4c 89 e2 4c 89 ef e8 03 3a 00 00 eb 11 44 89 fe 48 c7 c7 0a a1 a0 81 e8 c9 79 d0 ff <0f> ff 48 83 c4 38 5b 41 5c 41 5d 41 5e 41 5f 5d c3 85 f6 79 02 [140398.382341] ---[ end trace 279bbc0d0aae56cc ]--- ----