Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp709749pxu; Thu, 3 Dec 2020 10:36:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrSa0Uwi2pHESrfk7IJpWK7cZNQzAU5Du27KsXKo5BQiffe7v5GBDRlgI0PCPO8nt3f/7b X-Received: by 2002:a50:fb97:: with SMTP id e23mr4186773edq.208.1607020593116; Thu, 03 Dec 2020 10:36:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607020593; cv=none; d=google.com; s=arc-20160816; b=ZiK7tsgXPyzorqyABr1eLsDOj1p9MKTbKFrwEITKylVBLjH6NIqhUmVylYOJoRfXWl +g7/ab/kctSCgNzZcv+b9Inlu/8wSIO8hlLrBbOBHCcajsVCu1HcKvrMOo12ojAAz8X6 yR8AkSjmhBI6cq75qNasZykKMxi5FV44DJnCEThlbA10yWJtDhMX8KeUF6XbpVn+BtGB oVLGXepttgeSdGdzwaDK68QvMgyt0EmKLycQzIVNG4vzKwL1f0IhZRcIuk0/y+LlwKUn +G6sd+pnkDH+Br1svZtBC7ZZXvGBqArgt0T3YnQUOEN+YnXlsMaw3hyxZa5DJnnEvi4G Qn/A== 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=CAOIx689nuV75mMZMgD58d3xi0p4R5wEoCmVbA0Be5CfnD2EVuU6gsS1I/21iuJs9E +ITepr+A91qRC1hbou5U09Yw3io1xjB/PB/e1RTM3SL4nonbaOnwjECvvwNUeKPoz4CC mRSc7Kxo/GH5Z96h/SaxjjHJtorHaKBkBNt8A6jJRNq27i8VYlajnFX1eNU0uG7YEWuI D33orP3Im8PxxRDPpw0pHMHN/qVgKcCKQ7+vdDVCHONO3+EiaA993hD+X23RChtNqyTk uDMlhHxNH7WuhpUPw1QJe4Pqv6k3y65HtaefTQb0izQUEhBUP21o9voinmtAbZQllA9t QQRw== 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 m11si1419026edr.583.2020.12.03.10.36.09; Thu, 03 Dec 2020 10:36:33 -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 S1731715AbgLCSeF (ORCPT + 99 others); Thu, 3 Dec 2020 13:34:05 -0500 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:42292 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729312AbgLCSeF (ORCPT ); Thu, 3 Dec 2020 13:34:05 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R401e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UHQtLoS_1607020391; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0UHQtLoS_1607020391) by smtp.aliyun-inc.com(127.0.0.1); Fri, 04 Dec 2020 02:33:22 +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 06/10] proc: Rename in proc_inode rename sysctl_inodes sibling_inodes Date: Fri, 4 Dec 2020 02:32:00 +0800 Message-Id: <20201203183204.63759-7-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20201203183204.63759-1-wenyang@linux.alibaba.com> References: <20201203183204.63759-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