From 8c407f829ac7b344ba0a8f43eb7b0c0e40b67afa Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 21 Oct 2026 13:46:57 +0200 Subject: [PATCH] selftests/filesystems: check listmount() with a U64_MAX cursor Pass the largest possible mount id as the cursor and check that listmount() returns no entries instead of starting over at the first mount. Link: https://patch.msgid.link/20261021-work-mount-statmount_listns_fixes-v1-4-8917a4c1bd14@kernel.org Signed-off-by: Christian Brauner (Amutable) --- .../selftests/filesystems/statmount/listmount_test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/filesystems/statmount/listmount_test.c b/tools/testing/selftests/filesystems/statmount/listmount_test.c index 8bc82f38c42f..e603525ce17b 100644 --- a/tools/testing/selftests/filesystems/statmount/listmount_test.c +++ b/tools/testing/selftests/filesystems/statmount/listmount_test.c @@ -63,4 +63,15 @@ TEST(listmount_backward) } } +/* A cursor at the largest possible mount id must not wrap around. */ +TEST(listmount_cursor_max) +{ + uint64_t list[LISTMNT_BUFFER]; + ssize_t nr_mounts; + + nr_mounts = listmount(LSMT_ROOT, 0, UINT64_MAX, list, + LISTMNT_BUFFER, 0); + ASSERT_EQ(nr_mounts, 0); +} + TEST_HARNESS_MAIN