Skip to content

Commit 705705a

Browse files
committed
TODO: add a list of work for later releases
We've kept a number of things out of 0.1.0 that we want to do in a later release and there are a few ideas that aren't decided yet. Let's write them down in a TODO.md so they don't get lost. Most of the entries are about the manifest builder, such as an API to add and finish in steps, signing a manifest, and a flag that leaves out mount points. The rest are two small items for the C API, the option to drop pathrs, and whether to accept AT_FDCWD. Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
1 parent 0e07c68 commit 705705a

1 file changed

Lines changed: 141 additions & 0 deletions

File tree

‎TODO.md‎

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# TODO
2+
3+
Work that is planned for a later release, and ideas that are not decided
4+
yet.
5+
6+
## Manifest builder
7+
8+
- A flag that leaves out every mount point a walk doesn't cross. Without
9+
`CROSS_MOUNTS`, `generate_at()` and `generate()` record a directory
10+
that is a mount point as an empty directory with the attributes of the
11+
mounted root, and a file or a device node that is a mount point as the
12+
mount shows it. The flag leaves out all of them, directories and files
13+
alike. It could be `AddFlags::DROP_LEAF_MOUNTS` and
14+
`UAPI16_ADD_DROP_LEAF_MOUNTS`, or have a name such as
15+
`ONE_FILE_SYSTEM`. What it means together with `CROSS_MOUNTS` is still
16+
open, and so is whether it also leaves out an automount point that
17+
isn't triggered, which a walk records as an empty directory.
18+
19+
- Add and finish in steps, so that a caller can stop an add between
20+
two of them or keep each call short, as an event loop has to. The
21+
builder works in steps inside already, so this is an addition to the
22+
API in Rust and C: a call that sets up an add or the finish, a step
23+
with a budget, and an end that says how the add ended. For every step
24+
to stay short, more has to work in parts first:
25+
- The doubling of the table of hard links. The step that begins one
26+
writes about 0.9 MiB whatever its budget, every step that copies
27+
writes twice its budget, and the step that ends one truncates the
28+
old file, in 3 to 45 ms for tables of 128 MiB to 2 GiB.
29+
- A merge. One step can read up to 32 MiB into the buffers of its
30+
runs.
31+
- The stages of a step. One that goes on from one stage to the next
32+
can do two or three times its budget.
33+
- Very small file objects of a caller. A budget in bytes lets a step
34+
over them take ten times as long as one over files, and a weight
35+
per record would even that out.
36+
37+
- Read no page of a new table of hard links while it is still a hole.
38+
Today the copy of a doubling reads every new page from its file before
39+
it writes it, so the copy reads three times what it copies. Knowing
40+
which pages are still holes needs no memory that grows with the table:
41+
the copy touches the pages of each half of the new table in order,
42+
except for groups that wrapped around the end of the old table.
43+
44+
- Keep the table of hard links on disk in one file. Today a table on
45+
disk doubles into a second file, and the two take turns, so the table
46+
holds one more descriptor and is copied at every doubling. Two designs
47+
could manage with a single pages file:
48+
- The new table appended past the old one, with the old part punched
49+
out afterwards. FAT can't punch holes, so there the space would
50+
double.
51+
- Linear hashing, which splits one page at a time in place, so there's
52+
no doubling copy at all. It would mean a different table.
53+
54+
- Check and escape the bytes of a name a word at a time. Today the split
55+
of a name into its components, the check of the order of names and the
56+
escape of a record's strings, which serde_json does, go through a name
57+
a byte at a time. Over long names the adds and the finish take up to a
58+
third longer in one build than in another of the same source, by where
59+
these loops land.
60+
61+
- Give the room of a run back on a tmpfs with huge pages. statx() says
62+
2 MiB there, and the sort gives back only whole blocks of that size,
63+
so a run keeps up to 2 MiB of its file until the merge is over: 1256
64+
MiB for the 627 runs of 1.2e8 records, where xfs keeps 2 MiB. The
65+
kernel frees smaller holes there too, so the page size would do as
66+
the block.
67+
68+
- Close the window between the check of a directory for an automount
69+
point and its open by name. A directory that becomes an automount
70+
point in between is triggered, and `generate_at()` or `generate()`
71+
fails with `TreeProblem::Changed`. Where the kernel has `O_EMPTYPATH`,
72+
the handle can be reopened without a lookup, and since Linux 6.18
73+
`openat2()` with `RESOLVE_NO_XDEV` doesn't trigger an automount.
74+
75+
- Signing the manifest a builder writes. systemd-manifest make feeds the
76+
text of every record into its signer as it writes the record, and
77+
appends the signature record at the end.
78+
79+
- A CI job with privileges for what the FAT job doesn't cover: block
80+
devices and device nodes made with mknod, the append-only and
81+
immutable flags, NOCOW, btrfs subvolumes, an mtime after 2554 on
82+
btrfs, automount points, and a file system that keeps a file that was
83+
unlinked while it is open, as NFS does.
84+
85+
- An add of a descriptor that takes the hash of the data of a regular
86+
file from its caller and doesn't read the data. A tool that builds an
87+
image hashes the data while it copies it, with `Sha256Context`, and
88+
adds it with `add_object()`. But then it reads the attributes of the
89+
file itself, extended attributes and flags included, and numbers the
90+
hard links. The new add reads everything but the data from the
91+
descriptor. It could be
92+
`ManifestWriter::add_hashed(entry, name, sha256)` and
93+
`uapi16_manifest_writer_add_hashed()`. The hash is taken as it is,
94+
like the hash of a file object of a caller. Still open: whether the
95+
add also takes how many bytes were hashed and what `statx()` said of
96+
the file before they were read, so that a file that changed while it
97+
was copied fails with `TreeProblem::Changed`, and whether the hasher
98+
comes from the writer, so that it hashes only what the manifest
99+
records.
100+
101+
## C API
102+
103+
- A second way to pass features, such as one call per feature, once
104+
there are more than 64 of them.
105+
- Options for the install script to leave out the static or the shared
106+
library.
107+
108+
## pathrs
109+
110+
- Dropping pathrs remains an option. When a call of pathrs fails, pathrs
111+
looks up the path of the descriptor of the call in /proc for its
112+
error, and it panics where it can't: where /proc is missing or is not
113+
a procfs, and on a real procfs where no descriptor is left to open
114+
/proc with. Both panics are in pathrs 0.2.6, the latest release, and
115+
gone from the main branch of libpathrs since 2026-11-27 (8e60d5f
116+
"procfs: drop panic in ProcfsBase::into_path", 0ce0614 "*: get rid of
117+
silly panics"). Until a release has that, in both cases
118+
`PinnedDirectory` panics for a name it can't resolve, and it and the
119+
builder panic when they reopen a file on a kernel without
120+
`O_EMPTYPATH`. A release of pathrs that returns an error there instead
121+
of panicking takes care of this.
122+
123+
- Without pathrs, `PinnedDirectory` resolves a name with `openat2()`,
124+
`RESOLVE_IN_ROOT` and `RESOLVE_NO_MAGICLINKS`, plus
125+
`RESOLVE_NO_SYMLINKS` unless it follows symbolic links, and tries
126+
again on `EAGAIN`. Where the kernel has no `O_EMPTYPATH`, a file is
127+
reopened through /proc/thread-self/fd and checked to be the inode of
128+
its descriptor once it is open. That fails where /proc is not usable
129+
instead of panicking, but unlike pathrs it opens what the link leads
130+
to before it checks it. The builder's reopen, its only use of pathrs,
131+
changes the same way.
132+
133+
- Still open: where seccomp refuses `openat2()`, a walk of one
134+
component at a time with `O_NOFOLLOW` still works, but
135+
`follow_symlinks(true)` needs a resolver of our own, or fails there.
136+
137+
## Maybe
138+
139+
- Accepting `AT_FDCWD` as the directory descriptor of `create_at()` and
140+
`generate_at()`, in C and as rustix's `CWD` in Rust.
141+
Today it is refused with `EBADF`, like any other negative descriptor.

0 commit comments

Comments
 (0)