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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 13, 2023 at 05:55:48PM +0300, Sagi Grimberg wrote:
> > --- a/tests/nvme/003
> > +++ b/tests/nvme/003
> > @@ -22,15 +22,9 @@ test() {
> >   	_setup_nvmet
> > -	local loop_dev
> >   	local port
> > -	port="$(_create_nvmet_port "${nvme_trtype}")"
> > -
> > -	loop_dev="$(losetup -f)"
> > -
> > -	_create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}"
> > -	_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
> > +	port="$(_nvmet_target_setup --blkdev=device)"
> >   	_nvme_connect_subsys "${nvme_trtype}" nqn.2014-08.org.nvmexpress.discovery
> > @@ -46,9 +40,8 @@ test() {
> >   	fi
> >   	_nvme_disconnect_subsys nqn.2014-08.org.nvmexpress.discovery
> > -	_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
> > -	_remove_nvmet_subsystem "${def_subsysnqn}"
> > -	_remove_nvmet_port "${port}"
> > +
> > +	_nvmet_target_cleanup "${port}"
> 
> 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.

> 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.

> 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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux