[LTP] [PATCH] ioctl_loop06: Update block size validation to align with kver
Li Wang
liwang@redhat.com
Mon Mar 10 10:47:45 CET 2025
The kernel commit 47dd6753 ("block/bdev: lift block size restrictions to 64k")
now supports block sizes larger than PAGE_SIZE, with a new upper limit of
BLK_MAX_BLOCK_SIZE (64K). But ioctl_loop06 still assumes that PAGE_SIZE is the
maximum allowed block size, causing failures on newer kernels (>= 6.14):
ioctl_loop06.c:74: TINFO: Using LOOP_SET_BLOCK_SIZE with arg > PAGE_SIZE
ioctl_loop06.c:57: TFAIL: Set block size succeed unexpectedly
...
ioctl_loop06.c:74: TINFO: Using LOOP_CONFIGURE with block_size > PAGE_SIZE
ioctl_loop06.c:57: TFAIL: Set block size succeed unexpectedly
This patch updates ioctl_loop06 to use BLK_MAX_BLOCK_SIZE instead of PAGE_SIZE
for block size validation. Also adjust failure expectations based on the
running kernel version.
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/syscalls/ioctl/ioctl_loop06.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c b/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
index 573871bc1..321754108 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
@@ -17,6 +17,8 @@
#include "lapi/loop.h"
#include "tst_test.h"
+#define BLK_MAX_BLOCK_SIZE 0x00010000 /* SZ_64K */
+
static char dev_path[1024];
static int dev_num, dev_fd, file_fd, attach_flag, loop_configure_sup = 1;
static unsigned int invalid_value, half_value, unalign_value;
@@ -31,7 +33,7 @@ static struct tcase {
"Using LOOP_SET_BLOCK_SIZE with arg < 512"},
{&invalid_value, LOOP_SET_BLOCK_SIZE,
- "Using LOOP_SET_BLOCK_SIZE with arg > PAGE_SIZE"},
+ "Using LOOP_SET_BLOCK_SIZE with arg > BLK_MAX_BLOCK_SIZE"},
{&unalign_value, LOOP_SET_BLOCK_SIZE,
"Using LOOP_SET_BLOCK_SIZE with arg != power_of_2"},
@@ -40,7 +42,7 @@ static struct tcase {
"Using LOOP_CONFIGURE with block_size < 512"},
{&invalid_value, LOOP_CONFIGURE,
- "Using LOOP_CONFIGURE with block_size > PAGE_SIZE"},
+ "Using LOOP_CONFIGURE with block_size > BLK_MAX_BLOCK_SIZE"},
{&unalign_value, LOOP_CONFIGURE,
"Using LOOP_CONFIGURE with block_size != power_of_2"},
@@ -106,8 +108,8 @@ static void setup(void)
tst_fill_file("test.img", 0, 1024, 1024);
half_value = 256;
pg_size = getpagesize();
- invalid_value = pg_size * 2 ;
unalign_value = pg_size - 1;
+ invalid_value = (tst_kvercmp(6, 14, 0) < 0) ? pg_size * 2 : BLK_MAX_BLOCK_SIZE + 1;
dev_fd = SAFE_OPEN(dev_path, O_RDWR);
ret = ioctl(dev_fd, LOOP_SET_BLOCK_SIZE, 512);
--
2.48.1
More information about the ltp
mailing list