During core dump of process P, all of P's threads are suspended except
the one that proceeds from sigexit() into coredump(). Some suspended
threads may be sleeping in the filesystem with filesystem locks held.
Coredump, via elfN_prepare_notes -> note_procstat_files ->
kern_proc_filedesc_out -> export_*_to_sb, attempts to lock the process'
files LK_SHARED | LK_RETRY. As the suspended threads will not make
forward progress before coredump() has completed, this is classic
This was introduced in r249558 with the addition of the
NT_PROCSTAT_FILES dump note.
This patch adds 'lkflags' arguments to a number of routines that may act
on vnodes (vn_fullpath, kern_proc_filedesc_out, export_*_to_kinfo,
export_*_to_sb, fo_fill_kinfo, fo_fill_kinfo_t and every fill_kinfo fop,
vn_fullpath1, vn_vptocnp_locked, vn_fill_kinfo_vnode). At this time,
only 0 and LK_NOWAIT values are valid; a few KASSERTs are added to