diff --git a/README.md b/README.md index 334ff9d..a2df1bc 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,9 @@ Three patches against each supported scoutfs release: machine is touched. (Branches up to `v1.32` also hooked `scoutfs_file_aio_read`; scoutfs v1.33 removed the `KC_LINUX_HAVE_FOP_AIO_READ` compat paths, so `read_iter` is now the - only read path.) + only read path. scoutfs v1.34 added iomap buffered/direct I/O, which + splits `scoutfs_file_read_iter` into a `KC_USE_IOMAP_FOR_IO` arm and + an `#else` arm; from `v1.34` on both arms carry the hook.) 3. **scoutfs-notifyd (Go)** — userspace daemon that binds `/run/scoutfs//notify.sock` (AF_UNIX SOCK_SEQPACKET, mode 0600, root-only), drains the ring, and broadcasts each record to connected @@ -32,7 +34,8 @@ The 64-byte event record layout is identical on every branch, so consumers and the daemon do not need per-version branching in their own code. The ioctl number is not: it is nr 25 on `v1.28`-`v1.30` and nr 26 from `v1.32` on, because upstream v1.32 took nr 25 for -`SCOUTFS_IOC_INJECT_TOTL_DELTA`. scoutfs v1.33 did not renumber again. +`SCOUTFS_IOC_INJECT_TOTL_DELTA`. Neither scoutfs v1.33 nor v1.34 +renumbered again. ## Repository layout @@ -47,6 +50,7 @@ NOT apply cross-version without rebasing. | `v1.30` | `v1.30` | `v1.30-notify-1` | | `v1.32` | `v1.32` | `v1.32-notify-1` | | `v1.33` | `v1.33` | `v1.33-notify-1` | +| `v1.34` | `v1.34` | `v1.34-notify-1` | `main` tracks the newest supported scoutfs version. When a new scoutfs release ships, a new branch is created and the patches are rebased onto diff --git a/base.txt b/base.txt index 2f2ce0d..e51138b 100644 --- a/base.txt +++ b/base.txt @@ -1 +1 @@ -v1.33 +v1.34 diff --git a/patches/0001-notify-core-file-access-notification-infrastructure.patch b/patches/0001-notify-core-file-access-notification-infrastructure.patch index 3a66183..4bfa9c7 100644 --- a/patches/0001-notify-core-file-access-notification-infrastructure.patch +++ b/patches/0001-notify-core-file-access-notification-infrastructure.patch @@ -1,4 +1,4 @@ -From 0e703364da5efe4a3b2e96e5513204dd8a1a79ac Mon Sep 17 00:00:00 2001 +From e01e070f486cf0f525cf4300464201e092b62e4d Mon Sep 17 00:00:00 2001 From: William Gill Date: Wed, 22 Apr 2026 14:38:51 -0500 Subject: [PATCH 1/3] notify: core file-access notification infrastructure @@ -58,10 +58,10 @@ follow-up patch. create mode 100644 kmod/src/notify.h diff --git a/kmod/src/Makefile b/kmod/src/Makefile -index fa632aa..de14c74 100644 +index 7fd7319..c54b47e 100644 --- a/kmod/src/Makefile +++ b/kmod/src/Makefile -@@ -31,6 +31,7 @@ scoutfs-y += \ +@@ -32,6 +32,7 @@ scoutfs-y += \ lock_server.o \ msg.o \ net.o \ @@ -84,7 +84,7 @@ index cb7a2e1..83c0976 100644 EXPAND_COUNTER(orphan_scan_attempts) \ EXPAND_COUNTER(orphan_scan_cached) \ diff --git a/kmod/src/ioctl.c b/kmod/src/ioctl.c -index 903033b..3a09e2e 100644 +index 6da71d9..5703c6a 100644 --- a/kmod/src/ioctl.c +++ b/kmod/src/ioctl.c @@ -47,6 +47,7 @@ @@ -94,8 +94,8 @@ index 903033b..3a09e2e 100644 +#include "notify.h" #include "scoutfs_trace.h" #include "util.h" - -@@ -1827,6 +1828,8 @@ long scoutfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + #include "msg.h" +@@ -1829,6 +1830,8 @@ long scoutfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return scoutfs_ioc_punch_offline(file, arg); case SCOUTFS_IOC_INJECT_TOTL_DELTA: return scoutfs_ioc_inject_totl_delta(file, arg); diff --git a/patches/0002-notify-file-open-read-hook-sites.patch b/patches/0002-notify-file-open-read-hook-sites.patch index d68c8af..e611e0b 100644 --- a/patches/0002-notify-file-open-read-hook-sites.patch +++ b/patches/0002-notify-file-open-read-hook-sites.patch @@ -1,4 +1,4 @@ -From 9eb38690d14d631a0dd96f464caa588bee86278d Mon Sep 17 00:00:00 2001 +From cf9d03234f1424b95d08e3a3492479f550aee455 Mon Sep 17 00:00:00 2001 From: William Gill Date: Wed, 22 Apr 2026 14:40:04 -0500 Subject: [PATCH 2/3] notify: file open/read hook sites @@ -15,16 +15,19 @@ OPEN (data.c): inspected for FMODE_WRITE to set SCOUTFS_NOTIFY_F_WRITE_OPEN. READ (file.c): - scoutfs_file_read_iter() gets an emit placed past the existing - data-waiter retry check, guarded on (ret > 0) so only successful - reads are reported and retries never double-count. start_pos is - captured at function entry before generic_file_read_iter advances + Each scoutfs_file_read_iter() gets an emit placed past the + existing data-waiter retry check, guarded on (ret > 0) so only + successful reads are reported and retries never double-count. + start_pos is captured at function entry before the read advances iocb->ki_pos. -Rebased onto v1.33: upstream removed the KC_LINUX_HAVE_FOP_AIO_READ -compat paths, so scoutfs_file_aio_read/aio_write no longer exist and -the second READ hook and the fops table's #ifdef arm went with them. -read_iter is now the only read path. The hook body is unchanged. +Rebased onto v1.34: upstream added iomap-based buffered and direct +I/O, so file.c now carries two scoutfs_file_read_iter definitions - +one under KC_USE_IOMAP_FOR_IO and the pre-v1.34 one in the #else +arm. Both get the same hook in the same position. EL8 and EL9 +kernels lack copy_page_to_iter_nofault (v6.4+) and so compile the +#else arm, but hooking only that arm would leave notifications a +silent no-op on any newer kernel that later enters the build matrix. Every hook is behind unlikely(READ_ONCE(sbi->notify_enabled)), so when no userspace reader is attached the hook reduces to a single @@ -34,22 +37,22 @@ propagated, and no existing control flow is altered. Nothing in the data-waiter state machine is touched. --- kmod/src/data.c | 28 ++++++++++++++++++++++++++++ - kmod/src/file.c | 7 +++++++ - 2 files changed, 35 insertions(+) + kmod/src/file.c | 12 ++++++++++++ + 2 files changed, 40 insertions(+) diff --git a/kmod/src/data.c b/kmod/src/data.c -index 1d3168f..5611dd8 100644 +index 44ca4c9..3fea851 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c -@@ -42,6 +42,7 @@ - #include "msg.h" +@@ -45,6 +45,7 @@ #include "ext.h" #include "util.h" + #include "iomap.h" +#include "notify.h" /* * We want to amortize work done after dirtying the shared transaction -@@ -2242,11 +2243,38 @@ const struct address_space_operations scoutfs_file_aops = { +@@ -2254,11 +2255,38 @@ const struct address_space_operations scoutfs_file_aops = { .write_end = scoutfs_write_end, }; @@ -89,18 +92,37 @@ index 1d3168f..5611dd8 100644 .unlocked_ioctl = scoutfs_ioctl, .fsync = scoutfs_file_fsync, diff --git a/kmod/src/file.c b/kmod/src/file.c -index 0f2e7b8..fb7eace 100644 +index 730a662..cf54871 100644 --- a/kmod/src/file.c +++ b/kmod/src/file.c -@@ -29,6 +29,7 @@ - #include "per_task.h" - #include "omap.h" - #include "quota.h" +@@ -33,6 +33,7 @@ + #include "iomap.h" + #include "trans.h" + #include "msg.h" +#include "notify.h" - ssize_t scoutfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) - { -@@ -39,6 +40,7 @@ ssize_t scoutfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) + #ifdef KC_USE_IOMAP_FOR_IO + +@@ -187,6 +188,7 @@ ssize_t scoutfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) + struct scoutfs_lock *scoutfs_inode_lock; + SCOUTFS_DECLARE_PER_TASK_ENTRY(pt_data_ent); + DECLARE_DATA_WAIT(dw); ++ loff_t start_pos = iocb->ki_pos; + int lock_flags = SCOUTFS_LKF_REFRESH_INODE; + bool is_dio = (iocb->ki_flags & IOCB_DIRECT); + bool nowait = (iocb->ki_flags & IOCB_NOWAIT); +@@ -258,6 +260,10 @@ out: + goto retry; + } + ++ if (ret > 0 && unlikely(READ_ONCE(SCOUTFS_SB(sb)->notify_enabled))) ++ scoutfs_notify_emit(sb, SCOUTFS_NOTIFY_TYPE_READ, ++ scoutfs_ino(inode), start_pos, ret, 0); ++ + return ret; + } + +@@ -578,6 +584,7 @@ ssize_t scoutfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) struct scoutfs_lock *scoutfs_inode_lock = NULL; SCOUTFS_DECLARE_PER_TASK_ENTRY(pt_ent); DECLARE_DATA_WAIT(dw); @@ -108,7 +130,7 @@ index 0f2e7b8..fb7eace 100644 int ret; retry: -@@ -73,6 +75,11 @@ out: +@@ -612,6 +619,11 @@ out: if (ret == 0) goto retry; } diff --git a/patches/0003-notify-scoutfs-notifyd-userspace-relay-daemon-Go-1.2.patch b/patches/0003-notify-scoutfs-notifyd-userspace-relay-daemon-Go-1.2.patch index d796823..bad6507 100644 --- a/patches/0003-notify-scoutfs-notifyd-userspace-relay-daemon-Go-1.2.patch +++ b/patches/0003-notify-scoutfs-notifyd-userspace-relay-daemon-Go-1.2.patch @@ -1,4 +1,4 @@ -From e7d50bb7b4e2fa0a88e7b4b8f4be75bb07e37351 Mon Sep 17 00:00:00 2001 +From f95104cb0b1a46cfc2dbd7a9573eb80ff9176445 Mon Sep 17 00:00:00 2001 From: William Gill Date: Wed, 22 Apr 2026 14:40:34 -0500 Subject: [PATCH 3/3] notify: scoutfs-notifyd userspace relay daemon (Go 1.26)