From: linuxtestproject.agent@gmail.com
To: Amir Goldstein <amir73il@gmail.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] fanotify27: Test FAN_DELETE_SELF on unlinked hardlinked open file
Date: Fri, 13 Nov 2026 18:18:28 +0000 [thread overview]
Message-ID: <20261113181828.5184-1-linuxtestproject.agent@gmail.com> (raw)
In-Reply-To: <20261113175119.455908-1-amir73il@gmail.com>
Hi Amir,
On Fri Nov 13 18:51:18 2026 +0100, Amir Goldstein <amir73il@gmail.com> wrote:
> fanotify27: Test FAN_DELETE_SELF on unlinked hardlinked open file
> + * Before the fix, the unlink of the last link reported FAN_DELETE_SELF and
> + * removed all the inode marks of the still open inode, so the write to the
> + * open file did not report FAN_MODIFY. Closing the file then reported a
> + * second FAN_DELETE_SELF event.
> + */
Document why .needs_root = 1 is required in the /*\ ... */ comment block
(mounting the test filesystem and using FAN_MARK_FILESYSTEM).
> + while ((len = read(fanotify_fd, buf, sizeof(buf))) > 0) {
> + for (metadata = (struct fanotify_event_metadata *)buf;
> + FAN_EVENT_OK(metadata, len);
> + metadata = FAN_EVENT_NEXT(metadata, len)) {
> + if (!event_matches_victim(metadata))
> + continue;
> + if (metadata->mask & FAN_DELETE_SELF)
> + (*delete_self)++;
> + if (metadata->mask & FAN_MODIFY)
> + (*modify)++;
> + }
> + }
> +
> + if (len < 0 && errno != EAGAIN)
> + tst_brk(TBROK | TERRNO, "read(fanotify_fd) failed");
Use SAFE_READ(SAFE_READ_ANY_EAGAIN, fanotify_fd, buf, sizeof(buf)) in the
while condition and drop the manual errno != EAGAIN check.
> +static void cleanup(void)
> +{
> + if (file_fd >= 0)
> + SAFE_CLOSE(file_fd);
> + if (fanotify_fd >= 0)
> + SAFE_CLOSE(fanotify_fd);
> +}
Use file_fd != -1 and fanotify_fd != -1 to check file descriptor validity.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-11-13 18:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 17:51 [LTP] [PATCH] fanotify27: Test FAN_DELETE_SELF on unlinked hardlinked open file Amir Goldstein
2026-11-13 18:18 ` linuxtestproject.agent [this message]
2026-11-16 11:18 ` Jan Kara
2026-12-01 14:44 ` Petr Vorel
2026-12-01 15:27 ` Amir Goldstein
2026-12-01 15:37 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261113181828.5184-1-linuxtestproject.agent@gmail.com \
--to=linuxtestproject.agent@gmail.com \
--cc=amir73il@gmail.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.