Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp127474pxu; Wed, 6 Jan 2021 23:59:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyh5vboHPCeOnzF0H9hyv7i/CFQXpljn9EsZdAXfgUla/7QihYcaqBKD/Te9L6h+UWsomGK X-Received: by 2002:a17:906:408f:: with SMTP id u15mr5602906ejj.84.1610006350800; Wed, 06 Jan 2021 23:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610006350; cv=none; d=google.com; s=arc-20160816; b=B4qwKKkeWWhefBiP5jVjwntyTDkwik3sS53D0jqDA709nAafDNyZc5MWRUxQJTAhvx 9kS+OCIdvEFoNHMWWyOPWQpmyN/Cgykbi4eAhCcOuH09/qeHqeuY8bCLjq+G98tvHM9s x2hs/mIrhUN6jnSkiGjRHLFnkb2ykU/Jos8fLrmFEuGSkoR40nMOp5z9lfusoM19LnEC kPngeXbl/gcOGmQfCZHnz+a14zBkDTemJwX5oaVLAXGIcCU5t2cri0yufi02c3Y7lfZx ylwxdwc+HvBkSo9MrhBArKki27EyRh2nHwe9LIvlQxs6T2UMvxGfB5BZ0vJniv6ICLVm Pm5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6Zq0owUIIDbvPeSxc81ZLn9vC7frKW90ue49gsplfMg=; b=wnFej4Wd3OJJ5ie0bxpuuNBXS+JRv6XZvdaQYOTd3O8KIewx6ef0J0Q/UJyT2Z5Ts1 Fsa6E4lJuV2ld+siZw7+gBhmUz61/LMZ8h7H13oW+swfBjCEpfW4+PJU0qN5VPDgJPgX aYUGR8RpuBgixwQtaOzYHNpDxtzuDjH6MVaAkIL+bmRgDw682bJmQ+xt/Nw8aqd6lHgG pSG25nM1ynxN4QMOAnN3KmGfyuA8yRYYTYe4e4pQWYTmt+noZH11VI6dlZXcUeJfTP0h gg0u1Sic3/OR4DjuBFbudTgPxeVrqHMU1HTndllBISC8kg9uCouBoy7HlhDUW/PSrfPU aQQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si1935555edk.461.2021.01.06.23.58.47; Wed, 06 Jan 2021 23:59:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727446AbhAGHyD (ORCPT + 99 others); Thu, 7 Jan 2021 02:54:03 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:43661 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbhAGHyC (ORCPT ); Thu, 7 Jan 2021 02:54:02 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R281e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UKzE3SW_1610005998; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0UKzE3SW_1610005998) by smtp.aliyun-inc.com(127.0.0.1); Thu, 07 Jan 2021 15:53:18 +0800 From: Wen Yang To: Greg Kroah-Hartman , Sasha Levin Cc: Xunlei Pang , linux-kernel@vger.kernel.org, "Eric W. Biederman" , stable@vger.kernel.org, Wen Yang Subject: [PATCH 4.19 3/7] proc: Rename in proc_inode rename sysctl_inodes sibling_inodes Date: Thu, 7 Jan 2021 15:53:10 +0800 Message-Id: <20210107075314.62683-4-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210107075314.62683-1-wenyang@linux.alibaba.com> References: <20210107075314.62683-1-wenyang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Eric W. Biederman" [ Upstream commit 0afa5ca82212247456f9de1468b595a111fee633 ] I about to need and use the same functionality for pid based inodes and there is no point in adding a second field when this field is already here and serving the same purporse. Just give the field a generic name so it is clear that it is no longer sysctl specific. Also for good measure initialize sibling_inodes when proc_inode is initialized. Signed-off-by: Eric W. Biederman Cc: # 4.19.x Signed-off-by: Wen Yang --- fs/proc/inode.c | 1 + fs/proc/internal.h | 2 +- fs/proc/proc_sysctl.c | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 31bf3bb..e5334ed 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -70,6 +70,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb) ei->pde = NULL; ei->sysctl = NULL; ei->sysctl_entry = NULL; + INIT_HLIST_NODE(&ei->sibling_inodes); ei->ns_ops = NULL; inode = &ei->vfs_inode; return inode; diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 95b1419..d922c01 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -91,7 +91,7 @@ struct proc_inode { struct proc_dir_entry *pde; struct ctl_table_header *sysctl; struct ctl_table *sysctl_entry; - struct hlist_node sysctl_inodes; + struct hlist_node sibling_inodes; const struct proc_ns_operations *ns_ops; struct inode vfs_inode; } __randomize_layout; diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index c95f32b..0f578f6 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -274,9 +274,9 @@ static void proc_sys_prune_dcache(struct ctl_table_header *head) node = hlist_first_rcu(&head->inodes); if (!node) break; - ei = hlist_entry(node, struct proc_inode, sysctl_inodes); + ei = hlist_entry(node, struct proc_inode, sibling_inodes); spin_lock(&sysctl_lock); - hlist_del_init_rcu(&ei->sysctl_inodes); + hlist_del_init_rcu(&ei->sibling_inodes); spin_unlock(&sysctl_lock); inode = &ei->vfs_inode; @@ -478,7 +478,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, } ei->sysctl = head; ei->sysctl_entry = table; - hlist_add_head_rcu(&ei->sysctl_inodes, &head->inodes); + hlist_add_head_rcu(&ei->sibling_inodes, &head->inodes); head->count++; spin_unlock(&sysctl_lock); @@ -509,7 +509,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, void proc_sys_evict_inode(struct inode *inode, struct ctl_table_header *head) { spin_lock(&sysctl_lock); - hlist_del_init_rcu(&PROC_I(inode)->sysctl_inodes); + hlist_del_init_rcu(&PROC_I(inode)->sibling_inodes); if (!--head->count) kfree_rcu(head, rcu); spin_unlock(&sysctl_lock); -- 1.8.3.1