From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 897E0C32756 for ; Mon, 5 Aug 2019 16:28:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5CDE6216B7; Mon, 5 Aug 2019 16:28:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="YSbB6oaa"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="jlcZ9IR7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="R1EMvlct" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CDE6216B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1hufql-0004cY-Vo; Mon, 05 Aug 2019 16:28:43 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hufqk-0004cF-5L for linux-f2fs-devel@lists.sourceforge.net; Mon, 05 Aug 2019 16:28:42 +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=tc88EJIN+AL+LWS6H2AuLcXwKHusRqZc+JFMzRc+x58=; b=YSbB6oaafIfXFnGTOd3NO7OeDl 2SVOiBC7lYOaj9pqgTpCUr6OYj7mqOx/jMmRtsgxj06h6ex4pisThhuqsiiW+xBSJLEUsnwhrij87 zttoiMNpMXeOh/stnCXvGj7I63I1qzy1pQ0VoJ9JlryONaSlxdWH2cSTdojOZuyhTavk=; 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=tc88EJIN+AL+LWS6H2AuLcXwKHusRqZc+JFMzRc+x58=; b=jlcZ9IR7druYcUEoZUSgk8O5j/ DFzYAHEVGSM1i3g+EoHezAPGXoT1tLtUfIV1rOOzaqD5maIoSlUsKd8Ub580uokyKVERwZ8H2lRWr TVv891n7NdgRUXjenfAQxcCur7Y1dKNPnRPCCZchwSgUGEo2AC7xm31nSLaVmCOxINKk=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hufqf-00BLyY-RP for linux-f2fs-devel@lists.sourceforge.net; Mon, 05 Aug 2019 16:28:42 +0000 Received: from ebiggers-linuxstation.mtv.corp.google.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D70CC21743; Mon, 5 Aug 2019 16:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565022512; bh=LDsEY1oyqFRLCDfidVHwqPHd8uh708sd/A3659BIP/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R1EMvlctliE4w3S3FQ9Gvu6hbIDWpUCiei40ZB8CYtft9x/ok79OLE6TofHEVD9GH 87bzJDYhxvm6xaZrdbROq6JLOMFdLcI8fwEhK4Iwq38KYR/YjPc5qAk3NZgMJDdDLd wd0yw2SoOAXw/3pismli93nTk/I4DbTD9JD6sBP8= From: Eric Biggers To: linux-fscrypt@vger.kernel.org Date: Mon, 5 Aug 2019 09:25:05 -0700 Message-Id: <20190805162521.90882-5-ebiggers@kernel.org> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog In-Reply-To: <20190805162521.90882-1-ebiggers@kernel.org> References: <20190805162521.90882-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Headers-End: 1hufqf-00BLyY-RP Subject: [f2fs-dev] [PATCH v8 04/20] fscrypt: add ->ci_inode to fscrypt_info 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: Satya Tangirala , Theodore Ts'o , linux-api@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, keyrings@vger.kernel.org, linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-ext4@vger.kernel.org, Paul Crowley Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Eric Biggers Add an inode back-pointer to 'struct fscrypt_info', such that inode->i_crypt_info->ci_inode == inode. This will be useful for: 1. Evicting the inodes when a fscrypt key is removed, since we'll track the inodes using a given key by linking their fscrypt_infos together, rather than the inodes directly. This avoids bloating 'struct inode' with a new list_head. 2. Simplifying the per-file key setup, since the inode pointer won't have to be passed around everywhere just in case something goes wrong and it's needed for fscrypt_warn(). Reviewed-by: Theodore Ts'o Signed-off-by: Eric Biggers --- fs/crypto/fscrypt_private.h | 3 +++ fs/crypto/keyinfo.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h index fae411b2f78dcb..d345a7d28df8c2 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h @@ -73,6 +73,9 @@ struct fscrypt_info { */ struct fscrypt_mode *ci_mode; + /* Back-pointer to the inode */ + struct inode *ci_inode; + /* * If non-NULL, then this inode uses a master key directly rather than a * derived key, and ci_ctfm will equal ci_master_key->mk_ctfm. diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 22345ddede1199..2d45a86f09db25 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c @@ -556,6 +556,8 @@ int fscrypt_get_encryption_info(struct inode *inode) if (!crypt_info) return -ENOMEM; + crypt_info->ci_inode = inode; + crypt_info->ci_flags = ctx.flags; crypt_info->ci_data_mode = ctx.contents_encryption_mode; crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; -- 2.22.0.770.g0f2c4a37fd-goog _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel