Skip to contentSkip to conversation

syscalls/fallocate05: Add missing FALLOC_FL_KEEP_SIZE flag

PATCH New Xiao Yang 2 participants 2 messages Jun 7, 2018 – Jun 19, 2018

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 syscalls/fallocate05: Add missing FALLOC_FL_KEEP_SIZE flag

According to fallocate(2) manpage and kernel source code, if fallocate(2) only specify FALLOC_FL_PUNCH_HOLE flag, it always gets EOPNOTSUPP. We should specify both FALLOC_FL_PUNCH_HOLE and FALLOC_FL_KEEP_SIZE.

---
 testcases/kernel/syscalls/fallocate/fallocate05.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/fallocate/fallocate05.c +1 -1
index 1fac26a..a358e67 100644
@@ -69,7 +69,7 @@ static void run(void)
 
 	tst_res(TPASS | TERRNO, "fallocate() on full FS");
 
-	ret = fallocate(fd, FALLOC_FL_PUNCH_HOLE, 0, FALLOCATE_SIZE);
+	ret = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, FALLOCATE_SIZE);
 	if (ret == -1) {
 		if (errno == EOPNOTSUPP)
 			tst_brk(TCONF, "fallocate(FALLOC_FL_PUNCH_HOLE)");
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 syscalls/fallocate05: Add missing FALLOC_FL_KEEP_SIZE flag

----- Original Message -----

Quoted 5 lines

According to fallocate(2) manpage and kernel source code, if fallocate(2) only specify FALLOC_FL_PUNCH_HOLE flag, it always gets EOPNOTSUPP. We should specify both FALLOC_FL_PUNCH_HOLE and FALLOC_FL_KEEP_SIZE.

Pushed.

Thanks,
Jan