linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests v1] nvme/040: Free loop back resources
@ 2023-06-12 14:29 Daniel Wagner
  2023-06-14 11:13 ` Shinichiro Kawasaki
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Wagner @ 2023-06-12 14:29 UTC (permalink / raw)
  To: linux-nvme
  Cc: linux-kernel, linux-block, Chaitanya Kulkarni,
	Shin'ichiro Kawasaki, Sagi Grimberg, Hannes Reinecke,
	Daniel Wagner

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


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

* Re: [PATCH blktests v1] nvme/040: Free loop back resources
  2023-06-12 14:29 [PATCH blktests v1] nvme/040: Free loop back resources Daniel Wagner
@ 2023-06-14 11:13 ` Shinichiro Kawasaki
  2023-06-14 11:27   ` Daniel Wagner
  0 siblings, 1 reply; 4+ messages in thread
From: Shinichiro Kawasaki @ 2023-06-14 11:13 UTC (permalink / raw)
  To: Daniel Wagner
  Cc: linux-nvme, linux-kernel, linux-block, Chaitanya Kulkarni,
	Shin'ichiro Kawasaki, Sagi Grimberg, Hannes Reinecke

On Jun 12, 2023 / 16:29, Daniel Wagner wrote:
> 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>

Hi Daniel, thanks for the patch. It looks good to me. Now the test case leaves a
loop device. This patch avoids it. Good.

Question, I do not observe the rm command failure in my test environments. Do
you have insight why you were able to find the failure?

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

* Re: [PATCH blktests v1] nvme/040: Free loop back resources
  2023-06-14 11:13 ` Shinichiro Kawasaki
@ 2023-06-14 11:27   ` Daniel Wagner
  2023-06-15  2:30     ` Shinichiro Kawasaki
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Wagner @ 2023-06-14 11:27 UTC (permalink / raw)
  To: Shinichiro Kawasaki
  Cc: linux-nvme, linux-kernel, linux-block, Chaitanya Kulkarni,
	Shin'ichiro Kawasaki, Sagi Grimberg, Hannes Reinecke

On Wed, Jun 14, 2023 at 11:13:18AM +0000, Shinichiro Kawasaki wrote:
> On Jun 12, 2023 / 16:29, Daniel Wagner wrote:
> > 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>
> 
> Hi Daniel, thanks for the patch. It looks good to me. Now the test case leaves a
> loop device. This patch avoids it. Good.
> 
> Question, I do not observe the rm command failure in my test environments. Do
> you have insight why you were able to find the failure?

I am running the tests inside a VM and I am sharing a part of my host filesystem
via NFS which contain the blktests. If I understood it correctly, the NFS server
is behaving slightly differently here. I can't observe it either with xfs or
btrfs.

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

* Re: [PATCH blktests v1] nvme/040: Free loop back resources
  2023-06-14 11:27   ` Daniel Wagner
@ 2023-06-15  2:30     ` Shinichiro Kawasaki
  0 siblings, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2023-06-15  2:30 UTC (permalink / raw)
  To: Daniel Wagner
  Cc: linux-nvme, linux-kernel, linux-block, Chaitanya Kulkarni,
	Shin'ichiro Kawasaki, Sagi Grimberg, Hannes Reinecke

On Jun 14, 2023 / 13:27, Daniel Wagner wrote:
> On Wed, Jun 14, 2023 at 11:13:18AM +0000, Shinichiro Kawasaki wrote:
> > On Jun 12, 2023 / 16:29, Daniel Wagner wrote:
> > > 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>
> > 
> > Hi Daniel, thanks for the patch. It looks good to me. Now the test case leaves a
> > loop device. This patch avoids it. Good.
> > 
> > Question, I do not observe the rm command failure in my test environments. Do
> > you have insight why you were able to find the failure?
> 
> I am running the tests inside a VM and I am sharing a part of my host filesystem
> via NFS which contain the blktests. If I understood it correctly, the NFS server
> is behaving slightly differently here. I can't observe it either with xfs or
> btrfs.

I see, the NFS sounds triggering the failure. I've applied the patch. Thanks!

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

end of thread, other threads:[~2023-06-15  2:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 14:29 [PATCH blktests v1] nvme/040: Free loop back resources Daniel Wagner
2023-06-14 11:13 ` Shinichiro Kawasaki
2023-06-14 11:27   ` Daniel Wagner
2023-06-15  2: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;
as well as URLs for NNTP newsgroup(s).