From nobody Sun Aug 13 09:10:49 2023 X-Original-To: dev-commits-src-all@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 4RNsFk0R34z4qGbn; Sun, 13 Aug 2023 09:10:50 +0000 (UTC) (envelope-from git@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 4RNsFj6lNNz4W3g; Sun, 13 Aug 2023 09:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691917849; 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; bh=CWl5p/57Vcue4YGL1peHNsGNRFUCaTbgPBx8QT6MFgk=; b=cxpsP3aBkh77tbe7+IWGdWF4Mjrz5yx3mp5wJsGU2Glp82xxrWz3qk1j3nhnXpYpynMYBy K6Ec/+X/I3NZ2kVSCibqBqUWfmZvqXIcz8N/OP5Or2pkuC5/YfQZLv3ZSVTRsawG/JzEMd sqCRU8LZcNRd8o3JTdgF5Xs0NAueN5xwErJ2W7UsLv+OYpO71iVOx33TGwcjVPlY6snej0 wftQZJyGDBCLOxudTwO8cssdeduEzV60MqLl8tSkSk0d9Mpl5ovzv1ciiIUdLI2F4suvms klTyDpFN0KokaipuYEEuTBK7j8PQFEm4wLqxVxWGIrpz3wpnytc1MlxaXjAVNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691917849; 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; bh=CWl5p/57Vcue4YGL1peHNsGNRFUCaTbgPBx8QT6MFgk=; b=OyWN9ABnPDCyiybW6vJXUPo2NJF5mIdNCv1KqHkqPD8+pti034tX0DhA8GYvYUhzfY4uF0 lpiIUYSu/wwsj+IS14MXwiT5Njl0YbFtAH4y0BdSFOj8HQgiGM3F20vFyIKp31QTEiLH7b IOzH2Dbmyorb5l8xcSQeuF6GHQ2bI9VljyikPUCK0i04dhCFINyjWVXgHjmLbX0C4AH+3w bqmD7dzmSmavUpskoFv8IfC+NJ0cm6d7m8sVU8fWtXlvC5X4JTcE8rbGStI2/skvdXAXe9 h6d4F2hN9IkH6DhdnsOYI7h6uffqeRZ9YSlhEIDgregN4MccPG9y1M16uj4vow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691917849; a=rsa-sha256; cv=none; b=CY80zpba4rJXH+0nC2Dl4fF9r5W8qxtspY3dSTsYGFB5W8hTCm3WecpWS1Gnzi0VMvN5/I cPNyOeiZqEyKE5yvZxKSOid24E41L+6pHjSzr1wQMNeFQaYpc0cn51s31Ozy8QeSDgCJ9b 7othXZGqhQZNu9x2zotF8PmBZAToHm4bCZ1VKtB7iwO6Nvy7iKATgXg7O61JLCavc7YRUP FNui0vE0+diYUbCelsugzFE75lstB2iodcIA9i53ic/VgKNnDWalWydQOWmC+7UmtBUFfr UbybvX5bCB9Bwy6Q7L3ERFXuMkzWPeWzt9P9FEn5HtmkvdXJxDKCPbosBEzPbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4RNsFj5rfGzwTh; Sun, 13 Aug 2023 09:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37D9Ansj095305; Sun, 13 Aug 2023 09:10:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37D9Ania095302; Sun, 13 Aug 2023 09:10:49 GMT (envelope-from git) Date: Sun, 13 Aug 2023 09:10:49 GMT Message-Id: <202308130910.37D9Ania095302@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: a953ac19dbc8 - main - stress2: Added a 'fsck_ffs -B' regression test List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a953ac19dbc890a08b6b267f9572dc5974dbc8ad Auto-Submitted: auto-generated The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=a953ac19dbc890a08b6b267f9572dc5974dbc8ad commit a953ac19dbc890a08b6b267f9572dc5974dbc8ad Author: Peter Holm AuthorDate: 2023-08-13 09:09:39 +0000 Commit: Peter Holm CommitDate: 2023-08-13 09:09:39 +0000 stress2: Added a 'fsck_ffs -B' regression test --- tools/test/stress2/misc/fsck14.sh | 119 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/tools/test/stress2/misc/fsck14.sh b/tools/test/stress2/misc/fsck14.sh new file mode 100755 index 000000000000..ddeb45a83e96 --- /dev/null +++ b/tools/test/stress2/misc/fsck14.sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2023 Peter Holm +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +# fsck -B test scenario with SUJ. -B implies "preen mode". + +# 'panic: ffs_blkfree_cg: bad size' seen: +# https://people.freebsd.org/~pho/stress/log/log0465.txt +# Fixed by: 220427da0e9b - Set UFS/FFS file type to snapshot before changing +# its block pointers. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg +mycc -o /tmp/flip -Wall -Wextra ../tools/flip.c || exit 2 + +set -e +md=/dev/md$mdstart +prog=$(basename "$0" .sh) +backup=/tmp/$prog.sh.diskimage.`date +%Y%m%dT%H%M%S`.gz +log=/tmp/$prog.sh.log +[ -c $md ] && mdconfig -d -u $mdstart +dd if=/dev/zero of=$diskimage bs=128m count=1 status=none +mdconfig -a -t vnode -f $diskimage -u $mdstart +backups=`newfs -N $j $md | grep -A1 "super-block backups" | \ + tail -1 | sed 's/,//g'` +newfs -j $md > /dev/null 2>&1 +mount $md $mntpoint +set +e + +jot 5000 | xargs -P0 -I% touch $mntpoint/a% +while ! umount $mntpoint; do :; done +/tmp/flip -n 10 $diskimage +gzip < $diskimage > $backup +fsync $diskimage $backup + +mount -f $md $mntpoint + +if ! fsck_ffs -B $md > $log 2>&1; then + grep MANUALLY $log + umount $mntpoint + fsck_ffs -fy $md > $log 2>&1; s=$? + grep -Eq "IS CLEAN|MARKED CLEAN" $log || { + cat $log + echo "fsck_ffs -f failed with exit code $s" + umount $mntpoint; mdconfig -d -u $mdstart + rm -f $log /tmp/flip $diskimage $backup + exit 1 + } + mount $md $mntpoint +fi + +jot 5000 | xargs -P0 -I% rm $mntpoint/a% +jot 5000 | xargs -P0 -I% touch $mntpoint/b% + +ls -lR $mntpoint > /dev/null || { + echo "ls -lR $mntpoint failed after fsck -B" + umount $mntpoint; mdconfig -d -u $mdstart + rm -f $log /tmp/flip $diskimage $backup + exit 0 # For now, ignore non fatal errors +} + +jot 5000 | xargs -P0 -I% rm $mntpoint/b% || { + echo "clean failed" + umount $mntpoint; mdconfig -d -u $mdstart + rm -f $log /tmp/flip $diskimage $backup + exit 0 # For now, ignore non fatal errors +} +umount $mntpoint + +r=0 +for i in `jot 4`; do + fsck_ffs -fy $diskimage > $log 2>&1; r=$? + if grep -qiE "super-?block.*failed" $log; then + for b in $backups; do + echo "fsck_ffs -b $b -fy $diskimage" + fsck_ffs -b $b -fy $diskimage > $log 2>&1 + r=$? + grep -qiE "super-?block.*failed" $log || + break + echo "Checking next SB" + done + fi + [ $r -ne 0 ] && continue + grep -Eq "WAS MODIFIED" $log && continue + grep -Eq "CLEAN" $log && break +done +mount $md $mntpoint || exit 3 +ls -lR $mntpoint > /dev/null || { umount $mntpoint; mdconfig -d -u mdstart; echo "exit 4"; exit 4; } +umount $mntpoint +fsck_ffs -fy $md > $log 2>&1 +grep -Eq 'IS CLEAN|MARKED CLEAN' $log && s=0 || { s=1; cat $log; } +mdconfig -d -u $mdstart +rm -f $log /tmp/flip $diskimage $backup +exit $s