From: Dongli Zhang <dongli.zhang@oracle.com>
To: linux-block@vger.kernel.org, osandov@fb.com
Cc: jack@suse.cz
Subject: [PATCH blktests 2/2] loop/001: verify all partitions are removed
Date: Thu, 14 Mar 2019 19:45:17 +0800 [thread overview]
Message-ID: <1552563917-8388-2-git-send-email-dongli.zhang@oracle.com> (raw)
In-Reply-To: <1552563917-8388-1-git-send-email-dongli.zhang@oracle.com>
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.
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()").
. 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
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
next prev parent reply other threads:[~2019-03-14 11:41 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 ` Dongli Zhang [this message]
2019-03-14 17:55 ` [PATCH blktests 2/2] loop/001: verify all partitions are removed Omar Sandoval
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=1552563917-8388-2-git-send-email-dongli.zhang@oracle.com \
--to=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 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).