diff options
author | Zach Brown <zach.brown@oracle.com> | 2005-11-07 03:59:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:38 -0500 |
commit | d55b5fdaf40846221d543937b786956e27837fda (patch) | |
tree | ecdf572d7d2b08b4f7b31d804542a920934b6d9a /kernel/sysctl.c | |
parent | 0f6ed7c2641fe4cea83cd09c21928ca30c0983ec (diff) |
[PATCH] aio: remove aio_max_nr accounting race
AIO was adding a new context's max requests to the global total before
testing if that resulting total was over the global limit. This let
innocent tasks get their new limit tested along with a racing guilty task
that was crossing the limit. This serializes the _nr accounting with a
spinlock It also switches to using unsigned long for the global totals.
Individual contexts are still limited to an unsigned int's worth of
requests by the syscall interface.
The problem and fix were verified with a simple program that spun creating
and destroying a context while holding on to another long lived context.
Before the patch a task creating a tiny context could get a spurious EAGAIN
if it raced with a task creating a very large context that overran the
limit.
Signed-off-by: Zach Brown <zach.brown@oracle.com>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8e56e2495542..e1351200ce85 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -952,7 +952,7 @@ static ctl_table fs_table[] = { | |||
952 | .data = &aio_nr, | 952 | .data = &aio_nr, |
953 | .maxlen = sizeof(aio_nr), | 953 | .maxlen = sizeof(aio_nr), |
954 | .mode = 0444, | 954 | .mode = 0444, |
955 | .proc_handler = &proc_dointvec, | 955 | .proc_handler = &proc_doulongvec_minmax, |
956 | }, | 956 | }, |
957 | { | 957 | { |
958 | .ctl_name = FS_AIO_MAX_NR, | 958 | .ctl_name = FS_AIO_MAX_NR, |
@@ -960,7 +960,7 @@ static ctl_table fs_table[] = { | |||
960 | .data = &aio_max_nr, | 960 | .data = &aio_max_nr, |
961 | .maxlen = sizeof(aio_max_nr), | 961 | .maxlen = sizeof(aio_max_nr), |
962 | .mode = 0644, | 962 | .mode = 0644, |
963 | .proc_handler = &proc_dointvec, | 963 | .proc_handler = &proc_doulongvec_minmax, |
964 | }, | 964 | }, |
965 | #ifdef CONFIG_INOTIFY | 965 | #ifdef CONFIG_INOTIFY |
966 | { | 966 | { |