mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-09 13:42:56 +00:00
livedump: add event handler hooks
Add three hooks to the livedump process: before, after, and for each block of dumped data. This allows, for example, quiescing the system before the dump begins or protecting data of interest to ensure its consistency in the final output. Reviewed by: markj, kib (previous version) Reviewed by: debdrup (manpages) Reviewed by: Pau Amma <pauamma@gundo.com> (manpages) MFC after: 3 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D34067
This commit is contained in:
parent
c9114f9f86
commit
eb9d205fa6
@ -318,8 +318,14 @@ Callbacks invoked after a linker file has been successfully unloaded.
|
||||
Callbacks invoked before a linker file is about to be unloaded.
|
||||
These callbacks may be used to return an error and prevent the unload from
|
||||
proceeding.
|
||||
.It Vt livedumper_start
|
||||
Callback invoked before beginning a kernel dump of the live system.
|
||||
.It Vt livedumper_dump
|
||||
Callback invoked for each dumped block of data during a live kernel dump.
|
||||
.It Vt livedumper_finish
|
||||
Callback invoked once a live kernel dump has completed.
|
||||
.It Vt lle_event
|
||||
Callback invoked when an link layer event has happened.
|
||||
Callback invoked when a link layer event has happened.
|
||||
.It Vt nmbclusters_change
|
||||
Callback invoked when the number of mbuf clusters has changed.
|
||||
.It Vt nmbufs_change
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <sys/conf.h>
|
||||
#include <sys/caprights.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/kerneldump.h>
|
||||
@ -111,9 +112,15 @@ livedump_start(int fd, int flags, uint8_t compression)
|
||||
rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
|
||||
EVENTHANDLER_INVOKE(livedumper_start, &error);
|
||||
if (error != 0)
|
||||
goto out;
|
||||
|
||||
dump_savectx();
|
||||
error = minidumpsys(livedi, true);
|
||||
|
||||
EVENTHANDLER_INVOKE(livedumper_finish);
|
||||
out:
|
||||
VOP_UNLOCK(vp);
|
||||
vn_rangelock_unlock(vp, rl_cookie);
|
||||
sx_xunlock(&livedump_sx);
|
||||
@ -162,6 +169,10 @@ vnode_dump(void *arg, void *virtual, vm_offset_t physical __unused,
|
||||
MPASS(vp != NULL);
|
||||
ASSERT_VOP_LOCKED(vp, __func__);
|
||||
|
||||
EVENTHANDLER_INVOKE(livedumper_dump, virtual, offset, length, &error);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Done? */
|
||||
if (virtual == NULL)
|
||||
return (0);
|
||||
|
@ -164,6 +164,15 @@ extern int do_minidump;
|
||||
|
||||
int livedump_start(int, int, uint8_t);
|
||||
|
||||
/* Live minidump events */
|
||||
typedef void (*livedump_start_fn)(void *arg, int *errorp);
|
||||
typedef void (*livedump_dump_fn)(void *arg, void *virtual, off_t offset,
|
||||
size_t len, int *errorp);
|
||||
typedef void (*livedump_finish_fn)(void *arg);
|
||||
EVENTHANDLER_DECLARE(livedumper_start, livedump_start_fn);
|
||||
EVENTHANDLER_DECLARE(livedumper_dump, livedump_dump_fn);
|
||||
EVENTHANDLER_DECLARE(livedumper_finish, livedump_finish_fn);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_KERNELDUMP_H */
|
||||
|
Loading…
Reference in New Issue
Block a user