Commit 77dc05e7 authored by Josh Aas's avatar Josh Aas Committed by Linus Torvalds

[PATCH] Reduce bkl usage in do_coredump

A patch that reduces bkl usage in do_coredump.  I don't see anywhere that
it is necessary except for the call to format_corename, which is controlled
via sysctl (sys_sysctl holds the bkl).

Also make format_corename() static.
Signed-off-by: default avatarJosh Aas <josha@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1f655232
......@@ -1211,7 +1211,7 @@ EXPORT_SYMBOL(set_binfmt);
* name into corename, which must have space for at least
* CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
*/
void format_corename(char *corename, const char *pattern, long signr)
static void format_corename(char *corename, const char *pattern, long signr)
{
const char *pat_ptr = pattern;
char *out_ptr = corename;
......@@ -1375,7 +1375,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
struct file * file;
int retval = 0;
lock_kernel();
binfmt = current->binfmt;
if (!binfmt || !binfmt->core_dump)
goto fail;
......@@ -1393,7 +1392,13 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
goto fail_unlock;
/*
* lock_kernel() because format_corename() is controlled by sysctl, which
* uses lock_kernel()
*/
lock_kernel();
format_corename(corename, core_pattern, signr);
unlock_kernel();
file = filp_open(corename, O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600);
if (IS_ERR(file))
goto fail_unlock;
......@@ -1420,6 +1425,5 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
fail_unlock:
complete_all(&mm->core_done);
fail:
unlock_kernel();
return retval;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment