Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: close fd on write error
@ 2026-05-20  2:03 Wei Yang
  2026-05-20  3:51 ` Dev Jain
  2026-05-21  0:54 ` SeongJae Park
  0 siblings, 2 replies; 6+ messages in thread
From: Wei Yang @ 2026-05-20  2:03 UTC (permalink / raw)
  To: akpm, david, ljs; +Cc: linux-mm, linux-kselftest, Wei Yang

When create_pagecache_thp_and_fd() write returns error on
/proc/sys/vm/dropcache, it just "goto err_out_unlink", which left fd
still open.

Use "goto err_out_close" to close the fd.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 tools/testing/selftests/mm/split_huge_page_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index 460fa1f606fd..f30402ece608 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -469,7 +469,7 @@ static int create_pagecache_thp_and_fd(const char *testfile, size_t fd_size,
 	}
 	if (write(*fd, "3", 1) != 1) {
 		ksft_perror("write to drop_caches");
-		goto err_out_unlink;
+		goto err_out_close;
 	}
 	close(*fd);
 
-- 
2.34.1


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

end of thread, other threads:[~2026-05-24  1:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20  2:03 [PATCH] selftests/mm: close fd on write error Wei Yang
2026-05-20  3:51 ` Dev Jain
2026-05-20  9:38   ` Wei Yang
2026-05-22  0:49     ` Andrew Morton
2026-05-24  1:48       ` Wei Yang
2026-05-21  0:54 ` SeongJae Park

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