From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A6E01A8F97 for ; Mon, 8 Jun 2026 11:24:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780917900; cv=none; b=kFaGfB1Rv7j4Ccsg3hCDmhIYrDl+Q3eHFi+c9abufD7QelvJPvFPYXIjY8EwJfqOG8LB9yNmo15/t7GivssOsejwOrdBrz153CP/Qtivmy7CAhXipIViQssRRoTMrvIsVTbzj1mccIx5EhsauXJouLQDhA50suYUVhLZpGMjpzo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780917900; c=relaxed/simple; bh=H0j2h/IuHXRAGbZayNOkBH0sXrTKcXJvAH7vKH8W7is=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=fM7sxAQ6Mck0cqugEO4bb2zjtdbstgIA2t9iMT3Lh9KDrkY6IImkZ6Micz4aIjben1hOSGq090iTRMn/bGKlTxwLeaLsUBgDLITNqvWdBom2LA5dlp3xYe2JRsn8ehk6E+lYEUgeWPgT61i18pseucwxhbGBXq6R5nSnmlSd4rw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=ilWtWRuA; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="ilWtWRuA" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 460FF2381; Mon, 8 Jun 2026 04:24:53 -0700 (PDT) Received: from [10.164.19.15] (unknown [10.164.19.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD71C3F86F; Mon, 8 Jun 2026 04:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1780917897; bh=H0j2h/IuHXRAGbZayNOkBH0sXrTKcXJvAH7vKH8W7is=; h=Date:To:From:Subject:From; b=ilWtWRuAoX4VA99FP1OVnP40YBIxS1VZnPKlxQ6i0nM8JzcfNMfRhuXS0sp5M5r02 zdmKWOA9+deFTUtaMYcvtNlx8Ta0rU6auzXLhDRCCDo8Q7fuLahVPgXAqalNT6L23R KLSPDrDCzQxQ7i9DLG3iFzXU3oDAgFitziJFh3w8= Message-ID: <5ca6512c-bdc1-4620-9c99-c7525e059099@arm.com> Date: Mon, 8 Jun 2026 16:54:51 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Matthew Wilcox , Jan Kara , "linux-mm@kvack.org" , David Hildenbrand , Ryan Roberts , LKML From: Dev Jain Subject: [BUG?] invalidate_lock not held in read_cache_folio() Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, My understanding is that there are two ways we are serializing against concurrent addition of a folio into the pagecache (see 730633f0b7f9). The kerneldoc of read_cache_folio() says: "Context: May sleep. Expects mapping->invalidate_lock to be held." I put the following in __filemap_add_folio(): + BUG_ON(!inode_is_locked(mapping->host) && + !rwsem_is_locked(&mapping->invalidate_lock)); And got the following trace: [ 0.088725] kernel BUG at mm/filemap.c:858! [ 0.088727] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP [ 0.111312] Modules linked in: [ 0.111437] CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.1.0-rc5-00493-g65484bf449f7 #178 PREEMPT [ 0.111801] Hardware name: linux,dummy-virt (DT) [ 0.111987] pstate: 61400005 (nZCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) [ 0.112255] pc : __filemap_add_folio+0x5dc/0x680 [ 0.112437] lr : __filemap_add_folio+0x168/0x680 [ 0.112629] sp : ffff80008005b550 [ 0.112757] x29: ffff80008005b5b0 x28: 0000000000100cc0 x27: 00000000ffffffff [ 0.113030] x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000000 [ 0.113312] x23: 0000000000100cc0 x22: ffff0000c2825cc8 x21: 0000000000000000 [ 0.113599] x20: fffffdffc30cd700 x19: 0000000000000000 x18: 00000000ffffffff [ 0.113885] x17: 2e33352820736b63 x16: 6f6c62206c616369 x15: ffff80008005b4d0 [ 0.114167] x14: 0000000000000000 x13: ffff0000c34a225f x12: 0000000000000000 [ 0.114451] x11: 0000000000000000 x10: 000000000000003a x9 : ffffce3993f54940 [ 0.114759] x8 : 0000000000000000 x7 : ffff00017f3fc910 x6 : 05ffff0000000001 [ 0.115040] x5 : ffff0000c150b000 x4 : ffff80008005b610 x3 : 0000000000100cc0 [ 0.115312] x2 : 0000000000000003 x1 : 0000000000000000 x0 : 0000000000000000 [ 0.115587] Call trace: [ 0.115686] __filemap_add_folio+0x5dc/0x680 (P) [ 0.115871] filemap_add_folio+0xec/0x2d0 [ 0.116031] do_read_cache_folio+0x144/0x2d8 [ 0.116194] read_cache_folio+0x1c/0x30 [ 0.116344] read_part_sector+0x4c/0xf0 [ 0.116499] read_lba+0xb0/0x1a0 [ 0.116627] efi_partition+0xa8/0x740 [ 0.116769] bdev_disk_changed+0x238/0x620 [ 0.116939] blkdev_get_whole+0xac/0x100 [ 0.117090] bdev_open+0x280/0x3c0 [ 0.117221] bdev_file_open_by_dev+0xe4/0x158 [ 0.117394] disk_scan_partitions+0x70/0x160 [ 0.117565] add_disk_fwnode+0x1a4/0x1d0 [ 0.117725] device_add_disk+0x1c/0x30 [ 0.117869] virtblk_probe+0x6a0/0x918 [ 0.118025] virtio_dev_probe+0x1c8/0x310 [ 0.118184] really_probe+0xc4/0x2b0 [ 0.118330] __driver_probe_device+0x88/0x170 [ 0.118497] driver_probe_device+0x44/0x178 [ 0.118669] __driver_attach+0x98/0x1b8 [ 0.118819] bus_for_each_dev+0x84/0xf0 [ 0.118979] driver_attach+0x2c/0x40 [ 0.119123] bus_add_driver+0xec/0x218 [ 0.119269] driver_register+0x64/0x138 [ 0.119419] __register_virtio_driver+0x2c/0x50 [ 0.119598] virtio_blk_init+0x74/0xd0 [ 0.119757] do_one_initcall+0x60/0x3f0 [ 0.119903] kernel_init_freeable+0x1f4/0x540 [ 0.120075] kernel_init+0x2c/0x1f8 [ 0.120218] ret_from_fork+0x10/0x20 [ 0.120357] Code: 9401562d d4210000 f9400ec0 b5ffdd20 (d4210000) [ 0.120592] ---[ end trace 0000000000000000 ]---