[PATCH blktests] loop/004: Need to wait for drop caches if block_size is changed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux