Compare commits
1 Commits
main
...
v1.28-noti
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7708320f3b |
79
README.md
79
README.md
@@ -2,12 +2,12 @@
|
||||
|
||||
Observer-only file access notifications for [ScoutFS](https://github.com/versity/scoutfs),
|
||||
distributed as a rebasable `git format-patch` series plus a small Go
|
||||
userspace relay daemon. Maintained as one long-lived branch per
|
||||
currently-supported upstream scoutfs version.
|
||||
userspace relay daemon. Layers onto each upstream release with minimal
|
||||
maintenance.
|
||||
|
||||
## What the series adds
|
||||
|
||||
Three patches against each supported scoutfs release:
|
||||
Three patches against the scoutfs source tree:
|
||||
|
||||
1. **Kmod core** — a per-mount 64 KiB ring of 64-byte notification records and
|
||||
a single-reader drain ioctl (`SCOUTFS_IOC_READ_NOTIFY`, nr 25). Emit is
|
||||
@@ -25,67 +25,58 @@ Three patches against each supported scoutfs release:
|
||||
clients. Pure-stdlib Go; no external module dependencies. Shipped
|
||||
with a systemd template unit `scoutfs-notifyd@<mountpoint>.service`.
|
||||
|
||||
The notify ABI (`SCOUTFS_IOC_READ_NOTIFY` nr 25, 64-byte event record) is
|
||||
identical across all three supported scoutfs versions, so consumers and
|
||||
the daemon do not need per-version branching in their own code.
|
||||
## Base
|
||||
|
||||
## Repository layout
|
||||
Currently rebased against:
|
||||
|
||||
Each supported scoutfs version lives on its own long-lived branch. The
|
||||
patches in each branch are tuned for that specific scoutfs tree; they do
|
||||
NOT apply cross-version without rebasing.
|
||||
scoutfs v1.30
|
||||
|
||||
| Branch | Targets scoutfs | Tag |
|
||||
|----------------|-----------------|------------------|
|
||||
| `v1.28` | `v1.28` | `v1.28-notify-1` |
|
||||
| `v1.29` | `v1.29` | `v1.29-notify-1` |
|
||||
| `main` / `v1.30` | `v1.30` | `v1.30-notify-1` |
|
||||
See [base.txt](./base.txt).
|
||||
|
||||
`main` tracks the newest supported scoutfs version. When a new scoutfs
|
||||
release ships, a new branch is created and the patches are rebased onto
|
||||
it; when a scoutfs version ages out of support, its branch stays in the
|
||||
repo for historical builds but is no longer maintained.
|
||||
## Build dependencies added
|
||||
|
||||
On top of the stock scoutfs build requirements, patch 3 adds:
|
||||
|
||||
* `golang >= 1.26` on the build host (fetched from go.dev by the CI; no distro currently packages 1.26).
|
||||
|
||||
|
||||
The Go build is offline (`GOPROXY=off`) — no network access required at
|
||||
build time. `CGO_ENABLED=0` so the produced binary is a pure-Go static
|
||||
ELF.
|
||||
|
||||
## Applying
|
||||
|
||||
Against a scoutfs git working tree at the matching upstream tag:
|
||||
|
||||
```sh
|
||||
git clone -b v1.29 https://git.anomalous.dev/alphacentri/scoutfs-notify.git /tmp/notify
|
||||
/tmp/notify/apply.sh /path/to/scoutfs-v1.29-checkout
|
||||
./apply.sh /path/to/scoutfs
|
||||
```
|
||||
|
||||
The script runs `git am --3way` on each patch in order.
|
||||
Runs `git am --3way` on each patch. For a tarball instead of a git tree,
|
||||
loop `patch -p1 < patches/*.patch`.
|
||||
|
||||
## Rebasing onto a new upstream release
|
||||
|
||||
```sh
|
||||
# In a fresh scoutfs checkout:
|
||||
git checkout v1.31
|
||||
git checkout -b notify-v1.31
|
||||
|
||||
# Apply the previous branch's patches (usually clean; resolve any
|
||||
# conflicts, git am --continue).
|
||||
git am --3way /path/to/scoutfs-notify-v1.30/patches/*.patch
|
||||
git format-patch v1.31..notify-v1.31 -o /tmp/new-patches/
|
||||
|
||||
# Push a new branch + tag in this repo:
|
||||
cd /path/to/scoutfs-notify
|
||||
git checkout -b v1.31 main
|
||||
rm patches/*.patch
|
||||
cp /tmp/new-patches/*.patch patches/
|
||||
echo v1.31 > base.txt
|
||||
git commit -am 'v1.31-notify-1: rebase onto scoutfs v1.31'
|
||||
git push -u origin v1.31
|
||||
git tag v1.31-notify-1 && git push origin v1.31-notify-1
|
||||
# Fast-forward main to the new tip once you're ready to promote it.
|
||||
git fetch --tags
|
||||
git checkout -B notify v1.30
|
||||
git am --3way patches/*.patch
|
||||
# resolve any conflicts, git am --continue
|
||||
git format-patch v1.30..notify -o patches/
|
||||
# update base.txt and commit
|
||||
```
|
||||
|
||||
## Tag history
|
||||
|
||||
v1.30-notify-1 (current — rebased onto scoutfs v1.30, no code changes)
|
||||
v1.29-notify-4 (retired — last v1.29-base release)
|
||||
v1.29-notify-3 (retired — Go 1.21 toolchain)
|
||||
v1.29-notify-2 (retired — C daemon; had latent ring-size compile bug)
|
||||
v1.29-notify-1 (retired — shipped mount options)
|
||||
|
||||
## Quick smoke test after installation
|
||||
|
||||
```sh
|
||||
systemctl enable --now scoutfs-notifyd@mnt-scoutfs.service
|
||||
FSID=$(scoutfs stat /mnt/scoutfs | awk '/fsid/ { print $2 }')
|
||||
FSID=$(stat -f -c %i /mnt/scoutfs) # or use your scoutfs cli
|
||||
socat - UNIX-CONNECT:/run/scoutfs/${FSID}/notify.sock | xxd | head
|
||||
# touch some files in /mnt/scoutfs in another terminal
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 6c5b791d47079df892ee25e6f17c22da2f643340 Mon Sep 17 00:00:00 2001
|
||||
From 1be639b8a4fdfaac37fc5801a314d080200105cb Mon Sep 17 00:00:00 2001
|
||||
From: William Gill <claude@williamgill.net>
|
||||
Date: Wed, 22 Apr 2026 14:38:51 -0500
|
||||
Subject: [PATCH 1/3] notify: core file-access notification infrastructure
|
||||
@@ -84,7 +84,7 @@ index 9088496..94e4f44 100644
|
||||
EXPAND_COUNTER(orphan_scan_attempts) \
|
||||
EXPAND_COUNTER(orphan_scan_cached) \
|
||||
diff --git a/kmod/src/ioctl.c b/kmod/src/ioctl.c
|
||||
index 0a5fc4c..b3a4d9a 100644
|
||||
index 7a73d4d..9893559 100644
|
||||
--- a/kmod/src/ioctl.c
|
||||
+++ b/kmod/src/ioctl.c
|
||||
@@ -47,6 +47,7 @@
|
||||
@@ -95,22 +95,22 @@ index 0a5fc4c..b3a4d9a 100644
|
||||
#include "scoutfs_trace.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -1790,6 +1791,8 @@ long scoutfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
@@ -1718,6 +1719,8 @@ long scoutfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
return scoutfs_ioc_mod_quota_rule(file, arg, false);
|
||||
case SCOUTFS_IOC_READ_XATTR_INDEX:
|
||||
return scoutfs_ioc_read_xattr_index(file, arg);
|
||||
case SCOUTFS_IOC_PUNCH_OFFLINE:
|
||||
return scoutfs_ioc_punch_offline(file, arg);
|
||||
+ case SCOUTFS_IOC_READ_NOTIFY:
|
||||
+ return scoutfs_ioc_read_notify(file, arg);
|
||||
}
|
||||
|
||||
return -ENOTTY;
|
||||
diff --git a/kmod/src/ioctl.h b/kmod/src/ioctl.h
|
||||
index c0d2285..d468d4c 100644
|
||||
index cefecd4..23fda13 100644
|
||||
--- a/kmod/src/ioctl.h
|
||||
+++ b/kmod/src/ioctl.h
|
||||
@@ -876,4 +876,88 @@ struct scoutfs_ioctl_punch_offline {
|
||||
#define SCOUTFS_IOC_PUNCH_OFFLINE \
|
||||
_IOW(SCOUTFS_IOCTL_MAGIC, 24, struct scoutfs_ioctl_punch_offline)
|
||||
@@ -848,4 +848,88 @@ struct scoutfs_ioctl_read_xattr_index {
|
||||
#define SCOUTFS_IOC_READ_XATTR_INDEX \
|
||||
_IOR(SCOUTFS_IOCTL_MAGIC, 23, struct scoutfs_ioctl_read_xattr_index)
|
||||
|
||||
+/*
|
||||
+ * File access notification stream (observer-only).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 496b47ab6dab052baecdfbabb0c92649a89d65b4 Mon Sep 17 00:00:00 2001
|
||||
From e970d4d8c6ab1f13cc7e2e51a830ba2f387b62d3 Mon Sep 17 00:00:00 2001
|
||||
From: William Gill <claude@williamgill.net>
|
||||
Date: Wed, 22 Apr 2026 14:40:04 -0500
|
||||
Subject: [PATCH 2/3] notify: file open/read hook sites
|
||||
@@ -37,7 +37,7 @@ Nothing in the data-waiter state machine is touched.
|
||||
2 files changed, 39 insertions(+)
|
||||
|
||||
diff --git a/kmod/src/data.c b/kmod/src/data.c
|
||||
index 0abb48c..33a61af 100644
|
||||
index 7903e8d..6e3b133 100644
|
||||
--- a/kmod/src/data.c
|
||||
+++ b/kmod/src/data.c
|
||||
@@ -41,6 +41,7 @@
|
||||
@@ -48,7 +48,7 @@ index 0abb48c..33a61af 100644
|
||||
|
||||
/*
|
||||
* We want to amortize work done after dirtying the shared transaction
|
||||
@@ -2304,6 +2305,32 @@ const struct address_space_operations scoutfs_file_aops = {
|
||||
@@ -2207,6 +2208,32 @@ const struct address_space_operations scoutfs_file_aops = {
|
||||
.write_end = scoutfs_write_end,
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ index 0abb48c..33a61af 100644
|
||||
const struct file_operations scoutfs_file_fops = {
|
||||
#ifdef KC_LINUX_HAVE_FOP_AIO_READ
|
||||
.read = do_sync_read,
|
||||
@@ -2316,6 +2343,7 @@ const struct file_operations scoutfs_file_fops = {
|
||||
@@ -2219,6 +2246,7 @@ const struct file_operations scoutfs_file_fops = {
|
||||
.splice_read = generic_file_splice_read,
|
||||
.splice_write = iter_file_splice_write,
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From b6cbfc46485cb9b7f5e87d0ff451f81c25d7d41c Mon Sep 17 00:00:00 2001
|
||||
From a227eecabc78f331fcb8c483e6051021cb44a94b Mon Sep 17 00:00:00 2001
|
||||
From: William Gill <claude@williamgill.net>
|
||||
Date: Wed, 22 Apr 2026 14:40:34 -0500
|
||||
Subject: [PATCH 3/3] notify: scoutfs-notifyd userspace relay daemon (Go 1.26)
|
||||
|
||||
Reference in New Issue
Block a user