From patchwork Fri Nov 13 21:37:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 7614811 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A959C9F2E2 for ; Fri, 13 Nov 2015 21:44:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F79320660 for ; Fri, 13 Nov 2015 21:44:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0284C205E7 for ; Fri, 13 Nov 2015 21:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbbKMVic (ORCPT ); Fri, 13 Nov 2015 16:38:32 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:29902 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751246AbbKMViW (ORCPT ); Fri, 13 Nov 2015 16:38:22 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tADLbqqu000706 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 Nov 2015 21:37:52 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id tADLbpx0025926 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 13 Nov 2015 21:37:52 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id tADLboPd028684; Fri, 13 Nov 2015 21:37:50 GMT Received: from localhost (/71.198.20.188) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Nov 2015 13:37:50 -0800 Subject: [PATCH 10/12] reflink: concurrent operations tests From: "Darrick J. Wong" To: david@fromorbit.com, darrick.wong@oracle.com Cc: fstests@vger.kernel.org, xfs@oss.sgi.com, hch@infradead.org, tao.peng@primarydata.com, linux-ext4@vger.kernel.org, Anna.Schumaker@netapp.com, linux-btrfs@vger.kernel.org Date: Fri, 13 Nov 2015 13:37:49 -0800 Message-ID: <20151113213749.31124.34969.stgit@birch.djwong.org> In-Reply-To: <20151113213643.31124.80975.stgit@birch.djwong.org> References: <20151113213643.31124.80975.stgit@birch.djwong.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure that running reflink ops while other IO is ongoing doesn't break the filesystem. Signed-off-by: Darrick J. Wong --- tests/generic/161 | 79 +++++++++++++++++++++++++++++++++++++ tests/generic/161.out | 6 +++ tests/generic/162 | 95 ++++++++++++++++++++++++++++++++++++++++++++ tests/generic/162.out | 7 +++ tests/generic/163 | 95 ++++++++++++++++++++++++++++++++++++++++++++ tests/generic/163.out | 7 +++ tests/generic/164 | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/164.out | 7 +++ tests/generic/165 | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/165.out | 7 +++ tests/generic/166 | 93 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/166.out | 6 +++ tests/generic/167 | 93 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/167.out | 6 +++ tests/generic/168 | 97 +++++++++++++++++++++++++++++++++++++++++++++ tests/generic/168.out | 6 +++ tests/generic/170 | 97 +++++++++++++++++++++++++++++++++++++++++++++ tests/generic/170.out | 6 +++ tests/generic/group | 9 ++++ 19 files changed, 926 insertions(+) create mode 100755 tests/generic/161 create mode 100644 tests/generic/161.out create mode 100755 tests/generic/162 create mode 100644 tests/generic/162.out create mode 100755 tests/generic/163 create mode 100644 tests/generic/163.out create mode 100755 tests/generic/164 create mode 100644 tests/generic/164.out create mode 100755 tests/generic/165 create mode 100644 tests/generic/165.out create mode 100755 tests/generic/166 create mode 100644 tests/generic/166.out create mode 100755 tests/generic/167 create mode 100644 tests/generic/167.out create mode 100755 tests/generic/168 create mode 100644 tests/generic/168.out create mode 100755 tests/generic/170 create mode 100644 tests/generic/170.out -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tests/generic/161 b/tests/generic/161 new file mode 100755 index 0000000..efb137c --- /dev/null +++ b/tests/generic/161 @@ -0,0 +1,79 @@ +#! /bin/bash +# FS QA Test No. 161 +# +# Test for race between delete a file while rewriting its reflinked twin +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=4096 +BLKSZ=65536 + +echo "Initialize files" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_cp_reflink "$TESTDIR/file1" "$TESTDIR/file2" +_scratch_remount + +echo "Delete while rewriting" +rm -rf "$TESTDIR/file1" & +_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +wait + +echo "Check fs" +umount "$SCRATCH_MNT" +_check_scratch_fs + +echo "Done" +# success, all done +status=0 +exit diff --git a/tests/generic/161.out b/tests/generic/161.out new file mode 100644 index 0000000..1db11c3 --- /dev/null +++ b/tests/generic/161.out @@ -0,0 +1,6 @@ +QA output created by 161 +Format and mount +Initialize files +Delete while rewriting +Check fs +Done diff --git a/tests/generic/162 b/tests/generic/162 new file mode 100755 index 0000000..6bd3a33 --- /dev/null +++ b/tests/generic/162 @@ -0,0 +1,95 @@ +#! /bin/bash +# FS QA Test No. 162 +# +# Test for race between dedupe and writing the dest file +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_dedupe + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=512 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize files" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full" +_scratch_remount + +overwrite() { + while [ ! -e "$TESTDIR/finished" ]; do + seq $nr_loops -1 0 | while read i; do + _pwrite_byte 0x61 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full" + done + done +} + +echo "Dedupe and rewrite the file!" +overwrite & +for i in `seq 1 2`; do + seq $nr_loops -1 0 | while read i; do + _dedupe_range "$TESTDIR/file1" $((i * BLKSZ)) \ + "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && break + done +done +echo "Finished dedupeing" +touch "$TESTDIR/finished" +wait + +echo "Check fs" +umount "$SCRATCH_MNT" +_check_scratch_fs + +echo "Done" +# success, all done +status=0 +exit diff --git a/tests/generic/162.out b/tests/generic/162.out new file mode 100644 index 0000000..4481f8c --- /dev/null +++ b/tests/generic/162.out @@ -0,0 +1,7 @@ +QA output created by 162 +Format and mount +Initialize files +Dedupe and rewrite the file! +Finished dedupeing +Check fs +Done diff --git a/tests/generic/163 b/tests/generic/163 new file mode 100755 index 0000000..1f5042f --- /dev/null +++ b/tests/generic/163 @@ -0,0 +1,95 @@ +#! /bin/bash +# FS QA Test No. 163 +# +# Test for race between dedupe and writing the source file +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_dedupe + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=512 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize files" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full" +_scratch_remount + +overwrite() { + while [ ! -e "$TESTDIR/finished" ]; do + seq $nr_loops -1 0 | while read i; do + _pwrite_byte 0x61 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full" + done + done +} + +echo "Dedupe and rewrite the file!" +overwrite & +for i in `seq 1 2`; do + seq $nr_loops -1 0 | while read i; do + _dedupe_range "$TESTDIR/file1" $((i * BLKSZ)) \ + "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && break + done +done +echo "Finished dedupeing" +touch "$TESTDIR/finished" +wait + +echo "Check fs" +umount "$SCRATCH_MNT" +_check_scratch_fs + +echo "Done" +# success, all done +status=0 +exit diff --git a/tests/generic/163.out b/tests/generic/163.out new file mode 100644 index 0000000..2d27d1b --- /dev/null +++ b/tests/generic/163.out @@ -0,0 +1,7 @@ +QA output created by 163 +Format and mount +Initialize files +Dedupe and rewrite the file! +Finished dedupeing +Check fs +Done diff --git a/tests/generic/164 b/tests/generic/164 new file mode 100755 index 0000000..4df953d --- /dev/null +++ b/tests/generic/164 @@ -0,0 +1,105 @@ +#! /bin/bash +# FS QA Test No. 164 +# +# Test for races or FS corruption between reflink and buffered I/O reading the +# target file. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=512 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize files" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full" +_cp_reflink "$TESTDIR/file1" "$TESTDIR/file3" +_scratch_remount + +fbytes() { + egrep -v '(61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61|62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62)' +} + +reader() { + while [ ! -e "$TESTDIR/finished" ]; do + _read_range "$TESTDIR/file3" 0 $((loops * BLKSZ)) | fbytes + done +} + +echo "Reflink and reread the files!" +reader & +for i in `seq 1 2`; do + seq $nr_loops -1 0 | while read i; do + _reflink_range "$TESTDIR/file1" $((i * BLKSZ)) \ + "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && break + done + seq $nr_loops -1 0 | while read i; do + _reflink_range "$TESTDIR/file2" $((i * BLKSZ)) \ + "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && break + done +done +echo "Finished reflinking" +touch "$TESTDIR/finished" +wait + +echo "Check fs" +umount "$SCRATCH_MNT" +_check_scratch_fs + +echo "Done" +# success, all done +status=0 +exit diff --git a/tests/generic/164.out b/tests/generic/164.out new file mode 100644 index 0000000..0b4ed70 --- /dev/null +++ b/tests/generic/164.out @@ -0,0 +1,7 @@ +QA output created by 164 +Format and mount +Initialize files +Reflink and reread the files! +Finished reflinking +Check fs +Done diff --git a/tests/generic/165 b/tests/generic/165 new file mode 100755 index 0000000..49187ec --- /dev/null +++ b/tests/generic/165 @@ -0,0 +1,105 @@ +#! /bin/bash +# FS QA Test No. 165 +# +# Test for races or FS corruption between reflink and direct I/O reading the +# target file. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=512 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize files" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full" +_cp_reflink $TESTDIR/file1 $TESTDIR/file3 +_scratch_remount + +fbytes() { + egrep -v '(61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61|62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62)' +} + +reader() { + while [ ! -e "$TESTDIR/finished" ]; do + _read_range "$TESTDIR/file3" 0 $((loops * BLKSZ)) -d | fbytes + done +} + +echo "Reflink and dio reread the files!" +reader & +for i in `seq 1 2`; do + seq $nr_loops -1 0 | while read i; do + _reflink_range "$TESTDIR/file1" $((i * BLKSZ)) \ + "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && break + done + seq $nr_loops -1 0 | while read i; do + _reflink_range "$TESTDIR/file2" $((i * BLKSZ)) \ + "$TESTDIR/file3" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && break + done +done +echo "Finished reflinking" +touch "$TESTDIR/finished" +wait + +echo "Check fs" +umount "$SCRATCH_MNT" +_check_scratch_fs + +echo "Done" +# success, all done +status=0 +exit diff --git a/tests/generic/165.out b/tests/generic/165.out new file mode 100644 index 0000000..a89071d --- /dev/null +++ b/tests/generic/165.out @@ -0,0 +1,7 @@ +QA output created by 165 +Format and mount +Initialize files +Reflink and dio reread the files! +Finished reflinking +Check fs +Done diff --git a/tests/generic/166 b/tests/generic/166 new file mode 100755 index 0000000..71eb2ab --- /dev/null +++ b/tests/generic/166 @@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test No. 166 +# +# Test for races or FS corruption when DIO writing to a file that's also +# the source of a reflink operation. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=1024 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize file" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_scratch_remount + +# Snapshot creator... +snappy() { + n=0 + while [ ! -e "$TESTDIR/finished" ]; do + _cp_reflink "$TESTDIR/file1" "$TESTDIR/snap_$n" || break + n=$((n + 1)) + done +} + +echo "Snapshot a file undergoing directio rewrite" +snappy & +seq $nr_loops -1 0 | while read i; do + _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ -d "$TESTDIR/file1" >> "$seqres.full" +done +touch $TESTDIR/finished +wait + +echo "Check for damage" +umount $SCRATCH_MNT +_check_scratch_fs + +echo "Done" + +# success, all done +status=0 +exit diff --git a/tests/generic/166.out b/tests/generic/166.out new file mode 100644 index 0000000..a2ba34e --- /dev/null +++ b/tests/generic/166.out @@ -0,0 +1,6 @@ +QA output created by 166 +Format and mount +Initialize file +Snapshot a file undergoing directio rewrite +Check for damage +Done diff --git a/tests/generic/167 b/tests/generic/167 new file mode 100755 index 0000000..c4e6ce8 --- /dev/null +++ b/tests/generic/167 @@ -0,0 +1,93 @@ +#! /bin/bash +# FS QA Test No. 167 +# +# Test for races or FS corruption when writing to a file that's also +# the source of a reflink operation. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_cp_reflink + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=1024 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize file" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_scratch_remount + +# Snapshot creator... +snappy() { + n=0 + while [ ! -e "$TESTDIR/finished" ]; do + _cp_reflink "$TESTDIR/file1" "$TESTDIR/snap_$n" || break + n=$((n + 1)) + done +} + +echo "Snapshot a file undergoing buffered rewrite" +snappy & +seq $nr_loops -1 0 | while read i; do + _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file1" >> "$seqres.full" +done +touch $TESTDIR/finished +wait + +echo "Check for damage" +umount $SCRATCH_MNT +_check_scratch_fs + +echo "Done" + +# success, all done +status=0 +exit diff --git a/tests/generic/167.out b/tests/generic/167.out new file mode 100644 index 0000000..7cfb14e --- /dev/null +++ b/tests/generic/167.out @@ -0,0 +1,6 @@ +QA output created by 167 +Format and mount +Initialize file +Snapshot a file undergoing buffered rewrite +Check for damage +Done diff --git a/tests/generic/168 b/tests/generic/168 new file mode 100755 index 0000000..414dcb0 --- /dev/null +++ b/tests/generic/168 @@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test No. 168 +# +# Test for races or FS corruption when writing to a file that's also +# the target of a reflink operation. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=1024 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize files" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full" +_scratch_remount + +# Direct I/O overwriter... +overwrite() { + while [ ! -e "$TESTDIR/finished" ]; do + seq $nr_loops -1 0 | while read i; do + _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full" + done + done +} + +echo "Reflink and write the target" +overwrite & +seq 1 10 | while read j; do + seq 0 $nr_loops | while read i; do + _reflink_range "$TESTDIR/file1" $((i * BLKSZ)) \ + "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && exit + done +done +touch "$TESTDIR/finished" +wait + +echo "Check for damage" +umount "$SCRATCH_MNT" +_check_scratch_fs + +echo "Done" + +# success, all done +status=0 +exit diff --git a/tests/generic/168.out b/tests/generic/168.out new file mode 100644 index 0000000..d0dd08e --- /dev/null +++ b/tests/generic/168.out @@ -0,0 +1,6 @@ +QA output created by 168 +Format and mount +Initialize files +Reflink and write the target +Check for damage +Done diff --git a/tests/generic/170 b/tests/generic/170 new file mode 100755 index 0000000..704b646 --- /dev/null +++ b/tests/generic/170 @@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test No. 170 +# +# Test for races or FS corruption when DIO writing to a file that's also +# the target of a reflink operation. +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename "$0"` +seqres="$RESULT_DIR/$seq" +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf "$tmp".* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink + +echo "Format and mount" +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount >> "$seqres.full" 2>&1 + +TESTDIR="$SCRATCH_MNT/test-$seq" +rm -rf "$TESTDIR" +mkdir "$TESTDIR" + +loops=1024 +nr_loops=$((loops - 1)) +BLKSZ=65536 + +echo "Initialize files" +echo > "$seqres.full" +_pwrite_byte 0x61 0 $((loops * BLKSZ)) "$TESTDIR/file1" >> "$seqres.full" +_pwrite_byte 0x62 0 $((loops * BLKSZ)) "$TESTDIR/file2" >> "$seqres.full" +_scratch_remount + +# Direct I/O overwriter... +overwrite() { + while [ ! -e "$TESTDIR/finished" ]; do + seq $nr_loops -1 0 | while read i; do + _pwrite_byte 0x63 $((i * BLKSZ)) $BLKSZ -d "$TESTDIR/file2" >> "$seqres.full" + done + done +} + +echo "Reflink and dio write the target" +overwrite & +seq 1 10 | while read j; do + seq 0 $nr_loops | while read i; do + _reflink_range "$TESTDIR/file1" $((i * BLKSZ)) \ + "$TESTDIR/file2" $((i * BLKSZ)) $BLKSZ >> "$seqres.full" + [ $? -ne 0 ] && exit + done +done +touch "$TESTDIR/finished" +wait + +echo "Check for damage" +umount "$SCRATCH_MNT" +_check_scratch_fs + +echo "Done" + +# success, all done +status=0 +exit diff --git a/tests/generic/170.out b/tests/generic/170.out new file mode 100644 index 0000000..103aaa5 --- /dev/null +++ b/tests/generic/170.out @@ -0,0 +1,6 @@ +QA output created by 170 +Format and mount +Initialize files +Reflink and dio write the target +Check for damage +Done diff --git a/tests/generic/group b/tests/generic/group index 0a20421..6ae3105 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -163,7 +163,16 @@ 158 auto quick clone 159 auto quick clone 160 auto quick clone +161 auto quick clone +162 auto quick clone +163 auto quick clone +164 auto quick clone +165 auto quick clone +166 auto quick clone +167 auto quick clone +168 auto quick clone 169 rw metadata auto quick +170 auto quick clone 184 metadata auto quick 192 atime auto 193 metadata auto quick