There exists versions of modprobe out there which are so old that
modprobe --help isn't a thing. They're certainly not going to support
modprobe --remove-patiently, so test to make sure modprobe --help
works to avoid causing all tests to fail due to the error message
to stderr showing up in $seq.out.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fixes: 405c21d40aa1 ("common/module: add patient module rmmod support")
Reported-by: Leah Rumancik <leah.rumancik@gmail.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
# Set MODPROBE_PATIENT_RM_TIMEOUT_SECONDS to "forever" if you want the patient
# modprobe removal to run forever trying to remove a module.
MODPROBE_REMOVE_PATIENT=""
-modprobe --help | grep -q -1 "remove-patiently"
+modprobe --help >& /dev/null && modprobe --help | grep -q -1 "remove-patiently"
if [[ $? -ne 0 ]]; then
if [[ -z "$MODPROBE_PATIENT_RM_TIMEOUT_SECONDS" ]]; then
# We will open code our own implementation of patient module