Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1633868lqs; Sat, 15 Jun 2024 19:40:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8jf+1aBUaYIubQRHfOI21lXpWrNBVPa0VvkcUZS7vxTsTapPA40hTh65gT6wS8q4nzpV6VE2I2mdEiCMkOlzaRyA4TTQthlIw4O0J6Q== X-Google-Smtp-Source: AGHT+IE7ahPxX1UUVfK6ty8JCCvPSaZws8wafG0rqJTxGcDiE7C77YjfeWul8lI+ll7ZhZMa6aIM X-Received: by 2002:a17:906:b88d:b0:a6f:4392:9ace with SMTP id a640c23a62f3a-a6f608394a1mr399709666b.18.1718505630623; Sat, 15 Jun 2024 19:40:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718505630; cv=pass; d=google.com; s=arc-20160816; b=IWqWnClXxlRq+G/CICuCx2N0GgH2gQH/al8m6lHfHIZi517k6It0YZvtNsWi9Mjkr/ AgBXJOypWmyKuO9D+7LXXUF1jlE8O9gAn9MLx76xY73PjovzE74ZjkZoUT9XChhq6W6s NRN4NEKerfI5vmnNMvhLapL83SSACYKRW/Awr1aaNZ8TfefocpknL1rGO/AiILz59IeU 38lqB3LH+tcZ2YBfX/MiVxBkDh5VuLJybtK4Dx17q9l441s3WAS7C+Uwd/yo030y4ZTa PF2EetO5nc8go46TZuTLwh8EkiCLIRgibQOKH4cfRlXshakEoOOsTJu7UAtGwgRyKARu 2KrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=j1AdtiIcHZTR6u7TiAugDJh0MLfCRYph4GCrQzaketE=; fh=9Lh5nkbPW0KVw7qrdbIjx6fILbdMTrYa1nKuB5Ok2B8=; b=OpHl2L5Z87t+7gKbhb+FnOQCS0NsmHBrovTQIHqv0IY8qCL7oGUW0WRioIHmaGCI82 0+N4Kk8zy2xEWAnYFJbQ6g/xzRvXhZ3QfYLir6s5ahlgcOV+g6vvwVp/E6rtZhCPyls3 2HL12+uzWEr+uAHJlu3FURt35+s3jmCzaPxKw5JpmAglo4QpaabAaS6bv/F12kAIpU0B w//qtPLVvub11lbaUagfxIbchx0CWmf42eOKYtAtqrZa9EwCw8HiqEgtab7Rt5axeFQM gf7cUBBXm7iJzazyRv1UW38C9BtM341bgvb0YdGjkjByfVEyQ5mNs1KKbtI3QEYd6/ow lYnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-216096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216096-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56d213fbsi323283766b.36.2024.06.15.19.40.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 19:40:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-216096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-216096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216096-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 592451F22D8B for ; Sun, 16 Jun 2024 02:40:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9520416C6BA; Sun, 16 Jun 2024 02:40:19 +0000 (UTC) Received: from smtp134-31.sina.com.cn (smtp134-31.sina.com.cn [180.149.134.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0403F16C68C for ; Sun, 16 Jun 2024 02:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=180.149.134.31 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718505619; cv=none; b=cUkLZNzR9ZzW64/Uu3bbh+doWLL9mmIudqRJKI+CwMeE+XhPgyxDJyoq5wjy4fZoyLtyqtvzQ06mGEknUHrDyWNcrC9FgvK/Gn4yUWPR6yACn+fliEYnh9eBo6D4LscCXeomphUEMlL3duNCb/AOodMTZAnuyOR9/L2T9vTG3Ss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718505619; c=relaxed/simple; bh=dETxmxxhwV6tBINnXqbtRGHmH6/LENJrYEaHiHk7z/g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qYu8kWeR4BmtkQ2TyUCuQXH8l7Xbb+AzKdgCjYN0g8GZZAC7CGXUEuLWwRtT+TZlVmczgEsMxuyzFxwGU/fLbLniz9Yt8+W443UEwrgZyQXN0f8JkaNISSu7QgRkNj4QAxk13NCNFvxp/VQDfACxGwOBoc9nUdWFbYmjyETFM9M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=180.149.134.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([116.24.9.2]) by sina.com (10.185.250.21) with ESMTP id 666E507E00004EF8; Sun, 16 Jun 2024 10:40:00 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 7761573408381 X-SMAIL-UIID: D0200C16404743458945B9D848C2A235-20240616-104000-1 From: Hillf Danton To: Matthew Wilcox Cc: linux-mm@kvack.org, Jan Kara , linux-kernel@vger.kernel.org, syzbot+d79afb004be235636ee8@syzkaller.appspotmail.com, linux-fsdevel@vger.kernel.org, linux-nilfs@vger.kernel.org, Ryusuke Konishi Subject: Re: [RFC PATCH] mm: truncate: flush lru cache for evicted inode Date: Sun, 16 Jun 2024 10:39:51 +0800 Message-Id: <20240616023951.1250-1-hdanton@sina.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Sat, 15 Jun 2024 21:44:54 +0100 Matthew Wilcox wrote: > > I suspect this would trigger: > > +++ b/fs/inode.c > @@ -282,6 +282,7 @@ static struct inode *alloc_inode(struct super_block *sb) > void __destroy_inode(struct inode *inode) > { > BUG_ON(inode_has_buffers(inode)); > + BUG_ON(inode->i_data.nrpages); > inode_detach_wb(inode); > security_inode_free(inode); > fsnotify_inode_delete(inode); > Yes, it was triggered [1] [1] https://lore.kernel.org/lkml/00000000000084b401061af6ab80@google.com/ and given trigger after nrpages is checked in clear_inode(), iput(inode) evict(inode) truncate_inode_pages_final(&inode->i_data); clear_inode(inode); destroy_inode(inode); why is folio added to exiting mapping? #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 83a7eefedc9b --- x/mm/filemap.c +++ y/mm/filemap.c @@ -870,6 +870,7 @@ noinline int __filemap_add_folio(struct folio_ref_add(folio, nr); folio->mapping = mapping; folio->index = xas.xa_index; + BUG_ON(mapping_exiting(mapping)); for (;;) { int order = -1, split_order = 0; --