Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3577954ybg; Mon, 28 Oct 2019 15:16:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqypWtp+/PAJL6w7P2fIWvw9QVfF1lGG1h4liqELTDom7/4fhg9LQpGn7O/oSsjiQDeISFYW X-Received: by 2002:a17:906:24d3:: with SMTP id f19mr121012ejb.267.1572301007547; Mon, 28 Oct 2019 15:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572301007; cv=none; d=google.com; s=arc-20160816; b=lcdrZHruhBg59wgePv5C8zdhuTSPkOsSmZJoBR6Uw3uF9+qGIVFi38gWVF/bwDQcaL zas0xW8yGVoSRpxRewqOk9/uSmxWlb8pLdmEB7e4QajlPeF2+4yG6sHs+LuyFmhmVZfV WCa0ormuL/F1bt73WpLMnloqcAslmP/w8KX9gho8m2GPcrHeYKgcvqAo7Npzj4cK0mbv 1p32GBA3m6zKcq0h5fuWYbhD0oXW6t4fp29T8uUaon3tvzBkF6HEy+wR0ApsPY/yV12O 8ear1GDGlNl3TzCNybT8oa1CgktIROQyyb6QBx/BoWPjq+8QDYhqS41MgIb/LysYHYNL ix0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=m+3REzNPMTuz62QCN86CmNo1QH4WSYWkJwr0CVYc9KU=; b=zl/5U2GAsRa3KLZgOiRKR3KoEWjYytoGpPQdqp2UX6xeu1ouoXRbRIVo5pnycQtyM1 jU0qJUk3HS6MO63YVqUF+wBUFIVpIe6CZXYqZ8C1+afVTEU1ezkqMcwcEjYNtc4w/3Ru mIFJimarnyzruB8uvVzAx9TP27Ls8E1x+jiRixQiGH9vT1r980xpTcde0j1SaNr12Zxj k59Qfx9Aywf0xpYC+g9mKoDKVfOCh6uwv5N0BxeXlK5G7JHRJj9UI7HPeFcyuV8YnE8a 9uxgatehltCvvjIqxwRdN/YLJrEBTvi7V0IZyJX7qXcwJRU0Jz1gnpH8JmF8Vqb7q91P aUdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=QC9FLSQp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h37si8143175eda.249.2019.10.28.15.16.24; Mon, 28 Oct 2019 15:16:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=QC9FLSQp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732561AbfJ1UOt (ORCPT + 99 others); Mon, 28 Oct 2019 16:14:49 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:44014 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbfJ1UOs (ORCPT ); Mon, 28 Oct 2019 16:14:48 -0400 Received: by mail-qk1-f194.google.com with SMTP id a194so9764755qkg.10 for ; Mon, 28 Oct 2019 13:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=m+3REzNPMTuz62QCN86CmNo1QH4WSYWkJwr0CVYc9KU=; b=QC9FLSQpSmjnit0aWLTBLyriTlwzTSs833/NOWlpj0Yh90urVfTFBw2I5U9/bbSEGq YSd4L1+WP7lVgYoBnKgdL7u5D9i7j2pAPWxoj6engcu/LoLwQqRYwzS1CgJ5qDvcANfI kNrujX/BYGHPW8N1jPLKePmwAI7bkwtRkUQP1+qAoXjtqA00suPteypfCVmQHoF3wwfH ZsWFBsGl6/bHPFvX/Jvupj8345ZN/K1pslFMhEwF5HZ4Z4Y809s4/KVAaHdyom+MIyIi fBd3Cpj0rL/SAOZOuZuBUv9bdganXvFWNp1r11zgHEUSh+V177IzA5mzxHOzwE/oBDC2 qIQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=m+3REzNPMTuz62QCN86CmNo1QH4WSYWkJwr0CVYc9KU=; b=rvgBfCQY67XM+xiCjEd393/eh9nUcDzq8eo5j3mKwRb+TdmgDpdrz7FwntNRBWL+/B g7/OGKPM5ES2rglP39oPQB+tEU8YFIliGL/W68cALTV8ouCnnhMzeEqbiHYpZpd2NIvh Z4wjjjwQPfU11Z3ONk3HuQvn7enh8Y3h0tWftiEDVkaqZnXc97Q8EhB/3FH9AiCLqovt hSdQkHQc8hzqzRaxJ7EqxFrxvzjz1D/7TwiI0hKDontovkL9p4ClxiJUNwRbXTJ8XGaE YvyWlHPe2A8LYvku8FrBD4gpxeqOg5pZ1X1fhoiSQKTImYSQxNSwt20+cIy6ljMIlz+R JCqQ== X-Gm-Message-State: APjAAAWJld2QP7xMv/lS05g9un47xVwmc58AD6bLCm3zr6/YFT7QJFao 95Kd2vym4DTV9/rxsMsXoj+rKQ== X-Received: by 2002:ae9:f407:: with SMTP id y7mr17771371qkl.154.1572293686217; Mon, 28 Oct 2019 13:14:46 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::2:831b]) by smtp.gmail.com with ESMTPSA id y186sm6720503qkd.71.2019.10.28.13.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 13:14:45 -0700 (PDT) Date: Mon, 28 Oct 2019 16:14:44 -0400 From: Johannes Weiner To: syzbot Cc: akpm@linux-foundation.org, amir73il@gmail.com, darrick.wong@oracle.com, hughd@google.com, jack@suse.cz, jglisse@redhat.com, josef@toxicpanda.com, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, sfr@canb.auug.org.au, songliubraving@fb.com, syzkaller-bugs@googlegroups.com, william.kucharski@oracle.com, willy@infradead.org Subject: Re: INFO: task hung in mpage_prepare_extent_to_map Message-ID: <20191028201444.GA27425@cmpxchg.org> References: <000000000000c50fd70595fdd5b2@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000000000000c50fd70595fdd5b2@google.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 28, 2019 at 12:52:09PM -0700, syzbot wrote: > Hello, > > syzbot found the following crash on: > > HEAD commit: 12d61c69 Add linux-next specific files for 20191024 > git tree: linux-next > console output: https://syzkaller.appspot.com/x/log.txt?x=15a0fa97600000 > kernel config: https://syzkaller.appspot.com/x/.config?x=afb75fd8c9fd5ed8 > dashboard link: https://syzkaller.appspot.com/bug?extid=efb9e48b9fbdc49bb34a > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13a63dc4e00000 > > The bug was bisected to: > > commit 9c61acffe2b8833152041f7b6a02d1d0a17fd378 > Author: Song Liu > Date: Wed Oct 23 00:24:28 2019 +0000 > > mm,thp: recheck each page before collapsing file THP > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13eb6ec0e00000 > final crash: https://syzkaller.appspot.com/x/report.txt?x=101b6ec0e00000 > console output: https://syzkaller.appspot.com/x/log.txt?x=17eb6ec0e00000 > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > Reported-by: syzbot+efb9e48b9fbdc49bb34a@syzkaller.appspotmail.com > Fixes: 9c61acffe2b8 ("mm,thp: recheck each page before collapsing file THP") > > INFO: task khugepaged:1084 blocked for more than 143 seconds. > Not tainted 5.4.0-rc4-next-20191024 #0 > "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. > khugepaged D27568 1084 2 0x80004000 > Call Trace: > context_switch kernel/sched/core.c:3384 [inline] > __schedule+0x94a/0x1e70 kernel/sched/core.c:4069 > schedule+0xd9/0x260 kernel/sched/core.c:4136 > io_schedule+0x1c/0x70 kernel/sched/core.c:5780 > wait_on_page_bit_common mm/filemap.c:1175 [inline] > __lock_page+0x422/0xab0 mm/filemap.c:1383 > lock_page include/linux/pagemap.h:480 [inline] > mpage_prepare_extent_to_map+0xb3f/0xf90 fs/ext4/inode.c:2668 > ext4_writepages+0xb6a/0x2e70 fs/ext4/inode.c:2866 > ? 0xffffffff81000000 > do_writepages+0xfa/0x2a0 mm/page-writeback.c:2344 > __filemap_fdatawrite_range+0x2bc/0x3b0 mm/filemap.c:421 > __filemap_fdatawrite mm/filemap.c:429 [inline] > filemap_flush+0x24/0x30 mm/filemap.c:456 This is a double locking deadlock. The page lock is already held when we call into filemap_flush() here, and does another lock_page() in write_cache_pages(). To fix it, we have to either initiate flushing before acquiring the page lock, or simply skip over dirty pages. Maybe doing vfs_fsync_range() from the madvise(HUGEPAGE) call isn't a bad idea after all? (I had discussed this with Song off-list before.)