All of lore.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: linux-block@vger.kernel.org, osandov@fb.com, jack@suse.cz
Subject: Re: [PATCH blktests 2/2] loop/001: verify all partitions are removed
Date: Thu, 14 Mar 2019 10:55:33 -0700	[thread overview]
Message-ID: <20190314175533.GC11825@vader> (raw)
In-Reply-To: <1552563917-8388-2-git-send-email-dongli.zhang@oracle.com>

On Thu, Mar 14, 2019 at 07:45:17PM +0800, Dongli Zhang wrote:
> loop/001 does not test whether all partitions are removed successfully
> during loop device partition scanning. As a result, the regression
> introduced by 0da03cab87e6 ("loop: Fix deadlock when calling
> blkdev_reread_part()") can not be detected.
> 
> The regression will generate below message in dmesg:
> 
> [  464.414043] __loop_clr_fd: partition scan of loop0 failed (rc=-22)
> 
> and leave orphan partitions like below:
> 
> - /dev/loop0p1
> - /sys/block/loop0/loop0p1
> 
> This patch verifies all partitions are removed by checking if there is
> /sys/block/loopX/loopXpY left. The expected number of partitions left is 0.

Thanks for the test! A couple of comments below.

> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
> ---
>  tests/loop/001     | 5 +++++
>  tests/loop/001.out | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/tests/loop/001 b/tests/loop/001
> index 47f760a..a0326b7 100755
> --- a/tests/loop/001
> +++ b/tests/loop/001
> @@ -4,6 +4,9 @@
>  #
>  # Test loop device partition scanning. Regression test for commit e02898b42380
>  # ("loop: fix LO_FLAGS_PARTSCAN hang").
> +#
> +# Test loop device paritition scanning. Regression test for commit 758a58d0bc67
> +# ("loop: set GENHD_FL_NO_PART_SCAN after blkdev_reread_part()").

These can just be combined to

# Test loop device partition scanning. Regression test for commits e02898b42380
# ("loop: fix LO_FLAGS_PARTSCAN hang") and 758a58d0bc67 ("loop: set
# GENHD_FL_NO_PART_SCAN after blkdev_reread_part()").

>  . tests/loop/rc
>  
> @@ -24,9 +27,11 @@ test() {
>  		mkpart primary 50% 100%
>  
>  	loop_device="$(losetup -P -f --show "$TMPDIR/img")"
> +	loop_name=${loop_device:5}
>  	lsblk -ln "$loop_device" | wc -l
>  
>  	losetup -d "$loop_device"
> +	ls /sys/block/$loop_name | grep loop | wc -l

We can just repeat the same `lsblk -ln "$loop_device" | wc -l` from
earlier, right? That's a bit cleaner than the hardcoded string slicing
and ls.

>  	rm "$TMPDIR/img"
>  	echo "Test complete"
>  }
> diff --git a/tests/loop/001.out b/tests/loop/001.out
> index 75979f0..8c4917f 100644
> --- a/tests/loop/001.out
> +++ b/tests/loop/001.out
> @@ -1,3 +1,4 @@
>  Running loop/001
>  3
> +0
>  Test complete
> -- 
> 2.7.4
> 

  reply	other threads:[~2019-03-14 17:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 11:45 [PATCH blktests 1/2] loop/001: fix typo 'paritition' to 'partition' Dongli Zhang
2019-03-14 11:45 ` [PATCH blktests 2/2] loop/001: verify all partitions are removed Dongli Zhang
2019-03-14 17:55   ` Omar Sandoval [this message]
2019-03-15  2:00     ` Dongli Zhang
2019-03-21 23:26       ` Omar Sandoval
2019-03-22  2:23         ` Dongli Zhang
2019-03-25 17:32           ` Omar Sandoval

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=20190314175533.GC11825@vader \
    --to=osandov@osandov.com \
    --cc=dongli.zhang@oracle.com \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=osandov@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.