Re: [PATCH blktests v3 13/13] nvme: Introduce nvmet_target_{setup/cleanup} common code

From: Sagi Grimberg
Date: Thu Aug 17 2023 - 04:34:31 EST



It is very very strange that _setup returns a port
which is passed to _cleanup...

This is the only information the _cleanup helper needs and that is why
it survived the refactoring so far.

Doesn't change the fact that it is awkward.

I think that _cleanup should simply remove all
ports, and that setup should not return a port
to begin with.

This assumes that blktests is the single user and can blindly remove
everything. I would like to play nice here and only cleanup resources
blktests actually allocates.

I suggest that the test records resources that it is using
and destroy them in the cleanup (IIRC Shinichiro did something
similar with the modules in some other place).

If someone needs the actual port number, then it
should either not use this _setup helper or
query it somehow.

I try to figure out how to implement such a query helper then.

That would probably be needed when a test wants to cherry-pick
which stuff it is destroying. But on the other hand, in this
case it also doesn't make sense that this test will be using
the default basic setup function. So I don't think it is
very much needed.