Re: [PATCH blktests v1 2/5] nvme/rc: filter out errors from cat when reading files

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

 



On Feb 06, 2024 / 14:16, Daniel Wagner wrote:
> When running the tests with FC as transport and the udev auto connect
> enabled, discovery controllers are created and destroys while the tests

Nit: maybe you meant "destroyed" or "destroy" instead of "destroys".

> are running. This races with the cleanup code and also the
> _find_nvme_dev() which iterates over all device entries and tries to
> read the connect of transport and subsysnqn sysfs attributes. Since
> these steps are not locked in anyway, the resources can go away in
> between.
> 
> Thus filter out 'cat' reporting non existing subsysnqn or transport
> attributes. The tests will still fail if they can't fine the device etc.

Nit: s/fine/find/

> But without filtering these errors out the tests fail randomly.
> 
> Signed-off-by: Daniel Wagner <dwagner@xxxxxxx>
> ---
>  tests/nvme/rc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index e0461f1cd53a..9cc83afe0668 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -350,7 +350,7 @@ _cleanup_nvmet() {
>  
>  	for dev in /sys/class/nvme/nvme*; do
>  		dev="$(basename "$dev")"
> -		transport="$(cat "/sys/class/nvme/${dev}/transport")"
> +		transport="$(cat "/sys/class/nvme/${dev}/transport" 2>/dev/null)"
>  		if [[ "$transport" == "${nvme_trtype}" ]]; then
>  			echo "WARNING: Test did not clean up ${nvme_trtype} device: ${dev}"
>  			_nvme_disconnect_ctrl "${dev}"
> @@ -840,7 +840,7 @@ _find_nvme_dev() {
>  	for dev in /sys/class/nvme/nvme*; do
>  		[ -e "$dev" ] || continue
>  		dev="$(basename "$dev")"
> -		subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn")"
> +		subsysnqn="$(cat "/sys/class/nvme/${dev}/subsysnqn" 2>/dev/null)"
>  		if [[ "$subsysnqn" == "$subsys" ]]; then
>  			echo "$dev"
>  		fi
> -- 
> 2.43.0
> 




[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