Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1144865rdb; Tue, 30 Jan 2024 09:06:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoejsjh9Zwq8yEyTkbbogAkWOHU7/2VOKyXmXQWJXbXpIc0LD+aFcDFhzDW3c5SlGTViWE X-Received: by 2002:a05:620a:2e5:b0:783:28f6:8170 with SMTP id a5-20020a05620a02e500b0078328f68170mr82831qko.27.1706634399961; Tue, 30 Jan 2024 09:06:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706634399; cv=pass; d=google.com; s=arc-20160816; b=pOdVLqY8yjhV/lceKIk9CcQ4yAi2urmNJ+3bk7BOVSaY/8/x9RGSPJTVKNMP8kI25w squUuOIyWd2Txp6t9Yrxx0yHIf2YD11faig2baVnQGx9wSih8p0JdgScorxkfoNv/l2d sU+udvK6xLfoTO+2hmZpDM7FkIhmW+OAyLy0QknUVnuhyLhQOI9AugfBGXQrjF1mvZvL Qfti84b9WqMt0QG9GVpSKCEWiHsB1FnZnmXFO+WpoLiUL42d4m5WzMgt9XTQSzPhoQv5 R5h+Fpcu7B+PXB5Xq+MjbUPzEQ8S0f6WJpjm98xCqlrcP+MUYsw3IfiFPztPYsfbFhg6 9h1g== 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 :subject:cc:to:from:date; bh=p0hsyebAsRQK7EK73N6qOnUb2Xe/Q/9AgxsBREY8PjY=; fh=v9fVoqng7NuDWV3UJtH8WSO7MU+gnXJamvjYkaV9T+M=; b=QcmnwgxZXEaEVyniylWqAFA9Hy87Q6BQv4dLq7RrJHtDAsuAwSfDeo/amjYwJkXOIq ko8Pn1gHvPQUX8Gs8XwhIPqqaL7xrWbjnYXnAlKfw6Af5jy1U+C5JwcHVtU17Wj87acA S8fCeg31Fwp1oRVToSd0BciOOBNzUGpbrjLr1si/nzUbMHZjc96Zg7xaTu4WLvMFNhq0 j4zaib8qxuEgSe0qwS/kvcK/BLQmYwDXlAHPZCHv/+eVBC41mHJ0K7iy+Zkzz8kbuzCE c+NNdjvwjjj7Dkm5qDrvSikfK6+jzoykyoVLkMwd+AUdTlxy/NW0oZd9OThv9R2ZjPWh EQBw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-45013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45013-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o8-20020a05620a228800b00783448147c8si6225936qkh.292.2024.01.30.09.06.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 09:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-45013-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45013-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B61491C23DFA for ; Tue, 30 Jan 2024 17:06:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C92BF129A87; Tue, 30 Jan 2024 17:06:24 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4A95382D8C; Tue, 30 Jan 2024 17:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706634384; cv=none; b=GbkUxyb/fprkmLjo4LbTnB8nP9EPvzUndoReeTiYPHjUOgyvkG2JO7Bge49Rh8RS6SKiMq29HWVgEGalZsNEuLxoPRgkKPWpjUI6r4pQba1C4Mxhj4EEZ8nM54oRzGtceozu/Et7F37879oGlROtUQ+ZhimDHUdEO0nmdziCauQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706634384; c=relaxed/simple; bh=vVyCpFktMjWYkykzwu/C1HFeuytaQchuFkffsMGX0yQ=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OY8uhQge305ujGY2OVGAc7JOVCzkS48dsPtbioQolGv5IjBQImFz8oljcmNDwtLen/1oh7g0CDgTzT1Nce/XFnMHi2y4SeAOcRAz0KAdzHDCf9sSALd8GA9Xw55g8Y3HID5vq/VKQikC+e5eaG5hg/zAUzSPpfsruhlUUzYCFdU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CF86C433F1; Tue, 30 Jan 2024 17:06:22 +0000 (UTC) Date: Tue, 30 Jan 2024 12:06:34 -0500 From: Steven Rostedt To: Linus Torvalds 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 Subject: Re: [linus:master] [eventfs] 852e46e239: BUG:unable_to_handle_page_fault_for_address Message-ID: <20240130120634.2f0ecd0a@gandalf.local.home> In-Reply-To: References: <202401291043.e62e89dc-oliver.sang@intel.com> <20240129152600.7587d1aa@gandalf.local.home> <20240129172200.1725f01b@gandalf.local.home> <20240129174950.5a17a86c@gandalf.local.home> <20240129193549.265f32c8@gandalf.local.home> <20240130093942.56206ff1@gandalf.local.home> <20240130114947.5bc856b0@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Tue, 30 Jan 2024 08:55:51 -0800 Linus Torvalds wrote: > On Tue, 30 Jan 2024 at 08:49, Steven Rostedt wrote: > > > > - On removal, I got rid of the SRCU callback and the work queue. > > Instead, I find the dentry of the current eventfs_inode that is being > > deleted by walking the ei->parent until I find the events inode that has > > a dentry. I then use that to do a lookup walking back down to the > > eventfs_inode I want to delete. This gives me the dentry that I can call > > d_invalidate() on. > > Yes, that works. > > However, I have a patch that is *much* smaller and simpler, and > doesn't need that walk. > > The VFS layer already has a good interface for "should I still use > this dentry", which is needed for various network filesystems etc that > want to time out caches (or check explicitly whether the file still > exists etc): it's the dentry d_revalidate() check. > > Let me just reboot into it to test that I got all the cases. > > It makes the code even more obvious, and avoids all the complexity. I actually had this before, but it wasn't working (likely to something else that wasn't working or I did it wrong) so I reverted it. -- Steve diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 49d4630d5d70..9867b39ae24c 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -451,6 +451,13 @@ lookup_file_dentry(struct dentry *dentry, return dentry; } +int eventfs_revalidate(struct dentry *dentry, unsigned int flags) +{ + struct eventfs_inode *ei = dentry->d_fsdata; + + return ei && !ei->is_freed; +} + /** * eventfs_root_lookup - lookup routine to create file/dir * @dir: in which a lookup is being done diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index e1b172c0e091..0395459d919e 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -392,8 +392,24 @@ static void tracefs_dentry_iput(struct dentry *dentry, struct inode *inode) iput(inode); } +static int tracefs_revalidate(struct dentry *dentry, unsigned int flags) +{ + struct inode *inode = dentry->d_inode; + struct tracefs_inode *ti; + + if (!dentry || !inode) + return 0; + + ti = get_tracefs(inode); + if (!ti || !(ti->flags & TRACEFS_EVENT_INODE)) + return 1; + + return eventfs_revalidate(dentry, flags); +} + static const struct dentry_operations tracefs_dentry_operations = { - .d_iput = tracefs_dentry_iput, + .d_iput = tracefs_dentry_iput, + .d_revalidate = tracefs_revalidate, }; static int trace_fill_super(struct super_block *sb, void *data, int silent) diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h index 2af78fd95c93..a1024202c4e5 100644 --- a/fs/tracefs/internal.h +++ b/fs/tracefs/internal.h @@ -80,5 +80,6 @@ struct dentry *eventfs_start_creating(const char *name, struct dentry *parent); struct dentry *eventfs_failed_creating(struct dentry *dentry); struct dentry *eventfs_end_creating(struct dentry *dentry); void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry); +int eventfs_revalidate(struct dentry *dentry, unsigned int flags); #endif /* _TRACEFS_INTERNAL_H */