From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] proc: faster open/read/close with "permanent" files
Date: Wed, 19 Feb 2020 08:29:21 +0300 [thread overview]
Message-ID: <20200219052921.GF19641@kadam> (raw)
In-Reply-To: <20200216152649.GA2693@avx2>
[-- Attachment #1: Type: text/plain, Size: 4886 bytes --]
Hi Alexey,
url: https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/proc-faster-open-read-close-with-permanent-files/20200218-231203
base: https://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/proc/generic.c:752 remove_proc_subtree() warn: inconsistent returns 'proc_subdir_lock'.
# https://github.com/0day-ci/linux/commit/3cd4ad42ca7c52d1513e7ba9f08a06197a7380c8
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 3cd4ad42ca7c52d1513e7ba9f08a06197a7380c8
vim +/proc_subdir_lock +752 fs/proc/generic.c
8ce584c7416d8a Al Viro 2013-03-30 699
8ce584c7416d8a Al Viro 2013-03-30 700 int remove_proc_subtree(const char *name, struct proc_dir_entry *parent)
8ce584c7416d8a Al Viro 2013-03-30 701 {
8ce584c7416d8a Al Viro 2013-03-30 702 struct proc_dir_entry *root = NULL, *de, *next;
8ce584c7416d8a Al Viro 2013-03-30 703 const char *fn = name;
8ce584c7416d8a Al Viro 2013-03-30 704 unsigned int len;
8ce584c7416d8a Al Viro 2013-03-30 705
ecf1a3dfff22bd Waiman Long 2015-09-09 706 write_lock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 707 if (__xlate_proc_name(name, &parent, &fn) != 0) {
ecf1a3dfff22bd Waiman Long 2015-09-09 708 write_unlock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 709 return -ENOENT;
8ce584c7416d8a Al Viro 2013-03-30 710 }
8ce584c7416d8a Al Viro 2013-03-30 711 len = strlen(fn);
8ce584c7416d8a Al Viro 2013-03-30 712
710585d4922fd3 Nicolas Dichtel 2014-12-10 713 root = pde_subdir_find(parent, fn, len);
8ce584c7416d8a Al Viro 2013-03-30 714 if (!root) {
ecf1a3dfff22bd Waiman Long 2015-09-09 715 write_unlock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 716 return -ENOENT;
8ce584c7416d8a Al Viro 2013-03-30 717 }
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 718 if (unlikely(pde_is_permanent(root))) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 719 WARN(1, "removing permanent /proc entry '%s/%s'",
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 720 root->parent->name, root->name);
unlock?
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 721 return -EINVAL;
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 722 }
4f1134370a29a5 Alexey Dobriyan 2018-04-10 723 rb_erase(&root->subdir_node, &parent->subdir);
710585d4922fd3 Nicolas Dichtel 2014-12-10 724
8ce584c7416d8a Al Viro 2013-03-30 725 de = root;
8ce584c7416d8a Al Viro 2013-03-30 726 while (1) {
710585d4922fd3 Nicolas Dichtel 2014-12-10 727 next = pde_subdir_first(de);
8ce584c7416d8a Al Viro 2013-03-30 728 if (next) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 729 if (unlikely(pde_is_permanent(root))) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 730 WARN(1, "removing permanent /proc entry '%s/%s'",
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 731 next->parent->name, next->name);
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 732 return -EINVAL;
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 733 }
4f1134370a29a5 Alexey Dobriyan 2018-04-10 734 rb_erase(&next->subdir_node, &de->subdir);
8ce584c7416d8a Al Viro 2013-03-30 735 de = next;
8ce584c7416d8a Al Viro 2013-03-30 736 continue;
8ce584c7416d8a Al Viro 2013-03-30 737 }
8ce584c7416d8a Al Viro 2013-03-30 738 next = de->parent;
8ce584c7416d8a Al Viro 2013-03-30 739 if (S_ISDIR(de->mode))
8ce584c7416d8a Al Viro 2013-03-30 740 next->nlink--;
e06689bf57017a Alexey Dobriyan 2019-12-04 741 write_unlock(&proc_subdir_lock);
e06689bf57017a Alexey Dobriyan 2019-12-04 742
e06689bf57017a Alexey Dobriyan 2019-12-04 743 proc_entry_rundown(de);
8ce584c7416d8a Al Viro 2013-03-30 744 if (de == root)
8ce584c7416d8a Al Viro 2013-03-30 745 break;
8ce584c7416d8a Al Viro 2013-03-30 746 pde_put(de);
8ce584c7416d8a Al Viro 2013-03-30 747
ecf1a3dfff22bd Waiman Long 2015-09-09 748 write_lock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 749 de = next;
8ce584c7416d8a Al Viro 2013-03-30 750 }
8ce584c7416d8a Al Viro 2013-03-30 751 pde_put(root);
8ce584c7416d8a Al Viro 2013-03-30 @752 return 0;
8ce584c7416d8a Al Viro 2013-03-30 753 }
8ce584c7416d8a Al Viro 2013-03-30 754 EXPORT_SYMBOL(remove_proc_subtree);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] proc: faster open/read/close with "permanent" files
Date: Wed, 19 Feb 2020 08:29:21 +0300 [thread overview]
Message-ID: <20200219052921.GF19641@kadam> (raw)
In-Reply-To: <20200216152649.GA2693@avx2>
[-- Attachment #1: Type: text/plain, Size: 4886 bytes --]
Hi Alexey,
url: https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/proc-faster-open-read-close-with-permanent-files/20200218-231203
base: https://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/proc/generic.c:752 remove_proc_subtree() warn: inconsistent returns 'proc_subdir_lock'.
# https://github.com/0day-ci/linux/commit/3cd4ad42ca7c52d1513e7ba9f08a06197a7380c8
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 3cd4ad42ca7c52d1513e7ba9f08a06197a7380c8
vim +/proc_subdir_lock +752 fs/proc/generic.c
8ce584c7416d8a Al Viro 2013-03-30 699
8ce584c7416d8a Al Viro 2013-03-30 700 int remove_proc_subtree(const char *name, struct proc_dir_entry *parent)
8ce584c7416d8a Al Viro 2013-03-30 701 {
8ce584c7416d8a Al Viro 2013-03-30 702 struct proc_dir_entry *root = NULL, *de, *next;
8ce584c7416d8a Al Viro 2013-03-30 703 const char *fn = name;
8ce584c7416d8a Al Viro 2013-03-30 704 unsigned int len;
8ce584c7416d8a Al Viro 2013-03-30 705
ecf1a3dfff22bd Waiman Long 2015-09-09 706 write_lock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 707 if (__xlate_proc_name(name, &parent, &fn) != 0) {
ecf1a3dfff22bd Waiman Long 2015-09-09 708 write_unlock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 709 return -ENOENT;
8ce584c7416d8a Al Viro 2013-03-30 710 }
8ce584c7416d8a Al Viro 2013-03-30 711 len = strlen(fn);
8ce584c7416d8a Al Viro 2013-03-30 712
710585d4922fd3 Nicolas Dichtel 2014-12-10 713 root = pde_subdir_find(parent, fn, len);
8ce584c7416d8a Al Viro 2013-03-30 714 if (!root) {
ecf1a3dfff22bd Waiman Long 2015-09-09 715 write_unlock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 716 return -ENOENT;
8ce584c7416d8a Al Viro 2013-03-30 717 }
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 718 if (unlikely(pde_is_permanent(root))) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 719 WARN(1, "removing permanent /proc entry '%s/%s'",
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 720 root->parent->name, root->name);
unlock?
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 721 return -EINVAL;
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 722 }
4f1134370a29a5 Alexey Dobriyan 2018-04-10 723 rb_erase(&root->subdir_node, &parent->subdir);
710585d4922fd3 Nicolas Dichtel 2014-12-10 724
8ce584c7416d8a Al Viro 2013-03-30 725 de = root;
8ce584c7416d8a Al Viro 2013-03-30 726 while (1) {
710585d4922fd3 Nicolas Dichtel 2014-12-10 727 next = pde_subdir_first(de);
8ce584c7416d8a Al Viro 2013-03-30 728 if (next) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 729 if (unlikely(pde_is_permanent(root))) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 730 WARN(1, "removing permanent /proc entry '%s/%s'",
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 731 next->parent->name, next->name);
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 732 return -EINVAL;
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 733 }
4f1134370a29a5 Alexey Dobriyan 2018-04-10 734 rb_erase(&next->subdir_node, &de->subdir);
8ce584c7416d8a Al Viro 2013-03-30 735 de = next;
8ce584c7416d8a Al Viro 2013-03-30 736 continue;
8ce584c7416d8a Al Viro 2013-03-30 737 }
8ce584c7416d8a Al Viro 2013-03-30 738 next = de->parent;
8ce584c7416d8a Al Viro 2013-03-30 739 if (S_ISDIR(de->mode))
8ce584c7416d8a Al Viro 2013-03-30 740 next->nlink--;
e06689bf57017a Alexey Dobriyan 2019-12-04 741 write_unlock(&proc_subdir_lock);
e06689bf57017a Alexey Dobriyan 2019-12-04 742
e06689bf57017a Alexey Dobriyan 2019-12-04 743 proc_entry_rundown(de);
8ce584c7416d8a Al Viro 2013-03-30 744 if (de == root)
8ce584c7416d8a Al Viro 2013-03-30 745 break;
8ce584c7416d8a Al Viro 2013-03-30 746 pde_put(de);
8ce584c7416d8a Al Viro 2013-03-30 747
ecf1a3dfff22bd Waiman Long 2015-09-09 748 write_lock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 749 de = next;
8ce584c7416d8a Al Viro 2013-03-30 750 }
8ce584c7416d8a Al Viro 2013-03-30 751 pde_put(root);
8ce584c7416d8a Al Viro 2013-03-30 @752 return 0;
8ce584c7416d8a Al Viro 2013-03-30 753 }
8ce584c7416d8a Al Viro 2013-03-30 754 EXPORT_SYMBOL(remove_proc_subtree);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Alexey Dobriyan <adobriyan@gmail.com>
Cc: kbuild-all@lists.01.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] proc: faster open/read/close with "permanent" files
Date: Wed, 19 Feb 2020 08:29:21 +0300 [thread overview]
Message-ID: <20200219052921.GF19641@kadam> (raw)
In-Reply-To: <20200216152649.GA2693@avx2>
Hi Alexey,
url: https://github.com/0day-ci/linux/commits/Alexey-Dobriyan/proc-faster-open-read-close-with-permanent-files/20200218-231203
base: https://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/proc/generic.c:752 remove_proc_subtree() warn: inconsistent returns 'proc_subdir_lock'.
# https://github.com/0day-ci/linux/commit/3cd4ad42ca7c52d1513e7ba9f08a06197a7380c8
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 3cd4ad42ca7c52d1513e7ba9f08a06197a7380c8
vim +/proc_subdir_lock +752 fs/proc/generic.c
8ce584c7416d8a Al Viro 2013-03-30 699
8ce584c7416d8a Al Viro 2013-03-30 700 int remove_proc_subtree(const char *name, struct proc_dir_entry *parent)
8ce584c7416d8a Al Viro 2013-03-30 701 {
8ce584c7416d8a Al Viro 2013-03-30 702 struct proc_dir_entry *root = NULL, *de, *next;
8ce584c7416d8a Al Viro 2013-03-30 703 const char *fn = name;
8ce584c7416d8a Al Viro 2013-03-30 704 unsigned int len;
8ce584c7416d8a Al Viro 2013-03-30 705
ecf1a3dfff22bd Waiman Long 2015-09-09 706 write_lock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 707 if (__xlate_proc_name(name, &parent, &fn) != 0) {
ecf1a3dfff22bd Waiman Long 2015-09-09 708 write_unlock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 709 return -ENOENT;
8ce584c7416d8a Al Viro 2013-03-30 710 }
8ce584c7416d8a Al Viro 2013-03-30 711 len = strlen(fn);
8ce584c7416d8a Al Viro 2013-03-30 712
710585d4922fd3 Nicolas Dichtel 2014-12-10 713 root = pde_subdir_find(parent, fn, len);
8ce584c7416d8a Al Viro 2013-03-30 714 if (!root) {
ecf1a3dfff22bd Waiman Long 2015-09-09 715 write_unlock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 716 return -ENOENT;
8ce584c7416d8a Al Viro 2013-03-30 717 }
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 718 if (unlikely(pde_is_permanent(root))) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 719 WARN(1, "removing permanent /proc entry '%s/%s'",
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 720 root->parent->name, root->name);
unlock?
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 721 return -EINVAL;
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 722 }
4f1134370a29a5 Alexey Dobriyan 2018-04-10 723 rb_erase(&root->subdir_node, &parent->subdir);
710585d4922fd3 Nicolas Dichtel 2014-12-10 724
8ce584c7416d8a Al Viro 2013-03-30 725 de = root;
8ce584c7416d8a Al Viro 2013-03-30 726 while (1) {
710585d4922fd3 Nicolas Dichtel 2014-12-10 727 next = pde_subdir_first(de);
8ce584c7416d8a Al Viro 2013-03-30 728 if (next) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 729 if (unlikely(pde_is_permanent(root))) {
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 730 WARN(1, "removing permanent /proc entry '%s/%s'",
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 731 next->parent->name, next->name);
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 732 return -EINVAL;
3cd4ad42ca7c52 Alexey Dobriyan 2020-02-16 733 }
4f1134370a29a5 Alexey Dobriyan 2018-04-10 734 rb_erase(&next->subdir_node, &de->subdir);
8ce584c7416d8a Al Viro 2013-03-30 735 de = next;
8ce584c7416d8a Al Viro 2013-03-30 736 continue;
8ce584c7416d8a Al Viro 2013-03-30 737 }
8ce584c7416d8a Al Viro 2013-03-30 738 next = de->parent;
8ce584c7416d8a Al Viro 2013-03-30 739 if (S_ISDIR(de->mode))
8ce584c7416d8a Al Viro 2013-03-30 740 next->nlink--;
e06689bf57017a Alexey Dobriyan 2019-12-04 741 write_unlock(&proc_subdir_lock);
e06689bf57017a Alexey Dobriyan 2019-12-04 742
e06689bf57017a Alexey Dobriyan 2019-12-04 743 proc_entry_rundown(de);
8ce584c7416d8a Al Viro 2013-03-30 744 if (de == root)
8ce584c7416d8a Al Viro 2013-03-30 745 break;
8ce584c7416d8a Al Viro 2013-03-30 746 pde_put(de);
8ce584c7416d8a Al Viro 2013-03-30 747
ecf1a3dfff22bd Waiman Long 2015-09-09 748 write_lock(&proc_subdir_lock);
8ce584c7416d8a Al Viro 2013-03-30 749 de = next;
8ce584c7416d8a Al Viro 2013-03-30 750 }
8ce584c7416d8a Al Viro 2013-03-30 751 pde_put(root);
8ce584c7416d8a Al Viro 2013-03-30 @752 return 0;
8ce584c7416d8a Al Viro 2013-03-30 753 }
8ce584c7416d8a Al Viro 2013-03-30 754 EXPORT_SYMBOL(remove_proc_subtree);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next prev parent reply other threads:[~2020-02-19 5:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-16 15:26 [PATCH] proc: faster open/read/close with "permanent" files Alexey Dobriyan
2020-02-19 5:29 ` Dan Carpenter [this message]
2020-02-19 5:29 ` Dan Carpenter
2020-02-19 5:29 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200219052921.GF19641@kadam \
--to=dan.carpenter@oracle.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.