Documentation
¶
Overview ¶
Package mountlock provides a single-node "is a daemon live?" guard built on a PID lock file in the data directory. The mlfs daemon writes the file on mount and removes it on clean shutdown; offline tools (mlfs-admin fsck/gc) refuse to run while a matching live daemon holds it, because those tools assume a quiesced filesystem — run against a LIVE mount they race the daemon and can reap a legitimately open-but-unlinked inode (sustained only in the daemon's memory), losing data.
Single-node scope: there is exactly one mount per data-dir, so one PID file is sufficient. Multi-node coordination is a later phase.
Index ¶
Constants ¶
const FileName = "mlfs.lock"
FileName is the lock file's name, placed at the top level of the data directory. The "mlfs." prefix and the data-dir top level keep it clear of casstore's own contents under data/.
Variables ¶
This section is empty.
Functions ¶
func CheckQuiesced ¶
CheckQuiesced verifies no live daemon holds the data-dir lock and returns an error if one does. Behavior:
- No lock file: quiesced, returns nil (warn is not called).
- Lock file present, PID alive: returns *LiveError (refuse).
- Lock file present but unparseable, or PID dead: stale; warn is called with a human-readable reason and nil is returned (the caller proceeds and may rewrite/remove the file).
warn may be nil. force, when true, downgrades a live holder to a warning and returns nil — for operators who know the daemon is not actually running.