git: 3861fe8ba8c9 - stable/13 - path_test: Correct the kevent test
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 20 Apr 2022 14:31:01 UTC
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3861fe8ba8c96e52a7f3870cd723d14a54db4d76 commit 3861fe8ba8c96e52a7f3870cd723d14a54db4d76 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-04-18 15:45:45 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-04-20 14:15:06 +0000 path_test: Correct the kevent test Perhaps surprisingly, and contrary to the expectations of path_test:path_event, NOTE_LINK events are not raised when a file is unlinked. Prior to commit bf13db086b84, the test happened to work because unlinking the file would cause the vnode to be recycled, and EVFILT_VNODE knotes deliver an event with EV_EOF set when the vnode is doomed. Since the test did not verify the note type, the test succeeded. After commit bf13db086b84, the vnode is not recycled after being unlinked and so the test hangs. Fix the test by waiting for NOTE_DELETE instead, and check that we got the note that we expected. Reported by: Jenkins Sponsored by: The FreeBSD Foundation (cherry picked from commit 333f668468f0675e1e001f6fcc506e901e58c36e) --- tests/sys/file/path_test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index a39862cc78d6..b4411b67f26d 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -452,14 +452,17 @@ ATF_TC_BODY(path_event, tc) ATF_REQUIRE_MSG(kevent(kq, &ev, 1, NULL, 0, NULL) == 0, FMT_ERR("kevent")); - /* Try to get a EVFILT_VNODE/NOTE_LINK event through a path fd. */ - EV_SET(&ev, pathfd, EVFILT_VNODE, EV_ADD | EV_ENABLE, NOTE_LINK, 0, 0); + /* Try to get a EVFILT_VNODE/NOTE_DELETE event through a path fd. */ + EV_SET(&ev, pathfd, EVFILT_VNODE, EV_ADD | EV_ENABLE, NOTE_DELETE, 0, + 0); ATF_REQUIRE_MSG(kevent(kq, &ev, 1, NULL, 0, NULL) == 0, FMT_ERR("kevent")); ATF_REQUIRE_MSG(funlinkat(AT_FDCWD, path, pathfd, 0) == 0, FMT_ERR("funlinkat")); ATF_REQUIRE_MSG(kevent(kq, NULL, 0, &ev, 1, NULL) == 1, FMT_ERR("kevent")); + ATF_REQUIRE_MSG(ev.fflags == NOTE_DELETE, + "unexpected fflags %#x", ev.fflags); EV_SET(&ev, pathfd, EVFILT_VNODE, EV_DELETE, 0, 0, 0); ATF_REQUIRE_MSG(kevent(kq, &ev, 1, NULL, 0, NULL) == 0, FMT_ERR("kevent"));