Bug 42953 - kernel BUG at fs/btrfs/transaction.c:1349 btrfs_commit_transaction+0x928/0x930 [btrfs]()
kernel BUG at fs/btrfs/transaction.c:1349 btrfs_commit_transaction+0x928/0x93...
Product: File System
Classification: Unclassified
Component: btrfs
All Linux
: P1 normal
Assigned To: fs_btrfs@kernel-bugs.osdl.org
Depends on:
  Show dependency treegraph
Reported: 2012-03-18 03:30 UTC by rocko
Modified: 2013-04-30 16:53 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.3-rc7
Tree: Mainline
Regression: No

btrfs crash log (17.78 KB, text/plain)
2012-03-18 03:30 UTC, rocko

Description rocko 2012-03-18 03:30:13 UTC
Created attachment 72640 [details]
btrfs crash log

I have an external USB drive formatted as btrfs and two external USB ext4 drives attached. Whenever I try to suspend the laptop, the kernel always crashes while trying to umount the btrfs drive, ie before suspend succeeds. The drives are *not* disconnected or powered down during the process. The btrfs drive and one ext4 drive are attached via a USB hub.

If I umount the drive manually first, the laptop suspends without a problem. 

I also have a btrfs partition on the laptop's internal drive but this does not cause a crash during suspend.

The crash is especially annoying because it can cause my ext4 home drive to lose settings...

Note: the attached log says WARNING instead of BUG because I built a kernel with the BUG_ONs changed to WARNINGs in fs/btrfs/transaction.c in order to get the crash recorded in the syslog without having to set up a serial console to catch the error.
Comment 1 rocko 2012-03-19 15:30:52 UTC
An update: I had in /etc/config.d/suspend:


so during suspend the USB driver was being removed.

Commenting this out stops the bug from happening, so the problem appears to be that btrfs does not gracefully handle loss of access to the underlying block device.
Comment 2 rocko 2012-03-21 01:44:38 UTC
Unplugging the external btrfs drive causes a similar crash in btrfs_commit_transaction.
Comment 3 rocko 2012-03-21 01:45:38 UTC
Unplugging the external btrfs drive while the laptop is suspended and then resuming the laptop also crashes it! I guess btrfs isn't quite production-ready yet.
Comment 4 Jan Simon 2012-03-26 22:29:09 UTC
Have this bug in 3.3 final as well. I have a btrfs partition on an external USB-HDD. When i unplug it without unmounting, my machine crashs. I originally filed this bug in the Ubuntu bugtracker with linux 3.2. There you can find several logs as well: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/963107
Comment 5 rocko 2012-04-10 09:28:38 UTC
3.4-rc1 and 2 handle this better. Instead of a crash and complete lockup, I get some warn_slowpath_common messages (eg btrfs_put_block_group / btrfs_free_block_groups / close_ctree ... sys_umount).
Comment 6 rocko 2012-04-18 17:52:14 UTC
It doesn't handle it brilliantly, though. After removing the drive, the CPU cores scale up to their highest frequency and if I plug the drive back in, btrfs fails to recognise it.
Comment 7 Josef Bacik 2013-04-30 16:53:23 UTC
Closing, if this is still affecting you on a newer kernel please reopen.

Note You need to log in before you can comment on or make changes to this bug.