linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: linux-nvme@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	Chaitanya Kulkarni <kch@nvidia.com>,
	Shin'ichiro Kawasaki <shinichiro@fastmail.com>,
	Sagi Grimberg <sagi@grimberg.me>, Hannes Reinecke <hare@suse.de>,
	Daniel Wagner <dwagner@suse.de>
Subject: [PATCH blktests v1] nvme/040: Free loop back resources
Date: Mon, 12 Jun 2023 16:29:45 +0200	[thread overview]
Message-ID: <20230612142945.10969-1-dwagner@suse.de> (raw)

The tests does not cleanup all resources after it has finished. This
leads to rm not being able to remove the TMPDIR cleanly:

  + rm -rf blktests/results/tmpdir.nvme.040.m2J
  rm: cannot remove 'blktests/results/tmpdir.nvme.040.m2J': Directory not empty

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/040 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/nvme/040 b/tests/nvme/040
index b6ab34d611ba..688a0939a376 100755
--- a/tests/nvme/040
+++ b/tests/nvme/040
@@ -18,6 +18,7 @@ requires() {
 
 test() {
 	local subsys="blktests-subsystem-1"
+	local file_path="${TMPDIR}/img"
 	local port
 	local loop_dev
 	local nvmedev
@@ -26,8 +27,8 @@ test() {
 	echo "Running ${TEST_NAME}"
 
 	_setup_nvmet
-	truncate -s "${nvme_img_size}" "$TMPDIR/img"
-	loop_dev="$(losetup -f --show "$TMPDIR/img")"
+	truncate -s "${nvme_img_size}" "${file_path}"
+	loop_dev="$(losetup -f --show "${file_path}")"
 
 	port="$(_create_nvmet_port "${nvme_trtype}")"
 	_create_nvmet_subsystem "${subsys}" "${loop_dev}"
@@ -57,5 +58,9 @@ test() {
 	_remove_nvmet_subsystem "${subsys}"
 	_remove_nvmet_port "${port}"
 
+	losetup -d "${loop_dev}"
+
+	rm -f "${file_path}"
+
 	echo "Test complete"
 }
-- 
2.40.1


             reply	other threads:[~2023-06-12 14:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 14:29 Daniel Wagner [this message]
2023-06-14 11:13 ` [PATCH blktests v1] nvme/040: Free loop back resources Shinichiro Kawasaki
2023-06-14 11:27   ` Daniel Wagner
2023-06-15  2:30     ` Shinichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230612142945.10969-1-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=shinichiro@fastmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).