ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
493 stars 583 forks source link

Filesystem: try umount first during stop-action, and avoid potential "Argument list too long" for force_unmount=safe #1977

Closed lge closed 2 months ago

lge commented 2 months ago

See individual commit messages.

SatomiOSAWA commented 2 months ago

Hi, @lge @oalbrigt

Impressive work! Thank you for your consideration. I understand that the issue with RHBZ:2207567 is serious. However, as Mr. Lars noted, if the dependencies are properly configured, it seems unlikely that unmounting first would cause any problems. I have come to recognize the importance of adding proper comments once again. I believe many users will appreciate this improvement.

oalbrigt commented 2 months ago

Thanks.

lge commented 2 months ago

if scanning /proc twice should become a problem, we could either use bash and its more advance redirections, or use fifos

procs=$(
    exec 2>/dev/null
    D=$(mktemp -d) # (preferably somwhere on a tmpfs, so set TMPDIR or add -p or an explicit template)
    mkfifo "$D/maps";
    (
    < "$D/maps" xargs -r grep -l " $dir/"  | cut -d/ -f3 | uniq &
    exec 3> "$D/maps";
    rm -rf "$D";
    find /proc -path '/proc/[0-9]*' \
        \( -name maps -fprint "/dev/fd/3" \
        -o -type l \( -lname "$dir/*" -o -lname "$dir" \) -print \
        \) | cut -d/ -f 3 | uniq
    ) | sort -u
)

:stuck_out_tongue_winking_eye:

oalbrigt commented 2 months ago

Feel free to make a patch when you got the time.

We should keep it non-bash specific, as the agent can also be used on *BSD.

lge commented 2 months ago

Feel free to make a patch when you got the time.

We should keep it non-bash specific, as the agent can also be used on *BSD.

https://github.com/ClusterLabs/resource-agents/pull/1978 (hope that is sufficiently *BSD compatible ...)