[PATCH blktests 0/3] fix module unload failures

Daniel Wagner dwagner at suse.de
Tue Feb 24 08:40:33 PST 2026


On Mon, Feb 23, 2026 at 12:50:20PM +0900, Shin'ichiro Kawasaki wrote:
> Since the recent commit 7c3ad92d3d8f ("check: check reference count for
> modprobe --remove --wait success case"), the test case nvme/060 started
> printing the error message below:
> 
>   modprobe with --wait option succeeded but still nvmet has references
> 
> This error indicates that the nvmet modules failed to unload as
> expected. While the root cause has existed for a long time, the trigger
> commit exposed the problem. I took a look in the failure, and observed
> the failure scenario as follows:
> 
> - The failure occurs when the test case is executed multiple times for
>   different transport types. At the first step, nvme/060 is executed for
>   the loop transport. Although nvme/060 was not designed to run for this
>   transport type, its requirement check leaves two modules loaded: nvmet
>   and nvme-loop.
> 
> - At the second step, when nvme/060 is executed for the rdma transport,
>   the helper function _setup_nvmet() loads the nvmet-rdma module for
>   testing. After the test completes, the helper function
>   _cleanup_nvmet() attempts to unload the nvmet-rdma and nvmet modules.
>   While it succeeds to unload the nvmet-rdma module, it fails to unload
>   the nvmet module because the nvme-loop module is still using the nvmet
>   module. Hence the error message.
> 
> From these observations, I identified two problems below.
> 
> 1) The requirement check for the loop transport left the nvmet and nvme-
>    loop modules loaded and it affected the following test. In the
>    current implementation, the helper function _unload_modules() is
>    called once, only after nvme/060 has been executed for all specified
>    transport types. Instead, _unload_modules() should be called after
>    each run of test test case for every transport. This ensures that the
>    modules loaded for the requirement check are unloaded.
> 
> 2) When _setup_nvmet() does not load the nvmet module, there is no need
>    for _cleanup_nvmet() to attempts to unload it. _cleanup_nvmet()
>    should unload a module only if it was loaded by _setup_nvmet().
> 
> This series addresses these two problems. The first patch fixes the
> first problem. The other two patches fix the second problem.

Looks good to me.

Reviewed-by: Daniel Wagner <dwagner at suse.de>



More information about the Linux-nvme mailing list