Message ID | 1550655486-132008-1-git-send-email-zhengbin13@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [blktests] loop/004: Need to wait for drop caches if block_size is changed | expand |
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!
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"
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(+) -- 2.7.4