Skip to content

Conversation

@lge
Copy link
Member

@lge lge commented Jan 5, 2026

Filesystem: allow "force_unmount" to contain a comma separated list of "modifiers",
so you can explicitly chose to "move", but report process details and kill each process individually,
or use xargs kill and report no process details, or use xargs ps then xargs kill.

Uses: new shellfuncs helper ocf_log_pipe.

See commit messages.

lge added 2 commits January 5, 2026 19:58
New helper function ocf_log_pipe,
similar to ocf_log, but read messages from stdin.

Prefix each line with HA_LOGTAG and timestamp, and output
to terminal / syslog / HA_LOGFILE / HA_DEBUGLOG / stderr
as appropriate.
…ocesses

The previous changes introduced optional `mount --move`,
and implicitly used `xargs kill` if "many" (more than 24)
active processes are found.

Allow to explicitly chose whether to use "kill one by one"
or `xargs kill`, and whether to report process details via `ps -f` or not.

I leave the default at the established behavior
`for pid; do ps -f $pid; kill -s $sig $pid; done`.

Though I think the sane default would be to "safe,xargs,nops".

The time consuming bit is the scan of the full process list,
which ps does on each invocation,
even if it is asked to report on one pid only.

Reduce the overhead of potentially many `ocf_log`
by using a single `ocf_log_pipe`.
@lge
Copy link
Member Author

lge commented Jan 5, 2026

portability note: to add timestamps, there is ts from moreutils, there are extensions to logger allowing to specify message-id and structured data, there is systemd-cat for Linux + systemd. I ignored all of these.
I also ignored the existence of ha_logd / ha_logger.

Copy link
Contributor

@oalbrigt oalbrigt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general.

I've suggested some improvements to avoid issues with positional and opposite force_unmount modifiers.


set -- $FORCE_UNMOUNT

if [ $1 = "move" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use a case for this parameter, and add it to the the for-case below, so we dont depend on it being first.

done

# catch typos
if ! ocf_is_true $FORCE_UNMOUNT && [ $FORCE_UNMOUNT != "safe" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed if you move it to a case-statement in parse_force_unmount_modifiers()


for m ; do
case $m in
move)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldnt set multiple variables here, as they might be changed or not depending on order later, so we should also make sure that opposites, e.g. only move and nomove are not set.

Let's set one variable to true or false per match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants