From patchwork Mon Jan 29 20:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 13536379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B9BCC47DB3 for ; Mon, 29 Jan 2024 20:43:57 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rUYU1-0001KJ-5m; Mon, 29 Jan 2024 20:43:57 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rUYTx-0001KC-PM for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Jan 2024 20:43:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pedrDAyodui+t1vV5VqCovZAmeHiWI4BdqWsbJ87tRE=; b=cOBUVamt36PYxRXmAXgQld44T6 +3M7oOocOxayUbKtrf6aMN1bm+0CRLWO57TiWaJmpEVpjpN/nvzxw6SuWG0//5GLgJtfeCiP1PSOg S1J5FG6hv5aVDeOutun0HDLQhpXYde7Tum8YSj3H6KK9emi/R86D1wm1BbnZReSd4XAo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pedrDAyodui+t1vV5VqCovZAmeHiWI4BdqWsbJ87tRE=; b=J4PP7rR3JzKBTaP9b0dYuf2kp/ 26mZHCyYX+SMgq7GT+0rBMWt+aFyYktnet77HC4hkfgllIWscHYZQkWj1dyNsrADdVdwTlLmAUXCX x2rGscLuFamLXn/SZ/XSVN5YdmfeZWH7o+glc/DhUNmUPpwwhU1aoPOb/nIbgXcxc1pw=; Received: from smtp-out2.suse.de ([195.135.223.131]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1rUYTw-0000Z0-9l for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Jan 2024 20:43:53 +0000 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 8FAEE1FCF9; Mon, 29 Jan 2024 20:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706561026; 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=pedrDAyodui+t1vV5VqCovZAmeHiWI4BdqWsbJ87tRE=; b=cBk3VPDIdny/Izj4b95HPQkgvM2hc8EgrpLG1HYaEZPMkeMsXaPW8PR4xygt3Hs6AjW9tD jDYvdhnnIjQ/hjTZyCZg0LbLD4jNIEkmm9gVZaYS1Pj/2QMc9UFPnEp8oCVpgWx0+p57iV AbN8OXCH2fW+3/ZkzRfHQw5Eby6V1gA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706561026; 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=pedrDAyodui+t1vV5VqCovZAmeHiWI4BdqWsbJ87tRE=; b=JM/RsWM9wBKpCb9u47kxPXR1wIRBQaG7Bo7/kDggBrdvM8+NnuHgIJHlqTfSqrQwkwVXDh XOKkku/xhdRZGUBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706561026; 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=pedrDAyodui+t1vV5VqCovZAmeHiWI4BdqWsbJ87tRE=; b=cBk3VPDIdny/Izj4b95HPQkgvM2hc8EgrpLG1HYaEZPMkeMsXaPW8PR4xygt3Hs6AjW9tD jDYvdhnnIjQ/hjTZyCZg0LbLD4jNIEkmm9gVZaYS1Pj/2QMc9UFPnEp8oCVpgWx0+p57iV AbN8OXCH2fW+3/ZkzRfHQw5Eby6V1gA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706561026; 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=pedrDAyodui+t1vV5VqCovZAmeHiWI4BdqWsbJ87tRE=; b=JM/RsWM9wBKpCb9u47kxPXR1wIRBQaG7Bo7/kDggBrdvM8+NnuHgIJHlqTfSqrQwkwVXDh XOKkku/xhdRZGUBw== 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 E6E6F12FF7; Mon, 29 Jan 2024 20:43:45 +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 /I+SJgEOuGXNDAAAD6G6ig (envelope-from ); Mon, 29 Jan 2024 20:43:45 +0000 From: Gabriel Krisman Bertazi To: ebiggers@kernel.org, viro@zeniv.linux.org.uk, jaegeuk@kernel.org, tytso@mit.edu Date: Mon, 29 Jan 2024 17:43:21 -0300 Message-ID: <20240129204330.32346-4-krisman@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129204330.32346-1-krisman@suse.de> References: <20240129204330.32346-1-krisman@suse.de> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[9]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[gmail.com,vger.kernel.org,lists.sourceforge.net,suse.de]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Headers-End: 1rUYTw-0000Z0-9l Subject: [f2fs-dev] [PATCH v5 03/12] fscrypt: Call fscrypt_prepare_lookup_dentry on unencrypted dentries X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, amir73il@gmail.com, Gabriel Krisman Bertazi , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net In preparation to dropping DCACHE_OP_REVALIDATE for dentries that don't need it at lookup time, refactor the code to make unencrypted denties also call fscrypt_prepare_dentry. This makes the non-inline __fscrypt_prepare_lookup superfulous, so drop it. Signed-off-by: Gabriel Krisman Bertazi --- fs/crypto/hooks.c | 14 -------------- include/linux/fscrypt.h | 31 +++++++++++++++---------------- 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c index 71463cef08f9..eb870bc162e6 100644 --- a/fs/crypto/hooks.c +++ b/fs/crypto/hooks.c @@ -94,20 +94,6 @@ int __fscrypt_prepare_rename(struct inode *old_dir, struct dentry *old_dentry, } EXPORT_SYMBOL_GPL(__fscrypt_prepare_rename); -int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry, - struct fscrypt_name *fname) -{ - int err = fscrypt_setup_filename(dir, &dentry->d_name, 1, fname); - - if (err && err != -ENOENT) - return err; - - fscrypt_prepare_lookup_dentry(dentry, fname->is_nokey_name); - - return err; -} -EXPORT_SYMBOL_GPL(__fscrypt_prepare_lookup); - /** * fscrypt_prepare_lookup_partial() - prepare lookup without filename setup * @dir: the encrypted directory being searched diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index 68ca8706483a..4aaf847955c0 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -382,8 +382,6 @@ int __fscrypt_prepare_link(struct inode *inode, struct inode *dir, int __fscrypt_prepare_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags); -int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry, - struct fscrypt_name *fname); int fscrypt_prepare_lookup_partial(struct inode *dir, struct dentry *dentry); int __fscrypt_prepare_readdir(struct inode *dir); int __fscrypt_prepare_setattr(struct dentry *dentry, struct iattr *attr); @@ -704,13 +702,6 @@ static inline int __fscrypt_prepare_rename(struct inode *old_dir, return -EOPNOTSUPP; } -static inline int __fscrypt_prepare_lookup(struct inode *dir, - struct dentry *dentry, - struct fscrypt_name *fname) -{ - return -EOPNOTSUPP; -} - static inline int fscrypt_prepare_lookup_partial(struct inode *dir, struct dentry *dentry) { @@ -985,14 +976,22 @@ static inline int fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry, struct fscrypt_name *fname) { - if (IS_ENCRYPTED(dir)) - return __fscrypt_prepare_lookup(dir, dentry, fname); + int err = 0; + + if (IS_ENCRYPTED(dir)) { + err = fscrypt_setup_filename(dir, &dentry->d_name, 1, fname); + if (err && err != -ENOENT) + return err; + } else { + memset(fname, 0, sizeof(*fname)); + fname->usr_fname = &dentry->d_name; + fname->disk_name.name = (unsigned char *)dentry->d_name.name; + fname->disk_name.len = dentry->d_name.len; + } - memset(fname, 0, sizeof(*fname)); - fname->usr_fname = &dentry->d_name; - fname->disk_name.name = (unsigned char *)dentry->d_name.name; - fname->disk_name.len = dentry->d_name.len; - return 0; + fscrypt_prepare_lookup_dentry(dentry, fname->is_nokey_name); + + return err; } /**