mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
[PATCH] Fix of bogus file max limit messages
This patch fixes incorrect and bogus kernel messages that file-max limit reached when the allocation fails Signed-Off-By: Kirill Korotaev <dev@sw.ru> Signed-Off-By: Denis Lunev <den@sw.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
c663e5d80e
commit
af4d2ecbf0
1 changed files with 29 additions and 26 deletions
|
@ -69,15 +69,18 @@ static int old_max;
|
||||||
/*
|
/*
|
||||||
* Privileged users can go above max_files
|
* Privileged users can go above max_files
|
||||||
*/
|
*/
|
||||||
if (files_stat.nr_files < files_stat.max_files ||
|
if (files_stat.nr_files >= files_stat.max_files &&
|
||||||
capable(CAP_SYS_ADMIN)) {
|
!capable(CAP_SYS_ADMIN))
|
||||||
|
goto over;
|
||||||
|
|
||||||
f = kmem_cache_alloc(filp_cachep, GFP_KERNEL);
|
f = kmem_cache_alloc(filp_cachep, GFP_KERNEL);
|
||||||
if (f) {
|
if (f == NULL)
|
||||||
memset(f, 0, sizeof(*f));
|
|
||||||
if (security_file_alloc(f)) {
|
|
||||||
file_free(f);
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
|
||||||
|
memset(f, 0, sizeof(*f));
|
||||||
|
if (security_file_alloc(f))
|
||||||
|
goto fail_sec;
|
||||||
|
|
||||||
eventpoll_init_file(f);
|
eventpoll_init_file(f);
|
||||||
atomic_set(&f->f_count, 1);
|
atomic_set(&f->f_count, 1);
|
||||||
f->f_uid = current->fsuid;
|
f->f_uid = current->fsuid;
|
||||||
|
@ -87,18 +90,18 @@ static int old_max;
|
||||||
INIT_LIST_HEAD(&f->f_list);
|
INIT_LIST_HEAD(&f->f_list);
|
||||||
f->f_maxcount = INT_MAX;
|
f->f_maxcount = INT_MAX;
|
||||||
return f;
|
return f;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
over:
|
||||||
/* Ran out of filps - report that */
|
/* Ran out of filps - report that */
|
||||||
if (files_stat.max_files >= old_max) {
|
if (files_stat.nr_files > old_max) {
|
||||||
printk(KERN_INFO "VFS: file-max limit %d reached\n",
|
printk(KERN_INFO "VFS: file-max limit %d reached\n",
|
||||||
files_stat.max_files);
|
files_stat.max_files);
|
||||||
old_max = files_stat.max_files;
|
old_max = files_stat.nr_files;
|
||||||
} else {
|
|
||||||
/* Big problems... */
|
|
||||||
printk(KERN_WARNING "VFS: filp allocation failed\n");
|
|
||||||
}
|
}
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
fail_sec:
|
||||||
|
file_free(f);
|
||||||
fail:
|
fail:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue