[LTP] fanotify13: fix test failure when running iterations

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Mon Jun 1 06:11:39 CEST 2026


Hi AnonymeMeow,

Thank you for the patch. One issue below.

> fanotify13: fix test failure when running iterations
>
> The FAN_DELETE_SELF test case removes test files, causing later
> iterations to crash. Recreate the removed files after the test to
> restore the expected initial state. And adjust the overlayfs mount
> timing to avoid creating files directly in the filesystem underneath
> the already mounted overlayfs.

The commit body describes two of the three meaningful changes in this
patch but omits the do_cleanup() fixes, which are a significant part
of the fix.

In do_cleanup(), the patch:
  1. Moves SAFE_UMOUNT(OVL_MNT) before the bind_mounted block (old
     ordering could leave the overlay mounted when clearing the bind
     mount in some mount stacking scenarios).
  2. Adds delete_objects() before unmounting MOUNT_PATH (ensures test
     files are removed from OVL_LOWER/OVL_UPPER so a persistent
     device does not carry stale state into the next iteration).

These are real correctness fixes that belong in the commit description.

Please expand the body to cover all three changes.

---

The code changes themselves look correct:

  * The new macros TST_VARIANT_OVL_LOWER = (tst_variant & 1) and
    TST_VARIANT_OVL_WATCH = (tst_variant > 2) faithfully replace the
    open-coded expressions and improve readability.

  * Moving TST_MOUNT_OVERLAY() after create_objects() is the right
    fix: objects are now created in OVL_LOWER before the overlay is
    stacked on top, avoiding undefined behaviour when modifying a
    lower directory while overlay is already mounted.

  * clean_upper_dir() correctly uses SAFE_UNLINK() for all objects
    (including the directory). After SAFE_RMDIR() on a lower-only
    directory through overlayfs, the kernel writes a char-device
    whiteout (0:0) to OVL_UPPER at that path — not an opaque
    directory — so SAFE_UNLINK() succeeds. The function is only
    reachable via variant 3 (variant 1's FAN_DELETE_SELF path is
    always TCONF'd by the "base fs cannot be watched for delete self
    events" guard), so this assumption always holds.

  * The new do_cleanup() ordering — ovl_bind → OVL_MNT → bind — is
    correct. For variant 3 after clean_upper_dir() the mounts are
    re-stacked identically to the post-setup state, so cleanup
    unwinds them in the right order.

Verdict: Needs revision (commit message only).

LTP AI Reviewer


More information about the ltp mailing list