Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6962170rdb; Fri, 15 Dec 2023 13:16:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGl79PEtZBwMu/Shki36bZtiqHmzc3UtMJ9Qy91jrh3YnIRF1RgzCoq4uxu4XyGIR8C3+Zq X-Received: by 2002:a05:6a00:23ca:b0:6ce:724a:3e78 with SMTP id g10-20020a056a0023ca00b006ce724a3e78mr12317289pfc.43.1702674999060; Fri, 15 Dec 2023 13:16:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702674999; cv=none; d=google.com; s=arc-20160816; b=jfh9t4XvDPrErwbkLOqtl2+RB74TmoaYLFIpyKDa3IXjwbpw6VOnfdYlktt6eCOF+Z jSOj4/c7pqE7HVKW6u01bVSsIk6Iw0HZHwt+b3FEwsPyll6K5t1ytUlW/WWNpr74BNv7 r8n5TWwm7tfAqcrzcmmrhpAiWJAnFcOPnM4QVulPFhIxZ89N1NPYiUpJlVAMoLkiZMJs UPYkfOAssSEofcymMV2X8n/dHcLtuAzWR6I9sC53rdIeIzSaVJmIglFZqGyIECK68p0X 2oH3OPlzl2Ag1HNnRSMTEWQCqo9Fgmq6w0Z7YHRvSHMSV9oKCLCTGGR6fQw2ZQ16psfS gNBA== ARC-Message-Signature: i=1; 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 :date:subject:cc:to:from:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=A9VmviNzu9Vwca8703AouDgcma1pNK0L4pW+RXROQG0=; fh=UEin7YZ4eM5mX713C41+LGZX7Kx6awDGobYQnpIpl5Y=; b=i2UZ7/RpWEDOZXXAK420pp+0e6h72NNdabEWutQeWQR1UFgZj/vyrC3YXwfR0awDPb cUZsWrI1FOM4RbtxznpfxkK2Sq9IVesK4zP/j+sDSJ0q6JRj0xvvexGFEFC+InaJ5ZZ4 kH4NV1ufM9RULSlagbWSXH9RAM9My8tU4Hgc+Ci1webw8ghqQQbFp6pYt36UAwvo6jNQ wwmggHMq9LgMHqM+SLMkVTpdqaRHu7nH5UM1teJ9NR1NsjPnIAsByAPxQ5ZlIqgZOlDO 3pZmS740ZLIdyPY5/fOdP6YlvHWG206pzz5T06ScFv2QF/w9zLZ2SWJFHzAP3/O+rb4B xs+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zIumY2wh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=2Z9wPl88; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="Bv/qH1+v"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=kgrYjC8D; spf=pass (google.com: domain of linux-ext4+bounces-463-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t42-20020a056a0013aa00b006ce6ad886c8si13852342pfg.177.2023.12.15.13.16.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 13:16:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-463-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zIumY2wh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=2Z9wPl88; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="Bv/qH1+v"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=kgrYjC8D; spf=pass (google.com: domain of linux-ext4+bounces-463-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CB3BB286E10 for ; Fri, 15 Dec 2023 21:16:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 251A4482E1; Fri, 15 Dec 2023 21:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="zIumY2wh"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2Z9wPl88"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Bv/qH1+v"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="kgrYjC8D" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 5067047F6E; Fri, 15 Dec 2023 21:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 55E741F85D; Fri, 15 Dec 2023 21:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702674978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9VmviNzu9Vwca8703AouDgcma1pNK0L4pW+RXROQG0=; b=zIumY2whvLC6NLAFrargTu5XWfdZTzqw81XE8601BGRFfVZYiXdlJAuCQ0xJc2nKNDg/T8 WlbjEA41/HoOHj/leNo2OM6+PP/QdqCO8Zy+iHq+VpxQLQHO+UeUWzhxUun0n7ug6K1uzq +P6Aq90cCGVVZc5h1q4TScK2q3CpgtY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702674978; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9VmviNzu9Vwca8703AouDgcma1pNK0L4pW+RXROQG0=; b=2Z9wPl88QZXzb6XI7wyyPsxoolquOOQIl6Vt7s1RVT82tCb3OS7a/KOH6Ec2a+v2Y/8zGO sJRwY7r+Y7d1LdAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702674977; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9VmviNzu9Vwca8703AouDgcma1pNK0L4pW+RXROQG0=; b=Bv/qH1+vDs6zc4QEKLbXRCVoxgYmBOI64TVCCLmPpDZe5Lmc/4h/NGSoyON5dM9V1LEQvy vwWF09ZL8jPxDgwmQOqXUuoyZvPcr3KikbotoB80VFgQ7CUSveH2zp4LZvf0iwMivPkfkl V650/4mWndLt9Exy9U/ECsNMDdxZprs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702674977; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9VmviNzu9Vwca8703AouDgcma1pNK0L4pW+RXROQG0=; b=kgrYjC8Db6UBAm7X4QX3PEmscVheiAK5KCPO1Ak8YXxr8PFaouyFAqrqD3VW1Qwen0xsOI WKlf9wcCyHNiikCg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 14752137D4; Fri, 15 Dec 2023 21:16:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id szpkOSDCfGWFOQAAD6G6ig (envelope-from ); Fri, 15 Dec 2023 21:16:16 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, ebiggers@kernel.org, jaegeuk@kernel.org, tytso@mit.edu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi Subject: [PATCH v2 1/8] dcache: Add helper to disable d_revalidate for a specific dentry Date: Fri, 15 Dec 2023 16:16:01 -0500 Message-ID: <20231215211608.6449-2-krisman@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231215211608.6449-1-krisman@suse.de> References: <20231215211608.6449-1-krisman@suse.de> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: *** X-Spam-Score: 3.70 X-Spamd-Result: default: False [3.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[8]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[linux.org.uk:email,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO Case-insensitive wants d_compare/d_hash for every dentry in the filesystem, while fscrypt needs d_revalidate only for DCACHE_NOKEY_NAME. This means we currently can't use sb->s_d_op to set case-insensitive hooks in fscrypt+case-insensitive filesystems without paying the cost to call d_revalidate for every dentry in the filesystem. In preparation to doing exactly that, add a way to disable d_revalidate later. Suggested-by: Al Viro Signed-off-by: Gabriel Krisman Bertazi --- fs/dcache.c | 10 ++++++++++ include/linux/dcache.h | 1 + 2 files changed, 11 insertions(+) diff --git a/fs/dcache.c b/fs/dcache.c index c82ae731df9a..1f5464cd3bd1 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1911,6 +1911,16 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name) } EXPORT_SYMBOL(d_alloc_name); +void d_set_always_valid(struct dentry *dentry) +{ + if (!(dentry->d_flags & DCACHE_OP_REVALIDATE)) + return; + + spin_lock(&dentry->d_lock); + dentry->d_flags &= ~DCACHE_OP_REVALIDATE; + spin_unlock(&dentry->d_lock); +} + void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) { WARN_ON_ONCE(dentry->d_op); diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 3da2f0545d5d..d2ce151b2d8e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -225,6 +225,7 @@ extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *); extern void __d_drop(struct dentry *dentry); extern void d_drop(struct dentry *dentry); extern void d_delete(struct dentry *); +extern void d_set_always_valid(struct dentry *dentry); extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op); /* allocate/de-allocate */ -- 2.43.0