Re: [gentoo-user] Warnings on shutting down bcache: WARNING: CPU: 1 PID: 4378 at lib/idr.c:383

2017-08-23 Thread Andrew Savchenko
On Tue, 15 Aug 2017 14:07:42 +0200 Håkon Alstadheim wrote:
> 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_ 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: 880216b24240 task.stack: c900431e4000
> [140398.382197] RIP: e030:ida_remove+0xde/0xef
> [140398.382199] RSP: e02b:c900431e7db0 EFLAGS: 00010082
> [140398.382202] RAX: 0033 RBX: 0012 RCX:
> 
> [140398.382204] RDX: 880249654450 RSI: 88024964dc08 RDI:
> 88024964dc08
> [140398.382205] RBP: c900431e7e10 

[gentoo-user] Warnings on shutting down bcache: WARNING: CPU: 1 PID: 4378 at lib/idr.c:383

2017-08-15 Thread Håkon Alstadheim
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_ 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: 880216b24240 task.stack: c900431e4000
[140398.382197] RIP: e030:ida_remove+0xde/0xef
[140398.382199] RSP: e02b:c900431e7db0 EFLAGS: 00010082
[140398.382202] RAX: 0033 RBX: 0012 RCX:

[140398.382204] RDX: 880249654450 RSI: 88024964dc08 RDI:
88024964dc08
[140398.382205] RBP: c900431e7e10 R08:  R09:
000448da
[140398.382207] R10: 1668 R11: 81f1dad0 R12:
c08114c8
[140398.382209] R13: c08114c0 R14: 00fa R15:
0010
[140398.382223] FS: