From nobody Sun Nov 13 09:16:48 2022 X-Original-To: dev-commits-src-main@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 4N96Jc41w3z4hMVW; Sun, 13 Nov 2022 09:16:48 +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 4N96Jc3WQnz3xSD; Sun, 13 Nov 2022 09:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668331008; 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=9BBizL81tIfM9Ukv24nR6qiKOdWm3kq1vh+jyuk4XTY=; b=rgpmj2Rx+NzqjkzjuJsV1LzUTDnjJB+/KLeGdD5Ddl9mM5uZpc8mf4jI+7g4JTfl8n/Bj9 x+j2GCxJARfh7CksJnr8mC5utAXQjIiDk5lr9yMGKJ88ikfrUxNcJbkEWpZVQjQPsWDsjj 6BtWmlSUgFxz+hYuuyvsvFgVcSweUzkbWcDk32c5i0xW2ZglaelcGyJPJhcLMTkF2bmZfj hR1Qgpb6demi7x82uZFiJpj5Lj6+M6Z4d/2SsuWF+TwYV+vdGBBssmkfgoKgKaUs7DSOYY 9SoQuP11ok8MkWh8U64gPCCzePDVGzh8E3o78LYNudjpOpsxXZ8iRDt+RRJT2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668331008; 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=9BBizL81tIfM9Ukv24nR6qiKOdWm3kq1vh+jyuk4XTY=; b=kJkB8G70ox+13u2hIzsr6c2I2xXqLWyAEIGQ1z+KnVKBBlG4fLMud67UxubseYF4D8s1eg iHlNAb9WewsWjdl5g4oYH8edO/I2uFu3c8o7Ir8pvjn+Bk+pnyYtsE9IHo7ovhyA+Ivdt7 WMHYmpSk/Umud6ZdPksXYF3lBUyMgu8YrYxY97kSR1zycIXCL5d1D2WyvW7ofM1gdis2Zw UA4Ssk8g5EiPwcUwbMfhxZzkuyb+9fRaPCpIxe9Lr53z9iVVMmcTvqniSUTAcbgtEGfOz5 Hz/zQc69p+cEq/xJ9MPh1L94FJvb0MF9m65Qmj992cqalBG9j5td0IDF8CRBvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668331008; a=rsa-sha256; cv=none; b=Oy5epZ6I7ZNRkIchxWKAzNaff9jPzgtKRZ6iRyu+jgA/y2PCyvMXIapgWcGG6T0vj8ar2f zTZD5GjkkLimM8yDkmT7z73AeHIzT4BFd9Jfw8jPb3r1v61LxZi2ksk582FeOVua6eD384 8JHys3m4vERhjih41vQOcpbhu5uC+Up93/1ngkG2DSmUenhTFvtsdpyFDxvdfdprfepIvh IIIsLCy2Y0VODx0Gts7/JIY6n/ErjsHNBPNPfbqkY720d1JN8b2W8/OiHa+zaqRNjscQME 76Efnjl3hOxmQ/wVlU6TlvmqprB/VaZ/7s1ZT5fM1hvB5K1clFavyVXm81EtzA== 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 4N96Jc2ZMKzx9K; Sun, 13 Nov 2022 09:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AD9GmDb009035; Sun, 13 Nov 2022 09:16:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AD9Gm9j009034; Sun, 13 Nov 2022 09:16:48 GMT (envelope-from git) Date: Sun, 13 Nov 2022 09:16:48 GMT Message-Id: <202211130916.2AD9Gm9j009034@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: d941ffdc4f98 - main - stress2: Added a tmpfs regression test for Bug 223015 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: d941ffdc4f98543aa965c3a4636b6cb5c98cf6aa Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=d941ffdc4f98543aa965c3a4636b6cb5c98cf6aa commit d941ffdc4f98543aa965c3a4636b6cb5c98cf6aa Author: Peter Holm AuthorDate: 2022-11-13 09:15:21 +0000 Commit: Peter Holm CommitDate: 2022-11-13 09:15:21 +0000 stress2: Added a tmpfs regression test for Bug 223015 --- tools/test/stress2/misc/tmpfs25.sh | 86 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/tools/test/stress2/misc/tmpfs25.sh b/tools/test/stress2/misc/tmpfs25.sh new file mode 100755 index 000000000000..1057d054d266 --- /dev/null +++ b/tools/test/stress2/misc/tmpfs25.sh @@ -0,0 +1,86 @@ +#!/bin/sh + +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2022 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. +# + +# Regression test for: +# Bug 223015 - [tmpfs] [patch] tmpfs does not support sparse files + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + +set -eu +prog=$(basename "$0" .sh) +cont=/tmp/$prog.cont +sync=/tmp/$prog.sync +mount | grep -q "on $mntpoint " && umount $mntpoint +mount -t tmpfs -o size=100m dummy $mntpoint +iused=`df $mntpoint | tail -1 | awk '{print $3}'` + +list="1m 10m 40m 45m 49m 50m 60m 100m 1g 4g" +r=0 +for s in $list; do + truncate -s $s $mntpoint/sparse || { + echo "truncate -s $s failed" + r=1; break 2 + } + rm $mntpoint/sparse || break + used=`df $mntpoint | tail -1 | awk '{print $3}'` + [ $used -ne $iused ] && { + echo "truncate -s $s test: $iused / $used"; r=1; break; } +done + +touch $cont +for i in `jot 1000`; do + [ $r -ne 0 ] && break + file=$mntpoint/sparse.$i + for s in $list; do + [ ! -f $cont ] && break + for n in `jot 300`; do [ -f $sync ] && break; sleep .2; done + truncate -s $s $file || { + echo "truncate -s $s failed" + rm -f $cont + break + } + [ -f $file ] || { echo "No file $file"; break; } + rm $file || break + done & +done +touch $sync +wait + +used=`df $mntpoint | tail -1 | awk '{print $3}'` +if [ $used -ne $iused ]; then + [ `ls -al $mntpoint | wc -l` -gt 3 ] && + ls -al $mntpoint | head -10 + df -i $mntpoint + fstat -f $mntpoint +fi +umount $mntpoint +rm -f $cont $sync + +exit $r