From patchwork Mon Oct 23 21:40:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 829681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TYfXT6WJ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uInkygRH"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLVLZ42CQz9sPr for ; Tue, 24 Oct 2017 08:45:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ucQeVyNiuuRvK9dWJrhoyX6mp0xyJ8xlJS2Gx8nw2mA=; b=TYfXT6WJ3HMd7pIaemZz+2ZNsT UhhE2oF3DziBusYRqiFN+UBZPmqz8LYluqWWYzEbUiaoAIa3rBV7AJdQU40+w8R0UIN5wDXyjN3P7 iccw/S+USDAxArWVrP1LJv03UOKCLt7XIDpbOu1a9veZKxcGqcQ8EFCi0wHXOpPyojP+xVMpZunN2 ZkQKbBQrnHpnaBBo/w6Do7qgTJJ0Zb6nl/O+l1DUNhJv5gVFmxzcULS6ljd71FY65Sw4H2QVCEpd7 D57CN15F2HHirQ/hYXdmV6Itjqu5zz24ctvz2h0Epc8HYYMZIOnRfuVGl53zo4dsskOxVuwKEGa3V 1Lo/+IJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e6kWq-0006js-8W; Mon, 23 Oct 2017 21:45:00 +0000 Received: from mail-it0-x242.google.com ([2607:f8b0:4001:c0b::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e6kUb-0004gH-9N for linux-mtd@lists.infradead.org; Mon, 23 Oct 2017 21:42:48 +0000 Received: by mail-it0-x242.google.com with SMTP id k70so6822012itk.0 for ; Mon, 23 Oct 2017 14:42:20 -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=wiAoc0JHIPz4HAo1BFCpnFyXTNkBIyNbTooXOraiqBE=; b=uInkygRHFd34bCPKGXqHDVXFaWKgpkAJENWTj8+6DxI/CVmkZ2vUM9R9cxo8lz97t7 2YMFfSN+elcoCimm90w4Lxlon1wjrCRLfYcYZpZLzaNcJgxaIR+iUUVAjN32o81OtQaV Z/zCIs5dwVcl973xb8pbystw/6rm74XgEmLnk24EfGRgYJwAcud6sqTI/7/DjrROCyCA k1OYThU0y5hyJkQlelNsg6fBGw/qNIuHEIuuLIB94gDtDvW2ZVs2sp+TdqEQqqIKMWOS DhZMyFr1ni05VcDwKjPGEPD0kQd11FAkoxuiMtyMl6nmA4ztcNb9q+XPIjhcvyTtvPxm R+fA== 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=wiAoc0JHIPz4HAo1BFCpnFyXTNkBIyNbTooXOraiqBE=; b=esZxIuqaQDSatFofAoU4clUB85yHy8ZpVeq4fiuLo4jvmjQC9fZrZ9KSQQwWJ+XfQz DdcQ9H8BXGiewTs+UvLQ85Q3zbIVitUeMO8I51FQUOV1za/olf8GTjS5k6oMABnQs7jL WZL4+mdtBcQ+fyd3Tk6zuJ5ghM8xYFJLMCcfBpBYhl87iYk0Pwxwuw4fg3t/0NkIBxwG w7LPXWsUUKw2bzAPhZdpDTjbxS+5hTHVXDey7p//bSWjcC5EzrLh7JMaUDPPvZfbCwj8 5FS1Zlh3ToIZqD9N9cqW3JEL0Kzhr+K3bPMKvNpdd2kO4399SuRIJN6lOAAqBFYVJJuF Hb+w== X-Gm-Message-State: AMCzsaWYHrCCWzHXGt4nmygXu2ltQrzyOFgv9Jg2T4d7lbc7tOsrZd1k nc4uLsKk75PdS0lJp4C8UGY= X-Google-Smtp-Source: ABhQp+QklVKqmOxvS5EPAR1bGWPJimKjCOvUruutksE3uobbNpP7koBEHKEQEWTx+iR3pEu0xgHf+A== X-Received: by 10.36.77.131 with SMTP id l125mr10541183itb.7.1508794940291; Mon, 23 Oct 2017 14:42:20 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Oct 2017 14:42:19 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Subject: [RFC PATCH 08/25] fs/inode.c: rename and export dispose_list() Date: Mon, 23 Oct 2017 14:40:41 -0700 Message-Id: <20171023214058.128121-9-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171023_144242_071188_6D0209A7 X-CRM114-Status: GOOD ( 13.60 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:4001:c0b:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (ebiggers3[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ebiggers3[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryo Hashimoto , Gwendal Grignou , "Theodore Y . Ts'o" , Eric Biggers , linux-api@vger.kernel.org, Nick Desaulniers , linux-f2fs-devel@lists.sourceforge.net, keyrings@vger.kernel.org, linux-mtd@lists.infradead.org, Michael Halcrow , Sarthak Kukreti , linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-ext4@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 dispose_list() to modules. For clarity also rename it to evict_inode_list(). Signed-off-by: Eric Biggers --- fs/inode.c | 19 ++++++++++--------- include/linux/fs.h | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 30ce98956801..fe47930835c0 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -570,13 +570,13 @@ static void evict(struct inode *inode) } /* - * dispose_list - dispose of the contents of a local list - * @head: the head of the list to free + * evict_inode_list - evict each inode in a local list of inodes + * @head: the head of the list * - * Dispose-list gets a local list with local inodes in it, so it doesn't + * This gets a local list with local inodes in it, so it doesn't * need to worry about list corruption and SMP locks. */ -static void dispose_list(struct list_head *head) +void evict_inode_list(struct list_head *head) { while (!list_empty(head)) { struct inode *inode; @@ -588,6 +588,7 @@ static void dispose_list(struct list_head *head) cond_resched(); } } +EXPORT_SYMBOL_GPL(evict_inode_list); /** * evict_inodes - evict all evictable inodes for a superblock @@ -628,13 +629,13 @@ void evict_inodes(struct super_block *sb) if (need_resched()) { spin_unlock(&sb->s_inode_list_lock); cond_resched(); - dispose_list(&dispose); + evict_inode_list(&dispose); goto again; } } spin_unlock(&sb->s_inode_list_lock); - dispose_list(&dispose); + evict_inode_list(&dispose); } EXPORT_SYMBOL_GPL(evict_inodes); @@ -679,7 +680,7 @@ int invalidate_inodes(struct super_block *sb, bool kill_dirty) } spin_unlock(&sb->s_inode_list_lock); - dispose_list(&dispose); + evict_inode_list(&dispose); return busy; } @@ -763,7 +764,7 @@ static enum lru_status inode_lru_isolate(struct list_head *item, * Walk the superblock inode LRU for freeable inodes and attempt to free them. * This is called from the superblock shrinker function with a number of inodes * to trim from the LRU. Inodes to be freed are moved to a temporary list and - * then are freed outside inode_lock by dispose_list(). + * then are freed outside inode_lock by evict_inode_list(). */ long prune_icache_sb(struct super_block *sb, struct shrink_control *sc) { @@ -772,7 +773,7 @@ long prune_icache_sb(struct super_block *sb, struct shrink_control *sc) freed = list_lru_shrink_walk(&sb->s_inode_lru, sc, inode_lru_isolate, &freeable); - dispose_list(&freeable); + evict_inode_list(&freeable); return freed; } diff --git a/include/linux/fs.h b/include/linux/fs.h index 2833ace2f01d..e0a8dae5f9dc 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2880,6 +2880,7 @@ 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 evict_inode_list(struct list_head *head); extern void __iget(struct inode * inode); extern void iget_failed(struct inode *);