From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 AE6D134887E for ; Thu, 26 Mar 2026 19:48:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774554532; cv=none; b=GB6ld1PdRrQ7Yxrfa3N5dBgqLWqmq0+NnG/pVZs+F02lxLz6VSF5XgHxMyGNZBoAOHU6YUNBCMPJyATWXIPzPNhxsdmbGegpjevZ3lEXt+YenHr4addleJ+O3HkQHFtsNlbzJes9XbDg6O72iA4HzDoZjhtjKe8bIX6I9uoEo2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774554532; c=relaxed/simple; bh=wyI53cHLh4BIgCM0ffLwIHRJXy0SO5cJeVuYYiW1xi4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EOhLNcJov4GuXmhZe/U8r5QXM8kji77+xyMwFVypydAl41+NbLxdqOaffhuZdRqbBM7u5SlTGqhI5BJOLjrdMzrLcFsK0wSpHkBHUCXxu1Rpptm6eODa+4twYTGnmDuUeOCPWHKo0yYQABICuDorFyYFa5zIfsuRpE83z6himFY= 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=lB1140pd; arc=none smtp.client-ip=209.85.222.177 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="lB1140pd" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-8cfbbf35354so189165685a.0 for ; Thu, 26 Mar 2026 12:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1774554529; x=1775159329; 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=0Y8SN5o1ZkvY84l2Y0g1HhDr11A0odVfZb13rFexrew=; b=lB1140pd9C7fcVB6f8UW1kmkie4YkVH5vVzTfkBMF4x6qSZL06WeD3xVeoD4brSiP4 enVx0pk90r0h5reiiEu3jlt2q2ATMPre5jUEvB58hsDilQCsm6SuYz9aX1V8uRF1msxV 2zR/yjDQVwnD2JFvM1T6megsC3IXxY3eCufUTlespF1CR2kedV+kjME/hHA+oG3GDl7M NMXcGXyrpj0MEbFKTxmlHxYgFgXsfW/pqEH9ds4QH1HxmpIVhtPrbNNaPP9KWoGSnkRM c4r5ByDYmCaFpUKw/x8THFQH9scAgx+rN/FAjlLHwxKUnie62ZLjgxSteJhlnh2sAiII PBNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774554529; x=1775159329; 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=0Y8SN5o1ZkvY84l2Y0g1HhDr11A0odVfZb13rFexrew=; b=MWwMFBS4/ui+UKuHVP4WgRUlfLlnP2/t/Q02RWIbq6vZrQvnAuDhkjBIwdJE2OMxUf Y3A5rVxGN66RjBaimCs6SpB/pNQQWklRCqGkJMKgZGI1398U6AMb4+fk94nIgXRQSF/m s1RsIl/1//EbJx7a2n5/G2B/ZuzhZ//HIwpfCRcUE+rpDOOrQqslS+m1WRjvYhmGYxMV ILfoI4erYNYyg1RSeAF+M++DmNzHv2w5WHHz3YdU14y8CfT26kVadM1L6YkIEtnRESHy DqzOK/H1bteD2DwGRO/DUPwue8WeELcRt3uR5TkS5+665sbMM7s21jXGKUtSdOB7k6Vc GcNw== X-Forwarded-Encrypted: i=1; AJvYcCX7+2Tcci7Zm886gGxyPj5Nl2LHm2WidceDMNjnfWZp/q02lYma2LsmK+OMA7J01ep17DBwsa3gdZVdIqQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwK6u5c8M/2P+ZKixn1o0wdukzYiJPEsQuSr12qea5kyQD6BtkA xXk6UKOF2D3m3LV5UcpTIosEwQp4W0/Sc/Emq3+04eCEMhhHRIEAx99EKIr0O27ozVk= X-Gm-Gg: ATEYQzzKXJA0VPX3XjZ5uCZSYXLMYR8Tb52EweEHA3/dQ2b4wQRs5cP0I+9YJVGkfXo QYAYZAjxaYJsaa/xNeKnsSkapSIQikawGmP4L8K29m7MuKVw9fohSSzmveJcCMvZ/Qwkvwpc9W6 4ncc12HdBVVAyGHbuT+9zQMHawsvvoRsxzvcflkewT7PyNGPf3b8rPE1LnXnEzDNhBHpWTy5z7i R9zm7JCkZKi+Gbgk0Unw6SzflRapkZ4I1ljfwo4wiNZM2PZDjiSQ17jXKMS9iSng0+gWfEXqAYg nUzMhB2iw7Da3ywbgnM3hNIZbRVQsU1u8ZA8fndpVtT2g6XYlexDL+p3OOzWK5Yo0btfnWnh9Ma hDpeC/O0vfE7uWzS7Xu49niCaEDOA5eU5HFjNZgq/sY/sptVD7v5rOkn44W+62y3AS6pn71VBnp XVpk6w3w1lww9PJb3y7LJL X-Received: by 2002:a05:620a:46a5:b0:8b6:1877:3689 with SMTP id af79cd13be357-8d00101300amr1194245185a.35.1774554529547; Thu, 26 Mar 2026 12:48:49 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F ([2620:10d:c091:500::2:e5e8]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8d00e39fbb0sm305859085a.8.2026.03.26.12.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 12:48:49 -0700 (PDT) Date: Thu, 26 Mar 2026 14:48:47 -0500 From: Gregory Price To: Pedro Falcato 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:16:05PM +0000, Pedro Falcato wrote: > > Sure, but can child - parent happen when traversing the i_mmap tree? I don't > think so? (in mm/mmap.c) > /* insert tmp into the share list, just after mpnt */ > vma_interval_tree_insert_after(tmp, mpnt, > &mapping->i_mmap); > > The function itself is somewhat straightforward - find the leftmost node at the > right of 'prev' (our parent) and link ourselves. So an in-order traversal should > always go parent - child. Unless there's some awful tree rotation that can > happen and screw us in the meanwhile. > hm, i think you're right, i have this inverted. But this patch objectively fixed my issue, I no longer see this BUG(), I don't get softlocks, and I don't get the guest corruption I was seeing previously. It could simply be that the contention added makes the race less likely. Let me dig into this and just smoke test your suggestion - but I think your patch would cause some contention issues on unmaps. It's been difficult to generate a reproducer for this without running hundreds of VMs, whatever race is going on here is extremely narrow. > > If this is broken, then every filesystem out there using filemap_fault() and > filemap_fault_around() has to be broken, and I hope that's not true :p > Me too, but i never rule anything out. ~Gregory