Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp126193pxu; Wed, 6 Jan 2021 23:56:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJysyGt0xU2J8mP/KQLOv5n3SMKob/gRkwrESD+/6HP/49/Miv6Q5bSUMyeI5HTHjKAAiGXB X-Received: by 2002:a05:6402:c0b:: with SMTP id co11mr741273edb.180.1610006163874; Wed, 06 Jan 2021 23:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610006163; cv=none; d=google.com; s=arc-20160816; b=pkAIJ+Ro6ZJ13A2sUkHRpZLk058xL+oxLN/0QRjpmC0AU48jfNvDc0VSH6F/xR20UP YqFw3lilzZ3MDBwG0m3kEdpZbbxQ+UTYJJG2gSNtoMzGjSo3meW49pBrtKgx4GwxJwz/ 7+MWOGAzct0hTR4jcYDCT+Zk42QUEc40VyEL4EQfAd7pZ3v5lHb1CRKeucKsdZ5UpRFd WdEOoT9BYuuDauXsnMGePON5K+AiZ1K/IKCzLChPwMhzqIfH5nmYgrD4PnQVT0s549KX mUzqYSP7OyW9HFOE6mlIfM5Q7jcJsQOAUmabpAeWTq1tqwDg/p96bnbFVW28aWd/KRX4 9Qmg== 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=KtxZvf6yiUs3l+Pxht1/j8Kgx83+RWvqal9KfVjMoog=; b=ACMkmhFVzmorHYXb95ztCzjFCKfZtNl9iCbIg4PR8KrFqHKHIX7KWl0bg0lGNFcV1T NVkdcNBfUg6dFfTAssCGAkH+nMr4ZEcKG6jS2E1GADE9Ul4gOvXOSo5Yk6LXoWi3ctwM Dr4A+F5Lw7sCZUISCW1FEwvspT+ynUGStU7nlqUGe/AJQjlTRoIXUcuhQmt5hr9iz2VV 07tPqIaxUws6LW3yruWhayhja/ltXW/BJeNZtWDtcvHWc6/4pWVQnDlF6thwU4Yu3BbU m03cnbpB3jI3ZY14AZgdvGdC9ZnV69o+fGFhTCb7L/a2rg5mXPCkUt1EUwP3QyveUowK pXdw== 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 t6si1819167ejr.116.2021.01.06.23.55.40; Wed, 06 Jan 2021 23:56:03 -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 S1727164AbhAGHxW (ORCPT + 99 others); Thu, 7 Jan 2021 02:53:22 -0500 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:50911 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726682AbhAGHxV (ORCPT ); Thu, 7 Jan 2021 02:53:21 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R551e4;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_---0UKzNwAM_1610005957; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0UKzNwAM_1610005957) by smtp.aliyun-inc.com(127.0.0.1); Thu, 07 Jan 2021 15:52:37 +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 v2 4.9 06/10] proc: Rename in proc_inode rename sysctl_inodes sibling_inodes Date: Thu, 7 Jan 2021 15:52:18 +0800 Message-Id: <20210107075222.62623-7-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210107075222.62623-1-wenyang@linux.alibaba.com> References: <20210107075222.62623-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.9.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 a289349..14d9c1d 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -67,6 +67,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 103435f..409b5c5 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -65,7 +65,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; }; diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 191573a..671490e 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -272,9 +272,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; @@ -480,7 +480,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); @@ -511,7 +511,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