From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: dsterba@suse.cz, ChenXiaoSong <chenxiaosong2@huawei.com>,
clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, zhangxiaoxu5@huawei.com
Subject: Re: [PATCH] btrfs: qgroup: fix sleep from invalid context bug in update_qgroup_limit_item()
Date: Fri, 11 Nov 2022 12:44:42 +0100 [thread overview]
Message-ID: <20221111114442.GK5824@twin.jikos.cz> (raw)
In-Reply-To: <48ac1a74-6349-ccf5-92ef-2189037122b8@gmx.com>
On Fri, Nov 11, 2022 at 07:31:22AM +0800, Qu Wenruo wrote:
>
>
> On 2022/11/11 04:54, David Sterba wrote:
> > On Thu, Nov 10, 2022 at 10:13:42PM +0800, ChenXiaoSong wrote:
> >> Syzkaller reported BUG as follows:
> >>
> >> BUG: sleeping function called from invalid context at
> >> include/linux/sched/mm.h:274
> >> Call Trace:
> >> <TASK>
> >> dump_stack_lvl+0xcd/0x134
> >> __might_resched.cold+0x222/0x26b
> >> kmem_cache_alloc+0x2e7/0x3c0
> >> update_qgroup_limit_item+0xe1/0x390
> >> btrfs_qgroup_inherit+0x147b/0x1ee0
> >> create_subvol+0x4eb/0x1710
> >> btrfs_mksubvol+0xfe5/0x13f0
> >> __btrfs_ioctl_snap_create+0x2b0/0x430
> >> btrfs_ioctl_snap_create_v2+0x25a/0x520
> >> btrfs_ioctl+0x2a1c/0x5ce0
> >> __x64_sys_ioctl+0x193/0x200
> >> do_syscall_64+0x35/0x80
> >>
> >> Fix this by introducing __update_qgroup_limit_item() helper, allocate
> >> memory outside of the spin lock.
> >>
> >> Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
> >
> > Added to misc-next, thanks.
>
> Please remove it for now, the patch only addressed what MM layer
> reports, it doesn't really solve the root cause, we're doing a tree
> modification (btrfs_search_slot()), under a spinlock.
Removed. As the potential sleeping under spinlock is hard to spot we
should add might_sleep to some places.
next prev parent reply other threads:[~2022-11-11 11:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 14:13 ChenXiaoSong
2022-11-10 14:46 ` David Sterba
2022-11-10 14:59 ` ChenXiaoSong
2022-11-10 15:35 ` David Sterba
2022-11-10 20:54 ` David Sterba
2022-11-10 23:31 ` Qu Wenruo
2022-11-11 11:44 ` David Sterba [this message]
2022-11-10 22:58 ` Qu Wenruo
2022-11-11 1:50 ` ChenXiaoSong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221111114442.GK5824@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=chenxiaosong2@huawei.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
--cc=yi.zhang@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®