USB3 device with btrfs crashing

Hi,

I recently moved my LXC containers to a btrfs formatted USB3 device, but when I start using the LXC containers, the USB3 device is suddenly disconnected after a little IO.

Firmware: OpenWrt omnia 15.05 r47055 / LuCI 49c3edd5861fd032fa8379ceda525c27a908a114 branch (git-17.212.24321-49c3edd)

Any idea what is going on here? Here is the dmesg:

[ 281.110297] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 306.958693] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 382.749434] nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.
[ 531.746952] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 535.486760] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 537.336648] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 547.636077] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 552.145802] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 558.975458] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 560.595348] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 562.125266] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 563.685191] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 565.115121] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 566.535057] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 567.944965] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 570.504849] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 571.874731] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 573.274643] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 574.674550] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 576.054453] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 577.424354] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 577.874323] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 579.254235] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 580.664138] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 582.054098] usb 4-1: reset SuperSpeed USB device number 2 using xhci-hcd
[ 583.453952] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 583.663910] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 583.873881] usb 4-1: device not accepting address 2, error -22
[ 584.293896] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 584.503845] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 584.713819] usb 4-1: device not accepting address 2, error -22
[ 585.133843] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 585.343808] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 585.553775] usb 4-1: device not accepting address 2, error -22
[ 585.973788] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 586.183739] xhci-hcd f10f8000.usb3: ERROR: unexpected setup address command completion code 0x11.
[ 586.393712] usb 4-1: device not accepting address 2, error -22
[ 586.453762] usb 4-1: USB disconnect, device number 2
[ 586.473741] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[ 586.473753] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 7b 58 e8 00 00 f0 00
[ 586.473758] blk_update_request: I/O error, dev sda, sector 8083688
[ 586.480009] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 1, rd 0, flush 0, corrupt 0, gen 0
[ 586.489165] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 2, rd 0, flush 0, corrupt 0, gen 0
[ 586.498294] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 3, rd 0, flush 0, corrupt 0, gen 0
[ 586.507424] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 4, rd 0, flush 0, corrupt 0, gen 0
[ 586.516548] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 5, rd 0, flush 0, corrupt 0, gen 0
[ 586.525671] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 6, rd 0, flush 0, corrupt 0, gen 0
[ 586.534793] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 7, rd 0, flush 0, corrupt 0, gen 0
[ 586.543916] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 8, rd 0, flush 0, corrupt 0, gen 0
[ 586.553043] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 9, rd 0, flush 0, corrupt 0, gen 0
[ 586.562164] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 10, rd 0, flush 0, corrupt 0, gen 0
[ 586.572577] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x01 driverbyte=0x00
[ 586.572593] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 7b 59 d8 00 00 80 00
[ 586.572598] blk_update_request: I/O error, dev sda, sector 8083928
[ 586.605731] blk_update_request: I/O error, dev sda, sector 8118264
[ 586.611939] blk_update_request: I/O error, dev sda, sector 8118504
[ 586.618137] blk_update_request: I/O error, dev sda, sector 8118744
[ 586.670148] BTRFS: error (device sda1) in btrfs_commit_transaction:2218: errno=-5 IO failure (Error while writing out transaction)
[ 586.681961] BTRFS info (device sda1): forced readonly
[ 586.681972] BTRFS warning (device sda1): Skipping commit of aborted transaction.
[ 586.681975] ------------[ cut here ]------------
[ 586.681991] WARNING: CPU: 1 PID: 815 at fs/btrfs/transaction.c:1840 btrfs_commit_transaction+0xa80/0xbd8()
[ 586.681995] BTRFS: Transaction aborted (error -5)
[ 586.681997] Modules linked in: qcserial option iptable_nat ath9k usb_wwan rndis_host qmi_wwan pppoe nf_nat_pptp nf_nat_ipv4 nf_nat_amanda nf_conntrack_pptp nf_conntrack_netlink nf_conntrack_ipv6 nf_conntrack_ipv4 nf_conntrack_amanda ipt_REJECT ipt_MASQUERADE ebtable_nat ebtable_filter ebtable_broute cdc_ether ath9k_common armada_thermal xt_time xt_tcpudp xt_tcpmss xt_statistic xt_state xt_recent xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_id xt_hl xt_helper xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_HL xt_DSCP xt_CT xt_CLASSIFY usbserial usbnet ums_usbat ums_sddr55 ums_sddr09 ums_karma ums_jumpshot ums_isd200 ums_freecom ums_datafab ums_cypress ums_alauda ts_kmp ts_fsm ts_bm thermal_sys pppox ppp_mppe ppp_async nfnetlink nf_reject_ipv4 nf_nat_tftp nf_nat_snmp_basic nf_nat_sip nf_nat_redirect nf_nat_proto_gre nf_nat_masquerade_ipv4 nf_nat_irc nf_nat_h323 nf_nat_ftp nf_nat nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_tftp nf_conntrack_snmp nf_conntrack_sip nf_conntrack_rtcache nf_conntrack_proto_gre nf_conntrack_irc nf_conntrack_h323 nf_conntrack_ftp nf_conntrack_broadcast nf_conntrack mvsdio iptable_raw iptable_mangle iptable_filter ipt_ECN ip_tables hwmon ebtables ebt_vlan ebt_stp ebt_redirect ebt_pkttype ebt_mark_m ebt_mark ebt_limit ebt_among ebt_802_3 crc_ccitt cdc_wdm ath9k_hw sch_teql sch_tbf sch_sfq sch_red sch_prio sch_pie sch_netem sch_htb sch_gred sch_fq sch_dsmark sch_codel em_text em_nbyte em_meta em_cmp cls_basic act_vlan act_police act_pedit act_nat act_ipt act_gact act_csum act_bpf act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow cls_route cls_fw sch_hfsc sch_ingress ath10k_pci ath10k_core ath mac80211 cfg80211 compat ledtrig_usbdev ledtrig_oneshot xt_LED ledtrig_morse ledtrig_heartbeat ledtrig_gpio ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_raw ip6table_mangle ip6table_filter ip6_tables x_tables pppoatm ppp_generic slhc ip_gre gre ifb sit ip6_tunnel tunnel6 tunnel4 ip_tunnel veth tun snd_compress snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_rawmidi snd_seq_device snd_hwdep snd input_core soundcore br2684 atm sha1_generic ecb usb_storage xhci_plat_hcd xhci_pci xhci_hcd uhci_hcd ledtrig_transient sd_mod scsi_mod usbcore nls_base usb_common mii aead crypto_null
[ 586.682273] CPU: 1 PID: 815 Comm: btrfs-transacti Not tainted 4.4.119-082ea0f4a4e204b99821bedcb349ed54-0 #1
[ 586.682276] Hardware name: Marvell Armada 380/385 (Device Tree)
[ 586.682279] Backtrace:
[ 586.682289] [] (dump_backtrace) from [] (show_stack+0x18/0x1c)
[ 586.682293] r6:00000000 r5:60000113 r4:c06c63e8 r3:00000000
[ 586.682304] [] (show_stack) from [] (dump_stack+0x98/0xac)
[ 586.682312] [] (dump_stack) from [] (warn_slowpath_common+0x8c/0xbc)
[ 586.682314] r6:00000730 r5:c022d8f0 r4:edf91e98 r3:00000006
[ 586.682324] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x38/0x40)
[ 586.682326] r8:00000000 r7:ee36a400 r6:e4071c58 r5:ee516b48 r4:ea73aef0
[ 586.682338] [] (warn_slowpath_fmt) from [] (btrfs_commit_transaction+0xa80/0xbd8)
[ 586.682341] r3:fffffffb r2:c05e583c
[ 586.682349] [] (btrfs_commit_transaction) from [] (transaction_kthread+0x1a8/0x218)
[ 586.682352] r10:00000000 r9:00000000 r8:0000017f r7:edf90000 r6:00000bb8 r5:000005c0
[ 586.682360] r4:ee36a400
[ 586.682369] [] (transaction_kthread) from [] (kthread+0x110/0x124)
[ 586.682372] r10:00000000 r9:00000000 r8:00000000 r7:c02281c8 r6:ee36a400 r5:00000000
[ 586.682380] r4:edefd5c0
[ 586.682388] [] (kthread) from [] (ret_from_fork+0x14/0x24)
[ 586.682391] r7:00000000 r6:00000000 r5:c0043d88 r4:edefd5c0
[ 586.682399] —[ end trace 24b23d5f57f08eaa ]—
[ 586.682405] BTRFS: error (device sda1) in cleanup_transaction:1840: errno=-5 IO failure
[ 586.690460] BTRFS info (device sda1): delayed_refs has NO entry
[ 586.707026] BTRFS: error (device sda1) in btrfs_commit_transaction:2218: errno=-5 IO failure (Error while writing out transaction)
[ 586.718829] BTRFS warning (device sda1): Skipping commit of aborted transaction.
[ 586.718839] BTRFS: error (device sda1) in cleanup_transaction:1840: errno=-5 IO failure
[ 586.726884] BTRFS info (device sda1): delayed_refs has NO entry
[ 601.090222] xhci-hcd f10f8000.usb3: Stopped the command ring failed, maybe the host is dead
[ 601.098601] xhci-hcd f10f8000.usb3: Abort command ring failed
[ 601.104600] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104615] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104623] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104638] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104646] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104655] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104665] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104673] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104681] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.104688] ath10k_pci 0000:02:00.0: SWBA overrun on vdev 0, skipped old beacon
[ 601.107262] xhci-hcd f10f8000.usb3: HC died; cleaning up
[ 601.113943] xhci-hcd f10f8000.usb3: Error while assigning device slot ID
[ 601.116136] btrfs_dev_stat_print_on_error: 429 callbacks suppressed
[ 601.116141] BTRFS error (device sda1): bdev /dev/sda1 errs: wr 438, rd 2, flush 0, corrupt 0, gen 0
[ 601.130430] xhci-hcd f10f8000.usb3: Max number of devices this xHCI host supports is 32.
[ 601.138853] usb usb4-port1: couldn’t allocate usb_device

This seems to be the most interesting line. In standard C return codes (on Linux), ±22 is EINVAL, i.e. invalid argument.