[Bug 229829] [zfs] scrubbing prevents shutdown and slows down startup

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 06 Nov 2023 20:19:52 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229829

J.R. Oldroyd <fbsd@opal.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fbsd@opal.com

--- Comment #7 from J.R. Oldroyd <fbsd@opal.com> ---
This issue appears to be happening to me on 13.2-RELEASE-p1.

For me, I do suspend/resumes regularly. Mostly with no problems, but
occasionally the suspend blocks at the point where you'd expect the power off
and it requires a hard power off shutdown. (Or possibly it requires you to wait
for the scrub to complete - obviously not practical when you're suspending a
laptop.)

I am experimenting with these additions in rc.suspend and rc.resume:

rc.suspend:
# pause any zpool scrub in progress
zpool status | while read KEY VALUE; do
        case "$KEY" in
        pool:)  POOL=$VALUE ;;
        scan:)  case "$VALUE" in
                "scrub in progress since "*)
                        echo "$POOL" >>/var/db/zpool.scrub.resume
                        zpool scrub -p $POOL
                        ;;
                esac
        esac
done

rc.resume:
# resume any scrub that was in progress on suspend
if [ -f /var/db/zpool.scrub.resume ]; then
        cat /var/db/zpool.scrub.resume | while read POOL; do
                zpool scrub $POOL
        done
        rm /var/db/zpool.scrub.resume
fi

Something similar may also be needed in rc.shutdown with a suitable
rc.d/zpool_scrub_resume script for the shutdown/reboot sequence.

-- 
You are receiving this mail because:
You are the assignee for the bug.