lkml.org 
[lkml]   [2004]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Reduce bkl usage in do_coredump
A patch that reduces bkl usage in do_coredump is attached. 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: Josh Aas <josha@sgi.com>

--
Josh Aas
Silicon Graphics, Inc. (SGI)
Linux System Software
651-683-3068
--- a/fs/exec.c 2004-08-09 09:14:53.000000000 -0500
+++ b/fs/exec.c 2004-08-09 09:18:50.000000000 -0500
@@ -1193,7 +1193,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;
@@ -1357,7 +1357,6 @@ int do_coredump(long signr, int exit_cod
struct file * file;
int retval = 0;

- lock_kernel();
binfmt = current->binfmt;
if (!binfmt || !binfmt->core_dump)
goto fail;
@@ -1375,7 +1374,13 @@ int do_coredump(long signr, int exit_cod
if (current->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
goto fail_unlock;

- format_corename(corename, core_pattern, signr);
+ /*
+ * 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;
@@ -1402,6 +1407,5 @@ close_fail:
fail_unlock:
complete_all(&mm->core_done);
fail:
- unlock_kernel();
return retval;
}
\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.026 / U:10.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site