From owner-freebsd-bugs@FreeBSD.ORG Thu Sep 2 15:40:07 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A1891065734 for ; Thu, 2 Sep 2010 15:40:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C18428FC1D for ; Thu, 2 Sep 2010 15:40:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o82Fe6Kf010058 for ; Thu, 2 Sep 2010 15:40:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o82Fe6B1010056; Thu, 2 Sep 2010 15:40:06 GMT (envelope-from gnats) Resent-Date: Thu, 2 Sep 2010 15:40:06 GMT Resent-Message-Id: <201009021540.o82Fe6B1010056@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Josh Paetzel Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC262106571F for ; Thu, 2 Sep 2010 15:34:30 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 9B7CA8FC1E for ; Thu, 2 Sep 2010 15:34:30 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o82FYUtu050051 for ; Thu, 2 Sep 2010 15:34:30 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o82FYU0P050050; Thu, 2 Sep 2010 15:34:30 GMT (envelope-from nobody) Message-Id: <201009021534.o82FYU0P050050@www.freebsd.org> Date: Thu, 2 Sep 2010 15:34:30 GMT From: Josh Paetzel To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/150228: [PATCH] /etc/periodic/daily/800.scrub-zfs errors with faulted zpools X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 15:40:07 -0000 >Number: 150228 >Category: bin >Synopsis: [PATCH] /etc/periodic/daily/800.scrub-zfs errors with faulted zpools >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 02 15:40:06 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Josh Paetzel >Release: 9.0-CURRENT >Organization: >Environment: FreeBSD tcbug.ixsystems.com 9.0-CURRENT FreeBSD 9.0-CURRENT #2: Mon Jul 12 22:22:49 CDT 2010 jpaetzel@ix.tcbug.org:/usr/obj/usr/src/sys/IX amd64 >Description: 800.scrub-zfs is a periodic script you can enable to perform periodic scrubs of ZFS filesystems. If you have faulted zpools the script generates sh errors due to some of the zpool commands generating no output. Faulted zpools can happen for reasons other than hardware failure, for example if you use ZFS on removable devices when they are unplugged zpool status will show them as faulted. >How-To-Repeat: Put ZFS on a removable device, export and detach it from the system. # echo 'daily_scrub_zfs_enable="YES"' >> /etc/periodic.conf # /etc/periodic/daily/800.scrub-zfs >Fix: Apply attached patch Patch attached with submission follows: Index: 800.scrub-zfs =================================================================== --- 800.scrub-zfs (revision 212149) +++ 800.scrub-zfs (working copy) @@ -1,6 +1,6 @@ #!/bin/sh # -# $FreeBSD$ +# $FreeBSD: src/etc/periodic/daily/800.scrub-zfs,v 1.1 2010/06/15 08:58:16 netchild Exp $ # # If there is a global system configuration file, suck it in. @@ -24,13 +24,17 @@ for pool in ${daily_scrub_zfs_pools}; do # sanity check - zpool list ${pool} >/dev/null 2>&1 + _status=`zpool list ${pool} | sed -n -e '$p'` >/dev/null 2>&1 if [ $? -ne 0 ]; then echo " WARNING: pool '${pool}' specified in" echo " '/etc/periodic.conf:daily_scrub_zfs_pools'" echo " does not exist" continue fi + if echo ${_status} | grep FAULTED >/dev/null 2>&1; then + echo "Skipping faulted pool: ${pool}" + continue + fi # successful only if there is at least one pool to scrub rc=0 >Release-Note: >Audit-Trail: >Unformatted: