From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Jan Kara <jack@ucw.cz>
Subject: [PATCH] lost sysctl fix
Date: Sun, 27 Jul 2008 06:31:22 +0100 [thread overview]
Message-ID: <20080727053122.GZ28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20080727051702.GY28946@ZenIV.linux.org.uk>
try_attach() should walk into the matching subdirectory, not the first one...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
[and yes, that's what that crap had been]
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 911d846..fe47133 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1680,43 +1680,45 @@ static __init int sysctl_init(void)
core_initcall(sysctl_init);
-static int is_branch_in(struct ctl_table *branch, struct ctl_table *table)
+static struct ctl_table *is_branch_in(struct ctl_table *branch,
+ struct ctl_table *table)
{
struct ctl_table *p;
const char *s = branch->procname;
/* branch should have named subdirectory as its first element */
if (!s || !branch->child)
- return 0;
+ return NULL;
/* ... and nothing else */
if (branch[1].procname || branch[1].ctl_name)
- return 0;
+ return NULL;
/* table should contain subdirectory with the same name */
for (p = table; p->procname || p->ctl_name; p++) {
if (!p->child)
continue;
if (p->procname && strcmp(p->procname, s) == 0)
- return 1;
+ return p;
}
- return 0;
+ return NULL;
}
/* see if attaching q to p would be an improvement */
static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
{
struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
+ struct ctl_table *next;
int is_better = 0;
int not_in_parent = !p->attached_by;
- while (is_branch_in(by, to)) {
+ while ((next = is_branch_in(by, to)) != NULL) {
if (by == q->attached_by)
is_better = 1;
if (to == p->attached_by)
not_in_parent = 1;
by = by->child;
- to = to->child;
+ to = next->child;
}
if (is_better && not_in_parent) {
next prev parent reply other threads:[~2008-07-27 5:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-27 2:22 2.6.26-mmotm-0724 - linux-next.git loses /proc/sys/fs/quota, breaks disk quotas Valdis.Kletnieks
2008-07-27 3:25 ` Andrew Morton
2008-07-27 3:43 ` Valdis.Kletnieks
2008-07-27 3:50 ` Roland Dreier
2008-07-27 4:09 ` Al Viro
2008-07-27 5:17 ` [PATCH] " Al Viro
2008-07-27 5:31 ` Al Viro [this message]
2008-07-27 6:29 ` [PATCH] lost sysctl fix Ingo Molnar
2008-07-27 6:35 ` Ingo Molnar
2008-07-27 6:31 ` Valdis.Kletnieks
2008-07-27 5:53 ` [PATCH] Re: 2.6.26-mmotm-0724 - linux-next.git loses /proc/sys/fs/quota, breaks disk quotas Valdis.Kletnieks
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=20080727053122.GZ28946@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=jack@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®