Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] ioctl_loop06: update loopback block size validation
@ 2025-03-13  9:24 Li Wang
  2025-03-13 22:59 ` Luis Chamberlain via ltp
  0 siblings, 1 reply; 12+ messages in thread
From: Li Wang @ 2025-03-13  9:24 UTC (permalink / raw)
  To: ltp; +Cc: Luis Chamberlain, Christoph Hellwig, Hannes Reinecke

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.

And, we give up the test size between (PAGE_SIZE, BLK_MAX_BLOCK_SIZE) even on
old kernels becase it makes no sense.

Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
---
 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..238a7c6f5 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,7 +108,7 @@ static void setup(void)
 	tst_fill_file("test.img", 0, 1024, 1024);
 	half_value = 256;
 	pg_size = getpagesize();
-	invalid_value = pg_size * 2 ;
+	invalid_value = BLK_MAX_BLOCK_SIZE + 1;
 	unalign_value = pg_size - 1;
 
 	dev_fd = SAFE_OPEN(dev_path, O_RDWR);
-- 
2.48.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2025-04-11 10:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13  9:24 [LTP] [PATCH v2] ioctl_loop06: update loopback block size validation Li Wang
2025-03-13 22:59 ` Luis Chamberlain via ltp
2025-03-14  2:24   ` Li Wang
2025-03-14  2:31     ` [LTP] [PATCH v3] " Li Wang
2025-03-14 11:58       ` [LTP] [PATCH v4] " Li Wang
2025-03-14 13:48         ` Petr Vorel
2025-04-11  8:38         ` Avinesh Kumar
2025-04-11 10:08           ` Li Wang via ltp
2025-03-14  5:52     ` [LTP] [PATCH v2] " Luis Chamberlain via ltp
2025-03-14  5:57       ` Luis Chamberlain via ltp
2025-03-14  6:49         ` Li Wang
2025-03-14  6:47       ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox