summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
16140bd)
Background
==========
According to the rmmod(8) man page:
rmmod is a trivial program to remove a module (when module unloading
support is provided) from the kernel. Most users will want to use
modprobe(8) with the -r option instead.
`rmmod` simply unloads the provided module and decrements the refcount
of the modules it depended on but doesn't unload those dependencies if
their refcount is zero.
Issue
=====
With the following scenario we can end up if modules with a zero
refcount still loaded in the kernel:
modprobe lttng-test
lttng-sessiond
... (test case) ...
ctrl+c sessiond
rmmod lttng-test
When we teardown the lttng-sessiond, some modules are kept in the kernel
because the `lttng-test` module depends on them. So unloading
`lttng-test` using `rmmod` keeps those dependencies in the kernel.
Solution
========
Use `modprobe --remove` to unload modules and their now unused
dependencies.
From the modprobe(8) man page:
-r, --remove
This option causes modprobe to remove rather than insert a module.
If the modules it depends on are also unused, modprobe will try to
remove them too. Unlike insertion, more than one module can be
specified on the command line
Note
====
This commit also replaces existing uses of `modprobe -r` to `modprobe
--remove` for consistency.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7be83a645097e1eddd478cfbb717906b971f04ea
13 files changed:
modprobe lttng-test
test_kernel_local
test_kernel_streaming
modprobe lttng-test
test_kernel_local
test_kernel_streaming
+ modprobe --remove lttng-test
test_ust_local
test_ust_streaming
test_ust_local
test_ust_streaming
{
modprobe lttng-test
test_kernel_raw
{
modprobe lttng-test
test_kernel_raw
+ modprobe --remove lttng-test
{
diag "*** Exiting ***"
stop_lttng_sessiond
{
diag "*** Exiting ***"
stop_lttng_sessiond
- modprobe -r lttng-test lttng-clock-plugin-test lttng-clock
+ modprobe --remove lttng-test lttng-clock-plugin-test lttng-clock
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_sessiond
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_sessiond
- modprobe -r lttng-test lttng-clock-plugin-test lttng-clock
+ modprobe --remove lttng-test lttng-clock-plugin-test lttng-clock
local TRACE_METADATA_FILE_PATH="$(find "$TRACE_PATH" -name metadata -type f)"
local TRACE_METADATA_DIR="$(dirname "$TRACE_METADATA_FILE_PATH")"
local TRACE_METADATA_FILE_PATH="$(find "$TRACE_PATH" -name metadata -type f)"
local TRACE_METADATA_DIR="$(dirname "$TRACE_METADATA_FILE_PATH")"
cut -d, -f1 | uniq | wc -l)
test $unique_timestamps_count -gt 1
ok $? "Unique event timestamps without clock override: $unique_timestamps_count expect >1"
cut -d, -f1 | uniq | wc -l)
test $unique_timestamps_count -gt 1
ok $? "Unique event timestamps without clock override: $unique_timestamps_count expect >1"
+ modprobe --remove lttng-test
stop_lttng_sessiond
# Test with clock override plugin.
stop_lttng_sessiond
# Test with clock override plugin.
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
- rmmod lttng-clock-plugin-test
- rmmod lttng-clock
+ modprobe --remove lttng-clock-plugin-test lttng-clock lttng-test
# Use Babeltrace with "-n all" to give a comma separated list for
# easy extraction of timestamps.
# Use Babeltrace with "-n all" to give a comma separated list for
# easy extraction of timestamps.
function signal_cleanup()
{
diag "*** Exiting ***"
function signal_cleanup()
{
diag "*** Exiting ***"
+ modprobe --remove lttng-test
+ modprobe --remove lttng-test
+ modprobe --remove lttng-test
+ modprobe --remove lttng-test
stop_lttng_sessiond
unset LTTNG_HOME
stop_lttng_sessiond
unset LTTNG_HOME
wait $APP_PID 2> /dev/null
wait $APP_PID 2> /dev/null
+ modprobe --remove lttng-test
rm -rf ${consumerd_pipe[@]} 2> /dev/null
}
rm -rf ${consumerd_pipe[@]} 2> /dev/null
}
wait $generator_pid 2> /dev/null
rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
wait $generator_pid 2> /dev/null
rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
+ modprobe --remove lttng-test
}
function test_on_register_evaluation_ust ()
}
function test_on_register_evaluation_ust ()
wait $generator_pid 2> /dev/null
rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
wait $generator_pid 2> /dev/null
rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
+ modprobe --remove lttng-test
}
function test_on_register_evaluation ()
}
function test_on_register_evaluation ()
+ modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
}
stop_lttng_sessiond
stop_lttng_relayd
}
+ modprobe --remove lttng-test
clean_path $TRACE_PATH
done
clean_path $TRACE_PATH
done
+ modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
}
stop_lttng_sessiond
stop_lttng_relayd
}
test_event_wildcard kernel 1 'lttng*test*filter*event'
test_event_wildcard kernel 1 '*lttng*test*filter*event*'
test_event_wildcard kernel 1 'lttng*test*filter*event'
test_event_wildcard kernel 1 '*lttng*test*filter*event*'
+ modprobe --remove lttng-test
if [ -n "$modules" ]; then
diag "Unloading all LTTng modules"
if [ -n "$modules" ]; then
diag "Unloading all LTTng modules"
+ modprobe --remove "$modules"