Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp874885rdb; Tue, 30 Jan 2024 00:45:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGygUzLoDVDpeKjatp54OxbA+M5NiyaJKxxaSRScdQ0YlaO4/IBH0I3YGgoa3l3xWihBG4l X-Received: by 2002:a17:906:3c4c:b0:a35:6a73:1dd8 with SMTP id i12-20020a1709063c4c00b00a356a731dd8mr5384106ejg.54.1706604351687; Tue, 30 Jan 2024 00:45:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706604351; cv=pass; d=google.com; s=arc-20160816; b=gfagGlmnka+TlEZkTB2hD1QheeiQxrhYjo4EXw9Q16NRntHFQY7C+0QMupOb8dFxR+ HyKCzbXrAnWJKI+/W/U+qaP+++5h1sJJMNzCMwj9b3EZCA459vLhuF5qbyTpzg6vX/KN JjzJly6DIh6g4JDr/p3G9xuhkwmwQJ66vDAFSvbEvBoPaBoEln0gar+UBFHT1Jz+X+CX zqa3EcslFZV8pP7JxUrKC8VQtP7qxpbg6ebpgV0EEvzbcRqdtbtbdaLIGaBKwiGlUAUA xW+Mb7T0mZxu8HAZkwT0R5TzLQB+tQaqB1I4PVpaZQ9L+y6SnC85Q6tuGbSn0tIrNsnX Od/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=IQ+AzAqTf7hVYM2GdeV6bNXU4qpra1WyPgLqP0lu0rA=; fh=Md50wLehZoDD5Sx7nueCG/UN4tfSAivmPz4nrPW3cUY=; b=U+FJtAgGG/KUc1HOee+mvVXytiNC5XtsHlbfHxxCKPamRG6JvSdCFb6BqP6lw6NGzW HlpO29qxc/vii5Mj/bZY7WAX4Ld2wBuCSR+ZIFL+fIRRMJ5okgJq/NMCYiLI/krGBSdS 8hN/5OM5S/GH8IdVu8gsFqGHzZhjio1JIncDDPb8Iv/IrRPJWwBWCxIRhHw0TdeGX4wx lp7n2olwqhOHQIo0cwcL2qcqsEwB+JSVRe6siMzxHl53NQJfnd5JummiCR6I+jY+Pny9 EJ1y3PjdwiizB97IPnYIxsVzApVeIwjpFI9OOcHhRBVeorS9Oubt0i84fyQFO0lW7wyG aD6Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=XIDbMRj4; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-44167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44167-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 cx10-20020a170906c80a00b00a30f3e88390si4234429ejb.623.2024.01.30.00.45.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 00:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44167-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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=XIDbMRj4; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-44167-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44167-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 337931F2D63A for ; Tue, 30 Jan 2024 08:45:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 655B85787F; Tue, 30 Jan 2024 08:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="XIDbMRj4" Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 9B44B60B9A for ; Tue, 30 Jan 2024 08:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706604248; cv=none; b=FeFgkUP5QPoJWYgWghzFSVxyT0u8fKItehwpoRyRIvuKEuB3R3/J/wS3LQqh6cGD0Ijb4j2kneLMvGz0iT4qZcgfMuaMN6STMwH84jZMHyWhZJZTYoN+z3r6lQyWvyjt8Ky7090jffXU1VR05KXD+4OeIV+SqEmOEOul+j9mqlY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706604248; c=relaxed/simple; bh=fh3Oobbo3ozn7qKP0JOFPHWneqBQFpX8St5WanXUNXo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=YzxuB4/b/1LZWBjUAP/Fkvb4qqHVWpycADNf/nyf6fcq//+K1St6XX09Y1KKCn1gYFxRWTsZmz08X2zA3l21URKWFn8UKdSauIlaQVhTE+2wyCqHVIfTolgGtmtGax1UHNPr56rq/fsiqHF2dsZGtQ1QEJfhEmkb0N9qOyLl1zM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=XIDbMRj4; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-51032e62171so3678810e87.3 for ; Tue, 30 Jan 2024 00:44:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1706604244; x=1707209044; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IQ+AzAqTf7hVYM2GdeV6bNXU4qpra1WyPgLqP0lu0rA=; b=XIDbMRj4izd9gl0jo4t8nQXTTaKJExMQaxEcvvdCIdvC6aYg7aL2qaukKV44NYOA90 e17m1Ssm6i2oABh4501vIeExdkthrQK2jg5fse6s9fSRLiyGQ3MBi3rzKDAGBOGNe4on Kuv6uKaXFkn74fPBaq+XFUHgBOfuZzopWUpQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706604244; x=1707209044; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IQ+AzAqTf7hVYM2GdeV6bNXU4qpra1WyPgLqP0lu0rA=; b=TLBikAZpwuRxdxigM9mwYvL2IB1lYzIBmejzQsfAXVDFQ4ieEKfHUCK1hFeV2EfGAT y4cv2cBrpY3Aar8c+p+C6RGQXKM+th/Bu5BG/VLLymKfAIaAwmInUJbJJmYfzzh2O0xq vqBCR8tZUkidGnV6nYsf+lxcqIlBCE+jdWrqgtYmv7hTIpV3uLx1IagDug+OmTnp8y2A BsJB7DIIk7lJy0NyEui0QL836lWxf6P1gctLol1M8hmKBPQSSHzUEAIlFAZQvFXbBq3c xYixiGCnEbLiQg9zOwK1+jm7Y3UJmIH6Ab7X6tKjYZ1iLR9CJ0d3a857fnuN5K/5EEOQ rPaw== X-Gm-Message-State: AOJu0Yza7iEnmc3jwam4PhoyCWfvgtQj77bUcHwgtTgFCMJT3550481n hqhNKace1CIYHeBiq5qI5PQajXidKsglIBs7HxMmWJcC7aTzYrAsg/IryE6u5VCqczV+Z5Hrwol BSJo= X-Received: by 2002:a19:4f05:0:b0:50e:74ea:525c with SMTP id d5-20020a194f05000000b0050e74ea525cmr5753245lfb.3.1706604244219; Tue, 30 Jan 2024 00:44:04 -0800 (PST) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com. [209.85.208.170]) by smtp.gmail.com with ESMTPSA id z11-20020ac25deb000000b0050ecbfa6eeasm1369531lfq.305.2024.01.30.00.44.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jan 2024 00:44:02 -0800 (PST) Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2cf1288097aso49219851fa.0 for ; Tue, 30 Jan 2024 00:44:02 -0800 (PST) X-Received: by 2002:a05:651c:1cc:b0:2d0:4ef8:3472 with SMTP id d12-20020a05651c01cc00b002d04ef83472mr3848048ljn.47.1706604241691; Tue, 30 Jan 2024 00:44:01 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <202401291043.e62e89dc-oliver.sang@intel.com> <20240129120125.605e97af@gandalf.local.home> <20240129152600.7587d1aa@gandalf.local.home> <20240129172200.1725f01b@gandalf.local.home> <20240129174950.5a17a86c@gandalf.local.home> <20240129193549.265f32c8@gandalf.local.home> In-Reply-To: From: Linus Torvalds Date: Tue, 30 Jan 2024 00:43:44 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linus:master] [eventfs] 852e46e239: BUG:unable_to_handle_page_fault_for_address To: Steven Rostedt Cc: kernel test robot , oe-lkp@lists.linux.dev, lkp@intel.com, linux-kernel@vger.kernel.org, Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Christian Brauner , Al Viro , Ajay Kaher , linux-trace-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Mon, 29 Jan 2024 at 19:56, Linus Torvalds wrote: > > But I've been staring at this code for too long, so I'm posting this > just as a "it's broken, but _something_ like this", because I'm taking > a break from looking at this. Bah. I literally woke up and realized what the problem is. We're caching negative dentries, but eventfs_create_dir() has no way to invalidate the old negative dentry when it adds a new entry. The old "try to reuse dentry" ended up hiding that issue, because it would look up the negative dentry from the 'ei' and turn it into a positive one. And I was stupidly staring at the wrong code - all these functions with almost the same names. eventfs_create_events_dir() is fine, because it gets the parent as a dentry, so looking up the new dentry is trivial. But eventfs_create_dir() doesn't get a dentry at all. It gets the parent as a struct eventfs_inode *parent which is no good. So that explains why creating an event after deleting an old one - or after just looking it up before it was created - ends up with the nonsensical "ls" output - it gets listed by readdir() because the entry is there in the eventfs data structures, but then doing a "stat()" on it will just hit the negative dentry. So it won't actually look up the dentry. The simple solution is probably just to not cache negative dentries for eventfs. So instead of doing the "d_add(dentry, NULL);" we should just return "ERR_PTR(ENOENT)". Which is actually what /proc/ lookups do, for the same reason. I'll go back to bed, but I think the fix is something trivial like this: --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -517,9 +517,8 @@ static struct dentry *eventfs_root_lookup( } enoent: - /* Nothing found? */ - d_add(dentry, NULL); - result = NULL; + /* Don't cache negative lookups, just return an error */ + result = ERR_PTR(ENOENT); out: mutex_unlock(&eventfs_mutex); I just wanted to write it down when the likely solution struck me. Linus