public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests 0/3] fix module unload failures
@ 2026-02-23  3:50 Shin'ichiro Kawasaki
  2026-02-23  3:50 ` [PATCH blktests 1/3] check: call _unload_modules for each test run Shin'ichiro Kawasaki
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-02-23  3:50 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Shin'ichiro Kawasaki

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.


Shin'ichiro Kawasaki (3):
  check: call _unload_modules for each test run
  common/rc: introduce _load_module()
  common/nvme: unload nvme modules only when loaded

 check       | 15 ++++++++++++---
 common/nvme | 14 ++++----------
 common/rc   | 12 ++++++++++++
 3 files changed, 28 insertions(+), 13 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-02  0:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23  3:50 [PATCH blktests 0/3] fix module unload failures Shin'ichiro Kawasaki
2026-02-23  3:50 ` [PATCH blktests 1/3] check: call _unload_modules for each test run Shin'ichiro Kawasaki
2026-02-23  3:50 ` [PATCH blktests 2/3] common/rc: introduce _load_module() Shin'ichiro Kawasaki
2026-02-23  3:50 ` [PATCH blktests 3/3] common/nvme: unload nvme modules only when loaded Shin'ichiro Kawasaki
2026-02-24 16:40 ` [PATCH blktests 0/3] fix module unload failures Daniel Wagner
2026-03-02  0:30   ` Shinichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox