linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests] loop/004: Need to wait for drop caches if block_size is changed
@ 2019-02-20  9:38 zhengbin
  2019-02-20 19:36 ` Omar Sandoval
  0 siblings, 1 reply; 2+ messages in thread
From: zhengbin @ 2019-02-20  9:38 UTC (permalink / raw)
  To: linux-block, osandov; +Cc: yangerkun, houtao1, yanaijie

When i test blktests, loop/004 will be fail. The Key test steps
are as follows:
1. losetup -f --show  /dev/sda
2. src/loblksize /dev/loop0 4096

step 1 will create /dev/loop0. after that, daemon systemd-udevd
will visit and close /dev/loop0 who will add and delete
i_mapping->nrpages.
PS: the operation of systemd-udevd is in the background.

step 2 will set /dev/loop0 block size, linux kernel function
loop_set_block_size has been changed since commit 5db470e229e2
("loop: drop caches if offset or block_size are changed")
+ if (lo->lo_queue->limits.logical_block_size != arg &&
+     lo->lo_device->bd_inode->i_mapping->nrpages) {
+               err = -EAGAIN;
+               pr_warn("%s: loop%d (%s) has still dirty pages\n",
+                       __func__, lo->lo_number, lo->lo_file_name,
+                       lo->lo_device->bd_inode->i_mapping->nrpages);
+               goto out_unfreeze;
+       }
--->maybe systemd-udevd just visited /dev/loop0, this leads to failure

Add a step between 1 and 2.

Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
 tests/loop/004 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/loop/004 b/tests/loop/004
index 363fb5e..fab34e8 100755
--- a/tests/loop/004
+++ b/tests/loop/004
@@ -28,6 +28,7 @@ test() {
 		return 1
 	fi

+	udevadm settle
 	src/loblksize "$loop_dev" 4096
 	losetup --direct-io=on "$loop_dev"
 	cat "/sys/block/${loop_dev#/dev/}/loop/dio"
--
2.7.4


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

* Re: [PATCH blktests] loop/004: Need to wait for drop caches if block_size is changed
  2019-02-20  9:38 [PATCH blktests] loop/004: Need to wait for drop caches if block_size is changed zhengbin
@ 2019-02-20 19:36 ` Omar Sandoval
  0 siblings, 0 replies; 2+ messages in thread
From: Omar Sandoval @ 2019-02-20 19:36 UTC (permalink / raw)
  To: zhengbin; +Cc: linux-block, osandov, yangerkun, houtao1, yanaijie

On Wed, Feb 20, 2019 at 05:38:06PM +0800, zhengbin wrote:
> When i test blktests, loop/004 will be fail. The Key test steps
> are as follows:
> 1. losetup -f --show  /dev/sda
> 2. src/loblksize /dev/loop0 4096
> 
> step 1 will create /dev/loop0. after that, daemon systemd-udevd
> will visit and close /dev/loop0 who will add and delete
> i_mapping->nrpages.
> PS: the operation of systemd-udevd is in the background.
> 
> step 2 will set /dev/loop0 block size, linux kernel function
> loop_set_block_size has been changed since commit 5db470e229e2
> ("loop: drop caches if offset or block_size are changed")
> + if (lo->lo_queue->limits.logical_block_size != arg &&
> +     lo->lo_device->bd_inode->i_mapping->nrpages) {
> +               err = -EAGAIN;
> +               pr_warn("%s: loop%d (%s) has still dirty pages\n",
> +                       __func__, lo->lo_number, lo->lo_file_name,
> +                       lo->lo_device->bd_inode->i_mapping->nrpages);
> +               goto out_unfreeze;
> +       }
> --->maybe systemd-udevd just visited /dev/loop0, this leads to failure
> 
> Add a step between 1 and 2.
> 
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
>  tests/loop/004 | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks!

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

end of thread, other threads:[~2019-02-20 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-20  9:38 [PATCH blktests] loop/004: Need to wait for drop caches if block_size is changed zhengbin
2019-02-20 19:36 ` Omar Sandoval

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).