From patchwork Mon Oct 23 21:40:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10023253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6BB65603D7 for ; Mon, 23 Oct 2017 21:44:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CCD920416 for ; Mon, 23 Oct 2017 21:44:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51C4021FAD; Mon, 23 Oct 2017 21:44:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF65D20416 for ; Mon, 23 Oct 2017 21:44:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932362AbdJWVoL (ORCPT ); Mon, 23 Oct 2017 17:44:11 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:46172 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbdJWVmU (ORCPT ); Mon, 23 Oct 2017 17:42:20 -0400 Received: by mail-io0-f195.google.com with SMTP id 101so21727138ioj.3; Mon, 23 Oct 2017 14:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/i3mqgW8YjPejX5sRMdtUKZ5bdvjOqMKhpBbmcCFtsA=; b=pf4Lf4vxCMPSkzQdepfakYfLfqtb5OEmzeI/9osFT+YqtBhj8birEHfVCSfLQCvoWt tUA8gn8lU3bBt096uSaBuGMuJpDup/RFZsx74g+c+0Y/L/aCd2CsFLY+4XFAV8RUC1P9 dxX65J7cO9VBg7dlkdUd6SsIBo1krt1IRQXM1Zz0n4TDkuSxE6uxUwb0dOcj5HrXRkzX llxi1F66r49bF081Kw8+OJK4ri22ZVboTJeXkqbiNX5r/qAnhxRmamVYgF3Ooj8k1BTb sKyh9Nm9c9RVeT2yufgmun6KHb4+OId4xFWF8hfB8+Nf0ll05DeKO00gzNdaPimPhzve ePDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/i3mqgW8YjPejX5sRMdtUKZ5bdvjOqMKhpBbmcCFtsA=; b=Z1Q5qwjwkXO9EpM+2UEkPxevAgiJqf+l4ooKzLI1XHNcWWZD81mPoPkDVcMf+zQ23c lxe+Lx406od/kvINbogwEsBkRSA13H+KTIO0BiYepIv7eDyFgnEJukvBoEgVb3XIU0W+ 3xPtIfmkNF65yV9/gdK/7hUjmw7GEyKF5UDAkoB4iu8ivspLgTso6ktg0Z0QpEKY1ZMR heIvWNaEvXMMCy7oCF2OttEjsyiNy4Qf9zgRVvqf8hvgbJ8+adyjarIezfbdgHxieAVW qo2UB/J6xuZ25afXg2EjnbwiJK0kqWnpUpZmLTXWNtPXwbgAyiNkcsMqQd3SX732ioUc 4rxw== X-Gm-Message-State: AMCzsaViWiyW/295uYeRzi18qDi3b1Pmr+P5Iyjp5LVTjrA6z3JmXAkj nYxHnlC/8WFZxLoBNI0xHA+MTa9h X-Google-Smtp-Source: ABhQp+Qfuw9qHCHWk4gvlHTKuusnzfmAaDBxjbAAU+w4cSF7Nd4Z3rDDOLovjN76TP4IDsu5gsZd/w== X-Received: by 10.107.138.222 with SMTP id c91mr10432868ioj.246.1508794938985; Mon, 23 Oct 2017 14:42:18 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.175.88]) by smtp.gmail.com with ESMTPSA id i63sm3558482ioi.68.2017.10.23.14.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Oct 2017 14:42:18 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-api@vger.kernel.org, keyrings@vger.kernel.org, "Theodore Y . Ts'o" , Jaegeuk Kim , Gwendal Grignou , Ryo Hashimoto , Sarthak Kukreti , Nick Desaulniers , Michael Halcrow , Eric Biggers Subject: [RFC PATCH 07/25] fs/inode.c: export inode_lru_list_del() Date: Mon, 23 Oct 2017 14:40:40 -0700 Message-Id: <20171023214058.128121-8-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.0.rc0.271.g36b669edcc-goog In-Reply-To: <20171023214058.128121-1-ebiggers3@gmail.com> References: <20171023214058.128121-1-ebiggers3@gmail.com> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers When a filesystem encryption key is removed, we need all files which had been "unlocked" (had ->i_crypt_info set up) with it to appear "locked" again. This is most easily done by evicting the inodes. This can currently be done using 'echo 2 > /proc/sys/vm/drop_caches'; however, that is overkill and not usable by non-root users. In preparation for allowing fs/crypto/ to evict just the needed inodes, export inode_lru_list_del() to modules. Signed-off-by: Eric Biggers Reviewed-by: Michael Halcrow --- fs/inode.c | 5 ++--- include/linux/fs.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index d1e35b53bb23..30ce98956801 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -420,13 +420,12 @@ void inode_add_lru(struct inode *inode) inode_lru_list_add(inode); } - -static void inode_lru_list_del(struct inode *inode) +void inode_lru_list_del(struct inode *inode) { - if (list_lru_del(&inode->i_sb->s_inode_lru, &inode->i_lru)) this_cpu_dec(nr_unused); } +EXPORT_SYMBOL_GPL(inode_lru_list_del); /** * inode_sb_list_add - add inode to the superblock list of inodes diff --git a/include/linux/fs.h b/include/linux/fs.h index 8cfb0877d32c..2833ace2f01d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2879,6 +2879,7 @@ static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { }; extern void unlock_new_inode(struct inode *); extern unsigned int get_next_ino(void); extern void evict_inodes(struct super_block *sb); +extern void inode_lru_list_del(struct inode *inode); extern void __iget(struct inode * inode); extern void iget_failed(struct inode *);