On Mon, Aug 25, 2025 at 02:32:38PM +0200, Christian Brauner wrote: > On Mon, Aug 25, 2025 at 05:43:05AM +0100, Al Viro wrote: > > mount_writer: write_seqlock; that's an equivalent of {un,}lock_mount_hash() > > mount_locked_reader: read_seqlock_excl; these tend to be open-coded. > > Do we really need the "locked" midfix in there? Doesn't seem to buy any > clarity. I'd drop it so the naming is nicely consistent. It's a seqlock. "Readers" is this context are lockless ones - sample/retry under rcu_read_lock() kind. The only difference between writer and locked reader is that locked reader does not disrupt those sample/retry loops. Note that for something that is never traversed locklessly (expiry lists, lists of children, etc.) locked reader is fine for all accesses, including modifications. If you have better suggestions re terminology, I'd love to hear those, but simply "writer"/"reader" is misleadingly similar to rw-semaphors/links/whatnot. Basically, there are 3 kinds of contexts here: 1) lockless, must be under RCU, fairly limited in which pointers they can traverse, read-only access to structures in question. Must sample the seqcount side of mount_lock first, then verifying that it has not changed after everything. 2) hold the spinlock side of mount_lock, _without_ bumping the seqcount one. Can be used for reads and writes, as long as the stuff being modified is not among the things that is traversed locklessly. Do not disrupt the previous class, have full exclusion with calles 2 and 3 3) hold the spinlock side of mount_lock, and bump the seqcount one on entry and leave. Any reads and writes. Full exclusion with classes 2 and 3, invalidates the checks for class 1 (i.e. will push it into retries/fallbacks/ whatnot). I'm used to "lockless reader" for 1, "writer" for 3. "locked reader" kinda works for 2 - that's what it is wrt things that can be accessed by lockless readers, but for the things that are *not* traversed without a lock it can be actually used as a less disruptive form of 3. Is used that way in mount locking for some of the data structures.