From patchwork Sat Jun 2 18:52:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10444961 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 0BBA7602BC for ; Sat, 2 Jun 2018 18:50:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED2C028ABA for ; Sat, 2 Jun 2018 18:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCCEA28AC3; Sat, 2 Jun 2018 18:50:55 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, 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 4630328ABA for ; Sat, 2 Jun 2018 18:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751727AbeFBSuy (ORCPT ); Sat, 2 Jun 2018 14:50:54 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:44249 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751342AbeFBSux (ORCPT ); Sat, 2 Jun 2018 14:50:53 -0400 Received: by mail-wr0-f194.google.com with SMTP id y15-v6so39213100wrg.11; Sat, 02 Jun 2018 11:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cl+sRzJXPPLdRTtb7822UAFN2IQupWEOJhDhx9Eoqtw=; b=W+4M5ICWsjv/J13RAKdnt60G/UTcqFv9TjjbHGEdaZgdS68nrnLZ5sbZkL/vS8AHnb tN8vgMdT1fvhPI1w+Oc809MtroWFTPOlbPrbBAPqaSGGv+Ycv8RmiIuv6+JWjN/x7a+b RALHvmnXAgLEmn+5rbpptkgq+02yWKTThy8FtPRNnfjbY5VTQj+zYCFp0sz9rQwcGKdl 5JNZPMMYaVPd7bTtkAvH6J5fpajm/wLx97THIdecc+JxlNRsBA8UezaIUjimt9/csSfl zrm9MFAcLxYcTK2ldpWM8vzSXAaIYAvutzBqydfDCIN1ZrU1tdcmsUvtigkm81nc4kt7 d8Bw== 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=cl+sRzJXPPLdRTtb7822UAFN2IQupWEOJhDhx9Eoqtw=; b=UHansi23k+ehm4dW0OdEpwh+OZ3Bhbw3SKMLvRPZZNbXlo9zWh9dVf1H1+RaEWfx0z Bd//yldwehS6jjVqZvFwA6PMQtYXm35K6xpYDZCzl+Tum1Bhj8Wg4L+XfALTjUxMhw7Y ArVvBGSKk1oH9pjVJRbDT6GHPWDI9Q4UUmqMw47dWyiBxAIrTge6pBji+H5182gOhE5O JySRQSb39Wj7QhhGC6pphy+osf1XJg6YTwQ8XH1gFcT59qlMmHgCWybDof9J4NuyEEKi ytADYz/3jhkAz2z65ap6tVFZ/pavElYfzQJMPRMZkVFInrbe9nuUxJvfwmOLwDW8Jk2T 9JGw== X-Gm-Message-State: ALKqPwfvF49h3KMuaBb/3kiCaHQrNj52J0IylmhdzmLSoGFvrLG/bGFL ecVW4y0OabQqnJszx8FaU9vR/A== X-Google-Smtp-Source: ADUXVKJO08FyH8OwqKZS6q5olF+atSPRk78uY95DQ5DqHjY9fLHPLY/GPU7wfP/SAKZqItE449OMVw== X-Received: by 2002:adf:ea44:: with SMTP id j4-v6mr11962324wrn.224.1527965452288; Sat, 02 Jun 2018 11:50:52 -0700 (PDT) Received: from localhost.localdomain ([141.226.15.87]) by smtp.gmail.com with ESMTPSA id 136-v6sm6224392wmo.12.2018.06.02.11.50.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Jun 2018 11:50:51 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Vivek Goyal , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v2 2/2] overlay/016: split into two tests Date: Sat, 2 Jun 2018 21:52:19 +0300 Message-Id: <1527965539-30607-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 overlay/016 tests two cases of ro/rw fd data inconsistecies - one using pread and one using mmap read (i.e. mread). The first case will pass as soon as stacked overlay operations patch set is merged. The second case requires enabling a new opt-in feature "copy_up_shared" in order to pass. Instead of changing the entire test from fail to notrun, split the two cases into two tests and require the new feature only for the new test. This way, the new test will change from notrun to pass with stacked overlay operations and the old test will change from fail to pass. Signed-off-by: Amir Goldstein Reviewed-by: Vivek Goyal --- Changes from v1: - Remove unused file bar and use only foo (Vivek) tests/overlay/016 | 15 --------- tests/overlay/016.out | 3 -- tests/overlay/061 | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/061.out | 4 +++ tests/overlay/group | 1 + 5 files changed, 89 insertions(+), 18 deletions(-) create mode 100755 tests/overlay/061 create mode 100644 tests/overlay/061.out diff --git a/tests/overlay/016 b/tests/overlay/016 index 86a7d28..06d1101 100755 --- a/tests/overlay/016 +++ b/tests/overlay/016 @@ -60,13 +60,11 @@ _scratch_mkfs >>$seqres.full 2>&1 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER mkdir -p $lowerdir echo "This is old news" > $lowerdir/foo -echo "This is old news" > $lowerdir/bar _scratch_mount # -# case #1: # open file for read (rofd) # open file for write (rwfd) # write to rwfd @@ -79,18 +77,5 @@ $XFS_IO_PROG -r $SCRATCH_MNT/foo \ -C "pread -v 0 16" \ | _filter_xfs_io | _filter_scratch -# -# case #2: -# mmap MAP_SHARED|PROT_READ of rofd -# write to rwfd -# read from mapped memory -# -$XFS_IO_PROG -r $SCRATCH_MNT/bar \ - -C "mmap -r 0 16" \ - -C "open $SCRATCH_MNT/bar" \ - -C "pwrite -S 0x61 0 16" \ - -C "mread -v 0 16" \ -| _filter_xfs_io | _filter_scratch - status=0 exit diff --git a/tests/overlay/016.out b/tests/overlay/016.out index a28aaa6..02b2ae2 100644 --- a/tests/overlay/016.out +++ b/tests/overlay/016.out @@ -6,6 +6,3 @@ XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 00000000: 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa read 16/16 bytes at offset 0 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -wrote 16/16 bytes at offset 0 -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -00000000: 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa diff --git a/tests/overlay/061 b/tests/overlay/061 new file mode 100755 index 0000000..2324e48 --- /dev/null +++ b/tests/overlay/061 @@ -0,0 +1,84 @@ +#! /bin/bash +# FSQA Test No. 061 +# +# Test ro/rw fd data inconsistecies +# +# This is a variant of test overlay/016 with mread instead of pread. +# This test requires and enables copy_up_shared feature. +# +# This simple test demonstrates a known issue with overlayfs: +# - process A opens file F for read + mmap +# - process B writes new data to file F +# - process A reads old data from mapped memory +# +#----------------------------------------------------------------------- +# +# 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" + +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 + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch +_require_scratch_feature copy_up_shared +_require_xfs_io_command "open" + +rm -f $seqres.full + +_scratch_mkfs >>$seqres.full 2>&1 + +# Create our test files. +lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER +mkdir -p $lowerdir +echo "This is old news" > $lowerdir/foo + +_scratch_mount -o copy_up_shared=on + + +# +# mmap MAP_SHARED|PROT_READ of rofd +# write to rwfd +# read from mapped memory +# +$XFS_IO_PROG -r $SCRATCH_MNT/foo \ + -C "mmap -r 0 16" \ + -C "open $SCRATCH_MNT/foo" \ + -C "pwrite -S 0x61 0 16" \ + -C "mread -v 0 16" \ +| _filter_xfs_io | _filter_scratch + +status=0 +exit diff --git a/tests/overlay/061.out b/tests/overlay/061.out new file mode 100644 index 0000000..0662721 --- /dev/null +++ b/tests/overlay/061.out @@ -0,0 +1,4 @@ +QA output created by 061 +wrote 16/16 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +00000000: 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa diff --git a/tests/overlay/group b/tests/overlay/group index b73d7e9..ccc71f3 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -63,3 +63,4 @@ 058 auto quick exportfs 059 auto quick copyup 060 auto quick metacopy +061 auto quick copyup