From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B647A34D910 for ; Thu, 26 Mar 2026 20:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774555754; cv=none; b=qqAkf6XQw+WzaAkayQdC+rXbBtGmIwvkpqYvzh/kyFBIdRNRybvJqhUCcmDZllPjSDfMtWPI0BmE5wU9EjOGEMhLmn1LGEU9rcy6hZ8DwA1YwJoaEIOG7ZYvAwfMt9iMXPK2+uD+v8F+zBfHv3JXIZXakFkLiur/GiCOGe9TnYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774555754; c=relaxed/simple; bh=O08vcziHn5E/h2BMlzMYY1qPElNvRHUnS23RXL/skmU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ULZC0aYLCOFWOJq8PkKIk4umcniwDc0nCyB6H5ShHdaxnKxEHupAZZrB097G70YLNrictMcw5sRDlB3jcq2g73Ln+A1fXonQ7M8RioDI3MXso9HCXN/ux/JwO3qmhqLTXGutCKOgFYZKyxBbqGSB4AVZ6msrc3PDGNJnPKiqCog= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=Kc48d92s; arc=none smtp.client-ip=209.85.160.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="Kc48d92s" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-509134ab2d2so12286981cf.0 for ; Thu, 26 Mar 2026 13:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1774555752; x=1775160552; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ayPORQNh1ZJY3KlTlGuZGlkLSPgnYGKfyoymf89E6/4=; b=Kc48d92sYkZTDcy3q456P/xVKGZKfA+xGg9I3vp5GdwK1XMkyfImia/fj+MKEzXqbF q2axkF89HT19f8vU7LNkpLQpQb16ugZSjak+YnbD4nIa0+D875N3uDzDseWjAMYqdWah LGybVxUIuwAFJuogmP1Y+kysMd0V/tk61Y2rDYFx5RE4DYKQcjMbCbm1bQe6TAOjkT7o no05AXru9n5PowsiKvzdQ0T7PNkEeJ+u7kUaePuo//Frmxw4Qz5DFxFbDtAqQ6Mp9y64 8w4y8kw3v39M66KRg43KZVntwGWZzYcIvFP9nLUKH/0t4LwwExH2l49oKSjjaG7K5dmG W6dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774555752; x=1775160552; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ayPORQNh1ZJY3KlTlGuZGlkLSPgnYGKfyoymf89E6/4=; b=kMFTdBJ7/XVyExwP1JTOVYFdQ3KCD+KxzawcL8xwpfOmBVwcB41J4lSSXRSARep7Xx S2wGSj4dgcQDeK/8PjXcwuRhFtfP0W8tUdtpHaGfDpNsNRH9ZKgXqrFu+n2nww8SSDWZ +rHCUKe0Dnw/eAGJJlkoV0aY3H9z/WfqQz9kxmEOO6QwaOvkgFHVozLw0G4DBRWYvSQ4 qwfARKvy5Quo8ZP3qfxAZDTb1Bw0Gvd9E2FQ/DPb8qScxCwDTVJEmWb21M3c8WceUCnI ZDQavbKZn4arrs2HQSgf/wwPqQ5b8C5Jwwk4ZTksAF/ba6lgNXsoLe5ELqfa7wuEBwDS cJ+A== X-Forwarded-Encrypted: i=1; AJvYcCWyVfCSLhX813s+GU1T0dv4kiu12P/FpfAVJppIxP3tcsgOVfTJnLH45kNAVqJYE1/K9IghFV0FCKyqTZw=@vger.kernel.org X-Gm-Message-State: AOJu0YztohfJsMIu0DCRqvBHgnTIDrWpHb5IQ1evJpdb6eMAX19WWnhc QrTJ4F72UqIvVf3beOHZqMSFnzFCl8fiNABdvVjVKRAc8B8AqzfBdJooNjY5TKiSehsMnWxfr1M ja9nx X-Gm-Gg: ATEYQzxtUtgtSrPsxmf9lfiPEOVK1Uo2d2QFb8wRNWvCIhHjsvLaQ0fJNQnCJFppXf9 dP87uK70eI8rCFtn7DAlBNAdKzkZ7d+TkOosjtiDC+h0zSzix/s+UbvFH5pKwixAe6JKOB9wn05 9ag/vEGt8XxiwNeTXkreJjC6jNMNd49+mpFDicl/y7rbg4iwsQPO0Vr6suTCY5Oy2gTlMhwU2yL b9TrDjkP1xzZHKsJDWzbMdwdrI/i0vYCpf4GyZybtJ4qRlXI41ry0x4mJMJfle04P5eYUJHm8qT xiDuCUOCVMLyFS+S3imdYBBAj3O9sELPGRXkKzPooTd6X7G/NxjGasLQCvMswG97YvWfJndBMmN a9PrNakLJ870RJTrEJrBm8eTj6/jsHvoi+9zz2KPsWQSwFMZd9X9jS6c7CcBriLz7T4h6lJq1MJ WbsZTxF67ebWL49ptgoRno9lQsMN//2zU= X-Received: by 2002:a05:622a:20c:b0:50b:4778:ac60 with SMTP id d75a77b69052e-50b80cd380fmr124966951cf.10.1774555751762; Thu, 26 Mar 2026 13:09:11 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F ([2620:10d:c091:500::2:e5e8]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-50b9237a40asm31637111cf.21.2026.03.26.13.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 13:09:11 -0700 (PDT) Date: Thu, 26 Mar 2026 15:09:09 -0500 From: Gregory Price To: Matthew Wilcox Cc: linux-mm@kvack.org, akpm@linux-foundation.org, hughd@google.com, david@kernel.org, ljs@kernel.org, Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, baolin.wang@linux.alibaba.com, linux-kernel@vger.kernel.org, kernel-team@meta.com, stable@vger.kernel.org Subject: Re: [PATCH] mm/shmem: use invalidate_lock to fix hole-punch race Message-ID: References: <20260326162611.693539-1-gourry@gourry.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Mar 26, 2026 at 07:21:21PM +0000, Matthew Wilcox wrote: > On Thu, Mar 26, 2026 at 11:26:11AM -0500, Gregory Price wrote: > > This also requires removing the rcu_read_lock() from > > do_fault_around() so that .map_pages may use sleeping locks. > > NACK. > > ->map_pages() is called when VM asks to map easy accessible pages. > Filesystem should find and map pages associated with offsets from "start_pgoff" > till "end_pgoff". ->map_pages() is called with the RCU lock held and must > not block. If it's not possible to reach a page without blocking, > filesystem should skip it. Filesystem should use set_pte_range() to setup > page table entry. Pointer to entry associated with the page is passed in > "pte" field in vm_fault structure. Pointers to entries for other offsets > should be calculated relative to "pte". > Hm, I follow. I was originally thinking this was scoping issue given we take the rcu_read_lock shortly after the call anyway, but I see. If the invalidate lock ends up being needed then i could leave rcu and just use trylock/fallback to fault. But I need to test a few things, nothing else protects filemap_map_pages with the invalidate lock at the moment but only shmem appears broken. ~Gregory