From patchwork Sun Jan 15 14:56:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9517429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 72BDF60571 for ; Sun, 15 Jan 2017 14:57:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 644F52840F for ; Sun, 15 Jan 2017 14:57:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56E5B28411; Sun, 15 Jan 2017 14:57:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADC1C2840F for ; Sun, 15 Jan 2017 14:57:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751107AbdAOO5U (ORCPT ); Sun, 15 Jan 2017 09:57:20 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35368 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036AbdAOO5T (ORCPT ); Sun, 15 Jan 2017 09:57:19 -0500 Received: by mail-wm0-f66.google.com with SMTP id d140so8024425wmd.2; Sun, 15 Jan 2017 06:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Sz/EhlzYab+vXEuAWmJci0rBxHebarckFxkIifYCqAs=; b=BfF/aMTtTVs7TszBuQ41+zlcF9v832EKSY13wnj04V8gEwKAkxCR1bPlTsLQC1DQYL cI/mvU6Es01wFevSvaQ+K12E9DcqMKhB5zLaM7UQ63RxolSF1jTGhofKBsIE1yU0h1W9 kijaPDLOcyYccddsmVpy0m5+QFHMUSOBenU5rNAyldnMdd+VOZ4bKstpa3WESWAQsadi 7mN0lD6+5qTmTcE0seu8zSGjhXzklK5DrkyM4W1zFQUr696s5wPm+L5bPN8A2uFY6h/R WmP9rSl+U0t+1vRXKXF54jqbY9kF/KAwbhPDlfOiYYQ0Az5lba1xygeWNS4snzEYlldB 9n8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Sz/EhlzYab+vXEuAWmJci0rBxHebarckFxkIifYCqAs=; b=o5bR5AVk0OdzdLZ92IDTzqMK4hGlfGbdzOPcuOgPgL2M/ZEQxIBD1ywmN3toRqvhfb ek15JxEMmSw8eepVX3+EGAOA/YCMsqGqQtLTyrx8upSjNlSbOBNBoOaK063ZxcwMol7D MR0yJw+hQmiAcD+qs66VHmB1cdwJ8ruwLRYjc6vS4jtB7oxKOsHblF7xi/hh67mnGQvO H3+kmvVRrQOXX0zymXwYCxebfjS/yCg7YS9xtUslzf6jVDioqxKeITsQpftsVolo6fRV XprY3BfpDIybSw5bAT9CUxR8a0UH+0VlJGeIvnXLI7ENV7u/UEhK2heqQAmjT679Jfe7 A2VQ== X-Gm-Message-State: AIkVDXKv2OzGaQyNkx/gWRkOb6Ibe2gIBNvnIgzk+AX87BcOts1JDQMKZwHgk4hoovs6/g== X-Received: by 10.223.166.106 with SMTP id k97mr22069750wrc.170.1484492237391; Sun, 15 Jan 2017 06:57:17 -0800 (PST) Received: from amir-VirtualBox.ctera.local (bzq-82-81-193-202.cablep.bezeqint.net. [82.81.193.202]) by smtp.gmail.com with ESMTPSA id l9sm21455497wmf.18.2017.01.15.06.57.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Jan 2017 06:57:16 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH] overlay: test concurrent copy up Date: Sun, 15 Jan 2017 16:56:59 +0200 Message-Id: <1484492219-13675-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Run 4 process pairs, each competing over copy up of 1K files in 1 directory. One opponent touches all files in the directory and the other truncates all files in the directory. This test does NOT check for concurrent copy up support. It only fails on unexpected errors of any of the touch/truncate operations. The test full output should demonstrate the expected results - for kernel with concurrent copy up support, truncate workers are not delayed by touch workers. As a result, truncate workers will finish their work much sooner than a test run without concurrent copy up support. Signed-off-by: Amir Goldstein --- tests/overlay/021 | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/021.out | 2 + tests/overlay/group | 1 + 3 files changed, 165 insertions(+) create mode 100755 tests/overlay/021 create mode 100644 tests/overlay/021.out Eryu, I wrote this test to excercise "ovl: concurrent copy up", but it does not require concurrent copy up support to run, nor does it fail due to lack of concurrent copy up support (it may run a bit slower), so there is nothing blocking from merging this test for kernel 4.9. Note that although I used fsstress to create/truncate a bunch of files, this is by no means a stress test, so I did not add it to stress group. It is rather 'quick', less than half the time of the 'quick' overlay/001. Amir. diff --git a/tests/overlay/021 b/tests/overlay/021 new file mode 100755 index 0000000..3140cc6 --- /dev/null +++ b/tests/overlay/021 @@ -0,0 +1,162 @@ +#! /bin/bash +# FS QA Test 021 +# +# test concurrent copy up +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 Google, 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 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch + +# Remove all files from previous tests +_scratch_mkfs + +# overlay copy_up doesn't deal with sparse file well, holes will be filled by +# zeros, so for the worst case of hitting all the copy up bomb files, we need +# (64*(16+32+64+128)M) free space on $SCRATCH_DEV. +# However, triggering more than a total of 16 copy up bombs would require +# really fast data copy (clone up doesn't take up space at all), so let's be +# conservative and reserve space for 16 data copy ups per directory. +_require_fs_space $SCRATCH_DEV $((16*(16+32+64+128)*1024)) + +lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR +mkdir -p $lowerdir + +_scratch_mount + +echo "Silence is golden" + +testdir=arena +d_low=$lowerdir/$testdir +d_top=$SCRATCH_MNT/$testdir +mkdir -p $d_low + +# Create 4K empty files in 4 directories +echo $FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full +$FSSTRESS_PROG -d $d_low -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full 2>&1 +echo "--------------------------------------" >> $seqres.full +echo "Created 1K files in lower directory. " >> $seqres.full + +# Plant 64 copy up bombs in each directory +for f in $d_low/p0/*0; do truncate -s 128M $f ;done +for f in $d_low/p1/*4; do truncate -s 64M $f ;done +for f in $d_low/p2/*8; do truncate -s 32M $f ;done +for f in $d_low/p3/*b; do truncate -s 16M $f ;done +echo "Created 64*4 copy up bombs. " >> $seqres.full +echo "--------------------------------------" >> $seqres.full + +# +# Run 2 process teams - 4 pairs of rival processes +# Each process pair competing on copy up of 1K files in 1 directory. +# Team 'touch' players touch all files in readdir order. +# Team 'truncate' players truncates all files in numeric (name) order. +# +# If player from team 'touch' reaches a copy up bomb before player +# from team 'truncate' does, the copy up of (sparse) data will delay +# the end of the process pair match. +# +# If copy up of bomb is not concurrent with other copy ups, then +# 'touch' player p0 with the largest copy up bombs will delay players +# of both teams and all matches will take longer. +# +# If copy up is concurrent with copy ups in different directories, +# process pair 3 match will be over first and process pair 0 match +# will be over last. +# +# If copy up of data is concurrent with other copy ups on the same directory, +# then all the 'touch' team players will finish far behind their 'truncate' +# opponenets. +# +# This test doesn't verify any of those conditions, it will only fail +# on unexpected errors of any of the touch/truncate operations. +# The test full output should demonstrate the expected game results, +# as described above and depending on concurrent copy up support in kernel. +# +cd $d_top +echo "--------------------------------------" >> $seqres.full +echo "Go team touch!! " >> $seqres.full +find p0 -type f -print -exec touch {} \; >> $seqres.full 2>&1 & +find p1 -type f -print -exec touch {} \; >> $seqres.full 2>&1 & +find p2 -type f -print -exec touch {} \; >> $seqres.full 2>&1 & +find p3 -type f -print -exec touch {} \; >> $seqres.full 2>&1 & +cd - > /dev/null + +# Give team 'touch' a 1 second head start. +# Team 'truncate' players should catch up after few copy up bombs. +sleep 1 +echo "--------------------------------------" >> $seqres.full +echo "Go team truncate!! " >> $seqres.full +# Give team 'touch' a 1 second head start. +# Team 'truncate' players should catch up after few copy up bombs. +sleep 1 +$FSSTRESS_PROG -d $d_top -p 4 -z -f creat=1 -n 1024 -v >> $seqres.full 2>&1 & + +err=0 +if ! wait %1; then + echo "Player p0/touch returned $? - see $seqres.full" + err=1 +fi + +if ! wait %2; then + echo "Player p1/touch returned $? - see $seqres.full" + err=1 +fi + +if ! wait %3; then + echo "Player p2/touch returned $? - see $seqres.full" + err=1 +fi + +if ! wait %4; then + echo "Player p3/touch returned $? - see $seqres.full" + err=1 +fi + +if ! wait %5; then + echo "Team truncate returned $? - see $seqres.full" + err=1 +fi + +status=$err + +exit $status diff --git a/tests/overlay/021.out b/tests/overlay/021.out new file mode 100644 index 0000000..09f4062 --- /dev/null +++ b/tests/overlay/021.out @@ -0,0 +1,2 @@ +QA output created by 021 +Silence is golden diff --git a/tests/overlay/group b/tests/overlay/group index 684ed45..5bcc25e 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -23,3 +23,4 @@ 018 auto quick copyup 019 auto stress 020 auto quick copyup perms +021 auto quick copyup