From nobody Tue Jun 21 14:33:25 2022 X-Original-To: fs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 359878610FE for ; Tue, 21 Jun 2022 14:33:26 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LS8Bs5QLxz4X90 for ; Tue, 21 Jun 2022 14:33:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A1FD13B46 for ; Tue, 21 Jun 2022 14:33:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 25LEXPaC096422 for ; Tue, 21 Jun 2022 14:33:25 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 25LEXPbK096421 for fs@FreeBSD.org; Tue, 21 Jun 2022 14:33:25 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: fs@FreeBSD.org Subject: [Bug 229829] [zfs] scrubbing prevents shutdown and slows down startup Date: Tue, 21 Jun 2022 14:33:25 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.2-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: bdrewery@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: fs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655822005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I9uH06ezCu3ijnQnXl2cOmS1UoXbzsqIV0Y7IoAGiGk=; b=vdYI8VdRk4uecmypnirSOMDbJSNWtS0UldCPVi0rnT+BhnJEUKS3sLmCy39F2m3K2tEA85 yYPeo/goCGV1BZ+Am6+24NQ+eJPFEQJSSOYW6dJ03YbyRdaVgmTPw3UvjUpyoxK5xH/QUa od1ZOsn3MtGBo3dnEWk33SATx5a3zwceyK8BlYiuWyNrMg3Q3PbdyooxYzTlf6kS/02kRj ttH46MiUn0S/yxKrdkzKwt9yiGoLi8DFMAMdJlK/IF9ZX2hvzvBowebDVN3H0wwTeH5lt0 5BXWGXUOJQdkD7V1FbmImPONFLIcnBJ9wwqnru56k0/oxwjXdcXyG5dL09j5SA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655822005; a=rsa-sha256; cv=none; b=IVkceZ6QN3/entC1JLcxc1rNkV1n4TyIlqWdgT4tnCgdIDCqv5K3Y1ui6rQfgt9KpIi12l 2Wb4U5he+OE33Gcqr7SvBFfqUgm1wIYqgDkvcI+P3T+ktDN8jtQlxXI+x1UeHsc0nwbUbK iFtXGFNTBv+E7XY+MsiUcTpg9ul5Z2my9Ak07Ezd4mID9Ybhw8ZKK2J+bCGbdXJiDUkC5z q9afD7I6HW/q21q4PXmEK6ytoIS6wZDuGhaTwEtrZbKPgcRNx2TMfTC9UcQLrrubn5E3R0 kvQz2BRTJJ8HHDPe2O1oLrTOe6MVypyTnIXM0X7xdqKXDmQBqBAybkDDVQpcIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229829 --- Comment #4 from Bryan Drewery --- This seems simpler. I might find time to commit this. diff --git usr.sbin/periodic/etc/daily/800.scrub-zfs usr.sbin/periodic/etc/daily/800.scrub-zfs index 8cca1ea4d949..474e070153e8 100755 --- usr.sbin/periodic/etc/daily/800.scrub-zfs +++ usr.sbin/periodic/etc/daily/800.scrub-zfs @@ -15,6 +15,13 @@ then source_periodic_confs fi +doscrub() { + local pool=3D"$1" + + zfs set org.freebsd:last-scrub=3D$(date +%F.%T) "${pool}" + zpool scrub "${pool}" +} + : ${daily_scrub_zfs_default_threshold=3D35} case "$daily_scrub_zfs_enable" in @@ -55,9 +62,7 @@ case "$daily_scrub_zfs_enable" in _pool_threshold=3D${daily_scrub_zfs_default_thresho= ld} fi - _last_scrub=3D$(zpool history ${pool} | \ - egrep "^[0-9\.\:\-]{19} zpool scrub ${pool}\$" | tail -= 1 |\ - cut -d ' ' -f 1) + _last_scrub=3D$(zfs get -s local -H -o value org.freebsd:last-scrub ${pool}) if [ -z "${_last_scrub}" ]; then # creation time of the pool if no scrub was done _last_scrub=3D$(zpool history ${pool} | \ @@ -88,12 +93,12 @@ case "$daily_scrub_zfs_enable" in ;; *"none requested"*) echo " starting first scrub (since reboot= ) of pool '${pool}':" - zpool scrub ${pool} + doscrub ${pool} [ $rc -eq 0 ] && rc=3D1 ;; *) echo " starting scrub of pool '${pool}':" - zpool scrub ${pool} + doscrub ${pool} [ $rc -eq 0 ] && rc=3D1 ;; esac --=20 You are receiving this mail because: You are the assignee for the bug.=