[LTP] [PATCH v2] statx09: Set fs-verity blocksize to FS blocksize
Martin Doucha
mdoucha@suse.cz
Fri Jul 14 13:42:02 CEST 2023
The kernel requires that fs-verity blocksize must be at most equal
to the filesystem blocksize. Testing on small loop device means that
mkfs.ext4 will very likely default to blocksize of 1024. Set fs-verity
blocksize to the filesystem blocksize to avoid errors.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
Setting filesystem blocksize to pagesize would require moving the mkfs
command to setup(). We can do that later to fix support for kernels
before v6.3 but let's fix the failure on latest kernel version first.
testcases/kernel/syscalls/statx/statx09.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/statx/statx09.c b/testcases/kernel/syscalls/statx/statx09.c
index c03d2c91e..7211d8393 100644
--- a/testcases/kernel/syscalls/statx/statx09.c
+++ b/testcases/kernel/syscalls/statx/statx09.c
@@ -80,8 +80,10 @@ static void flag_setup(void)
{
int fd, attr, ret;
struct fsverity_enable_arg enable;
+ struct stat statbuf;
fd = SAFE_OPEN(TESTFILE_FLAGGED, O_RDONLY, 0664);
+ SAFE_FSTAT(fd, &statbuf);
ret = ioctl(fd, FS_IOC_GETFLAGS, &attr);
if (ret < 0) {
@@ -94,7 +96,7 @@ static void flag_setup(void)
memset(&enable, 0, sizeof(enable));
enable.version = 1;
enable.hash_algorithm = hash_algorithms[0];
- enable.block_size = 4096;
+ enable.block_size = statbuf.st_blksize;
enable.salt_size = 0;
enable.salt_ptr = (intptr_t)NULL;
enable.sig_size = 0;
--
2.41.0
More information about the ltp
mailing list