On Fri, Jun 26, 2020 at 07:09:41PM +0800, Qu Wenruo wrote:
> > [ 26.508136] BTRFS: selftest: running qgroup tests
> > [ 26.509820] BTRFS: selftest: running qgroup add/remove tests
> > [ 26.511566] BUG: sleeping function called from invalid context at mm/slab.h:567
> > [ 26.514058] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 117, name: modprobe
> > [ 26.516671] 2 locks held by modprobe/117:
> > [ 26.517980] #0: ffff968162761a08 (&fs_info->qgroup_ioctl_lock){+.+.}-{3:3}, at: btrfs_create_qgroup+0x29/0xf0 [btrfs]
> > [ 26.521114] #1: ffff968162761960 (&fs_info->qgroup_lock){+.+.}-{2:2}, at: btrfs_create_qgroup+0x75/0xf0 [btrfs]
> > [ 26.524120] CPU: 1 PID: 117 Comm: modprobe Not tainted 5.8.0-rc2-default+ #1154
> > [ 26.526439] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba527-rebuilt.opensuse.org 04/01/2014
> > [ 26.529612] Call Trace:
> > [ 26.530731] dump_stack+0x78/0xa0
> > [ 26.531983] ___might_sleep.cold+0xa6/0xf9
> > [ 26.533290] ? kobject_set_name_vargs+0x1e/0x90
> > [ 26.534674] __kmalloc_track_caller+0x143/0x340
> > [ 26.536122] kvasprintf+0x64/0xc0
>
> But according to the call trace, it's indeed allocating the memory.
>
> And my test machine has lockdep enabled, not sure why this is not working.
CONFIG_DEBUG_ATOMIC_SLEEP