From patchwork Sun Jan 15 15:01:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9517447 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 D114760571 for ; Sun, 15 Jan 2017 15:01:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5CC428420 for ; Sun, 15 Jan 2017 15:01:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAA322842D; Sun, 15 Jan 2017 15:01:41 +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 1D3F928428 for ; Sun, 15 Jan 2017 15:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751241AbdAOPBg (ORCPT ); Sun, 15 Jan 2017 10:01:36 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36394 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdAOPBe (ORCPT ); Sun, 15 Jan 2017 10:01:34 -0500 Received: by mail-wm0-f68.google.com with SMTP id r126so24471192wmr.3; Sun, 15 Jan 2017 07:01:33 -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=r+CrK/L74iBEuT7ObrbEbGIxMmkf+AvUYXpQNgj1F8Q=; b=g6EpVMYex8O3qOVm7Qld9uG2t8ZffFnaZFgXHhy4Z8FWS5Uw/ve0UOY8RG7lTQrhKh n+jtL4RJKKRZ3gMmMdnRy9z+BOo+cXuieNpy+HN4z0/vPIOX4dwEerBeTeqToP5jr+4X PkQg0xYOqGgMhVo7xY/4V6g0v71/7BLMZ5MftqDZDXLxdk/lcsLuauaKBoMeS2KmBpZe GBYWf+O2ZESKF1DaSFOpNHxZfuPcn1L1WBJ31/h7d1hTaXMfEqGdHYMNqd0tJ/AYr6Jv qmwxWz6M09se34tdp4VfwCxL8uCCdqeelTAwWHmnH6jiZojxTNScG0nlmCi0dCyyhjHT b7Mw== 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=r+CrK/L74iBEuT7ObrbEbGIxMmkf+AvUYXpQNgj1F8Q=; b=SQlqCCo/UZQhxbzURj3jtZmjU1VrrgrjbGX2tU91K6lc+tvSlqmPfQPu8M76m8F4Xc BG7n079OM76qu5SXFzC3WKqAL3pjyTxDO9Q3Oy262FL/RdqJl/pVAt1ZWIYvXTSrizCx oPDar75PEh3z5rKN8O2YsBvY8bPmgqUbb1mI+p9Eh+4ROwtYaGzWs/KvyM3YvJK0sj/w i1wCKDAHU26SMdntSWg15jawxSxXIXHHitdceyaIyjNOHFyF2gKKSpmbdnYx0rzwV0ly NBDArM6us9MOsQTY0HzQ5yol6DZgqbEO6OZqnQoO2QF1W40eUfSzXqiQYt1PZ08mUPAB wpuA== X-Gm-Message-State: AIkVDXJl8hBFteW93TXuYwKhjbNahfgukodyIzlIh5u+Wehu+NVUcIv8BXyxXC+vAOWy2A== X-Received: by 10.223.170.139 with SMTP id h11mr22737258wrc.91.1484492492230; Sun, 15 Jan 2017 07:01:32 -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 197sm21537367wmy.16.2017.01.15.07.01.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Jan 2017 07:01:31 -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 17:01:18 +0200 Message-Id: <1484492478-13883-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 | 163 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/021.out | 2 + tests/overlay/group | 1 + 3 files changed, 166 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..405d3d0 --- /dev/null +++ b/tests/overlay/021 @@ -0,0 +1,163 @@ +#! /bin/bash +# FS QA Test 021 +# +# test concurrent copy up +# +#----------------------------------------------------------------------- +# Copyright (C) 2016 CTERA Networks. All Rights Reserved. +# Author: Amir Goldstein +# +# 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