{
  "slug": "inotify",
  "term": "inotify",
  "aliases": [
    "Linux filesystem event notification"
  ],
  "definition": "inotify is a Linux interface that queues selected filesystem notifications for explicitly watched files or directories.",
  "note": "Observation limits: mapped changes can occur without modification events, and directory watches do not recursively cover subdirectories. An unread sequence of identical events can coalesce, so event counts are not operation counts. Queue overflow requires recovery of potentially stale application state. [inotify-api]\n\nWritable closure: IN_CLOSE_WRITE identifies a close associated with write access, not a byte comparison. The Linux v6.8 fsnotify_close hook selects the event from FMODE_WRITE. [close-hook]\n\nMeasured controls: Hesela observed one event for 32 unread pwrite notifications, but 32 when reading the queue after each call. Shared mapped stores changed the file without IN_MODIFY; closing an unchanged writable file still produced IN_CLOSE_WRITE. These one-host checks are not a backup-product evaluation. [hesela-inotify]\n\nReconciliation scope: a live rescan is not inherently a point-in-time inventory; see directory enumeration and Hesela's separate ordered-rename experiment. [hesela-inotify]\n\nShared ownership: hard-link aliases in one instance reuse a watch; another registration can replace its mask. IN_MASK_ADD unions interests, but removal or IN_ONESHOT can end the shared watch. IN_MASK_CREATE rejects reuse with EEXIST. [inotify-api] [inotify-add-ownership] [inotify-remove-ownership]\n\nShared readers: dup shares queue consumption; separate initializations create separate queues. A shared watcher needs subscriber accounting and event fan-out. [inotify-dup-ownership] [inotify-init-ownership]\n\nLibrary scope: in native fsnotify v1.10.1 Linux controls, a WRITE event's retained name resolved to a replacement inode, not the changed hard-linked file. Earlier CHMOD was delivered. [fsnotify-evidence]",
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-21",
  "advantages": [
    "Can trigger inspection of selected files without repeatedly scanning every path."
  ],
  "limitations": [
    "A notification stream alone does not establish complete or application-consistent backup capture.",
    "IN_EXCL_UNLINK filters notifications through an unlinked entry, even with another hard link; it does not retract an earlier queued MODIFY. A later name lookup can reach a replacement inode. [unlinked-dispatch] [unlinked-dentry] [unlinked-evidence]"
  ],
  "related": [
    "memory-mapped-file",
    "incremental-backup",
    "backup-verification",
    "snapshot",
    "directory-enumeration",
    "watchman-clock",
    "fanotify",
    "hard-link",
    "inode",
    "open-file-description",
    "file-descriptor",
    "viewbox",
    "spyglass"
  ],
  "citations": [
    {
      "id": "inotify-api",
      "title": "Linux man-pages 6.19: inotify(7)",
      "url": "https://man7.org/linux/man-pages/man7/inotify.7.html",
      "accessed": "2026-10-19"
    },
    {
      "id": "close-hook",
      "title": "Linux v6.8: fsnotify_close in include/linux/fsnotify.h",
      "url": "https://github.com/torvalds/linux/blob/v6.8/include/linux/fsnotify.h",
      "accessed": "2026-10-19"
    },
    {
      "id": "hesela-inotify",
      "title": "Hesela: What inotify misses: mapped writes and collapsed change events",
      "url": "https://hesela.com/analyses/inotify-change-detection/",
      "accessed": "2026-10-19"
    },
    {
      "id": "inotify-add-ownership",
      "title": "Linux man-pages 6.19: inotify_add_watch(2)",
      "url": "https://man7.org/linux/man-pages/man2/inotify_add_watch.2.html",
      "accessed": "2026-11-20"
    },
    {
      "id": "inotify-remove-ownership",
      "title": "Linux man-pages 6.19: inotify_rm_watch(2)",
      "url": "https://man7.org/linux/man-pages/man2/inotify_rm_watch.2.html",
      "accessed": "2026-11-20"
    },
    {
      "id": "inotify-dup-ownership",
      "title": "Linux man-pages 6.19: dup(2)",
      "url": "https://man7.org/linux/man-pages/man2/dup.2.html",
      "accessed": "2026-11-20"
    },
    {
      "id": "inotify-init-ownership",
      "title": "Linux man-pages 6.19: inotify_init(2)",
      "url": "https://man7.org/linux/man-pages/man2/inotify_init.2.html",
      "accessed": "2026-11-20"
    },
    {
      "id": "hesela-ownership-evidence",
      "title": "Hesela: native inotify ownership controls, source and reproduction package",
      "url": "https://hesela.dev/research/inotify-ownership/README.md",
      "accessed": "2026-11-20"
    },
    {
      "id": "fsnotify-backend",
      "title": "fsnotify v1.10.1: pinned Linux watch registration and event-name construction",
      "url": "https://github.com/fsnotify/fsnotify/blob/76b01a6e8f502187fecedea8b025e79e5a86085c/backend_inotify.go",
      "accessed": "2026-11-20"
    },
    {
      "id": "fsnotify-evidence",
      "title": "Hesela: native fsnotify alias and event-name identity controls",
      "url": "https://hesela.dev/research/fsnotify-alias/README.md",
      "accessed": "2026-11-20"
    },
    {
      "id": "unlinked-dispatch",
      "title": "Linux v6.8: EXCL_UNLINK event-path filtering",
      "url": "https://github.com/torvalds/linux/blob/v6.8/fs/notify/fsnotify.c#L240",
      "accessed": "2026-11-20"
    },
    {
      "id": "unlinked-dentry",
      "title": "Linux v6.8: d_unlinked tests directory-entry state",
      "url": "https://github.com/torvalds/linux/blob/v6.8/include/linux/dcache.h#L345",
      "accessed": "2026-11-20"
    },
    {
      "id": "unlinked-file-hook",
      "title": "Linux v6.8: fsnotify_file uses the open file path, lines 92-101",
      "url": "https://github.com/torvalds/linux/blob/v6.8/include/linux/fsnotify.h#L92",
      "accessed": "2026-11-20"
    },
    {
      "id": "unlinked-evidence",
      "title": "Hesela: raw directory notifications after unlink, original and separate C controls",
      "url": "https://hesela.dev/research/inotify-unlinked/PUBLICATION.md",
      "accessed": "2026-11-20"
    }
  ],
  "provenance": [
    "API documentation and controlled observations; not a durable change journal or an event-loss rate estimate.",
    "Ownership controls: 66 sequential case executions on one Linux 6.8.0-149-generic host, across ext4/tmpfs. These verify API behavior, not a backup failure-rate estimate. [hesela-ownership-evidence]",
    "Separate fsnotify v1.10.1 controls: 36 registration/lifetime schedules and 18 namespace schedules, three repetitions on ext4/tmpfs on one Linux host. The event-name lookup checks bytes and inode identity; not a backup-product failure rate. [fsnotify-evidence]",
    "Separate raw directory controls: 42 fixtures and 84 paired streams, seven cases repeated three times on ext4/tmpfs on Linux 6.8.0-149-generic. [unlinked-evidence]",
    "Separate review: 42 Python replay fixtures and 20 C fixtures across two compiler modes on the same host. These are not pooled failure-rate samples or independent-laboratory replication. [unlinked-evidence]"
  ]
}
