From d73b3c59f0f82580650e5b2965bdd3dd4cac7bd5 Mon Sep 17 00:00:00 2001 From: dillon Date: Sat, 8 Sep 2001 20:02:33 +0000 Subject: This brings in a Yahoo coredump patch from Paul, with additional mods by me (addition of vn_rdwr_inchunks). The problem Yahoo is solving is that if you have large process images core dumping, or you have a large number of forked processes all core dumping at the same time, the original coredump code would leave the vnode locked throughout. This can cause the directory vnode to get locked up, which can cause the parent directory vnode to get locked up, and so on all the way to the root node, locking the entire machine up for extremely long periods of time. This patch solves the problem in two ways. First it uses an advisory non-blocking lock to abort multiple processes trying to core to the same file. Second (my contribution) it chunks up the writes and uses bwillwrite() to avoid holding the vnode locked while blocking in the buffer cache. Submitted by: ps Reviewed by: dillon MFC after: 2 weeks --- sys/kern/imgact_aout.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/kern/imgact_aout.c') diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index 9994ad5..9aa8b3d 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -264,15 +264,15 @@ aout_coredump(p, vp, limit) fill_kinfo_proc(p, &p->p_addr->u_kproc); error = cpu_coredump(p, vp, cred); if (error == 0) - error = vn_rdwr(UIO_WRITE, vp, vm->vm_daddr, + error = vn_rdwr_inchunks(UIO_WRITE, vp, vm->vm_daddr, (int)ctob(vm->vm_dsize), (off_t)ctob(UPAGES), UIO_USERSPACE, - IO_NODELOCKED|IO_UNIT, cred, (int *) NULL, p); + IO_UNIT, cred, (int *) NULL, p); if (error == 0) - error = vn_rdwr(UIO_WRITE, vp, + error = vn_rdwr_inchunks(UIO_WRITE, vp, (caddr_t) trunc_page(USRSTACK - ctob(vm->vm_ssize)), round_page(ctob(vm->vm_ssize)), (off_t)ctob(UPAGES) + ctob(vm->vm_dsize), UIO_USERSPACE, - IO_NODELOCKED|IO_UNIT, cred, (int *) NULL, p); + IO_UNIT, cred, (int *) NULL, p); return (error); } -- cgit v1.1