From patchwork Fri Aug 24 04:40:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10574807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 506321390 for ; Fri, 24 Aug 2018 04:39:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 417812C4D5 for ; Fri, 24 Aug 2018 04:39:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3453B2C4E1; Fri, 24 Aug 2018 04:39:03 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 AAAFE2C4D5 for ; Fri, 24 Aug 2018 04:38:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726256AbeHXILu (ORCPT ); Fri, 24 Aug 2018 04:11:50 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36319 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbeHXILu (ORCPT ); Fri, 24 Aug 2018 04:11:50 -0400 Received: by mail-wr1-f68.google.com with SMTP id m27-v6so6333844wrf.3; Thu, 23 Aug 2018 21:38:55 -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=uDoTvYJ4PXiwq9FZYGImeFnZg59kfbbTY/BEH1ndOr0=; b=BabKIC3kvzSgTs7f06O2uakvl6b8JreTBYYn31SX9l6Uj6yl7LxlnRV7rjioKvJlrP epKTbbZyLb3kJCPmvvFA4eqTE4Gs6R+PwB7DFgR/6LBkZX8hgR5vUNRFT3URJusDCj9b mN1Hsah6iRLizMix/yj7NwthjWGYjX0JEp1JPET8o9wJZ9/SmHeLUALTV8gVYUiwDYgs zEg82X/vCdDBc7BGTQIrbNeZ/suF6yXLjulkxLmOLmFJsdzz27gzOg7dyR9ViSmsBjzj FEm/lES2lB7PrwEfYZpodijeZ0jBsHTyO/7uI1FMcR8LH7NCUn1znpqjC//stQXjN0Zu 2ftA== 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=uDoTvYJ4PXiwq9FZYGImeFnZg59kfbbTY/BEH1ndOr0=; b=GqOk3eFVURgwjiu91RbxiQWXViRAn9fJqP6m2FocQhPFHR2qd9K/0d7uvZDcYS/tFE 8lBvniWOJE5RRxp2GBGy+NtKvuJE9v7/xp0JPq7g/Vaxb4NMhufnvbfrX+sS2nUDb6Fj aSE22e5Q7A2ZjAMsOvOPPWtD0r/AsqL6Xwzlf+MVA2kJAnENMohA/PHhiqYRnCNaHUzE ji30r3tSms0sWo9nwRNzkDQLD4QweDzZiSgalf+KNSi1cfLBV8iZlrFic/5W+IeiUcal sh/JCuW2OeKDSS3+hywDge/PE7ffcS5aAAZlhE3+4G//HiP+O29x5MCP9ftCcCGLhaHX SY/A== X-Gm-Message-State: APzg51DzUs7WBDF61Uqcz56X2liCO0gqTCY/kMY4kcfwOuc3BZLz5UMs 5FC35+csd3QMJ143sxWxWu0= X-Google-Smtp-Source: ANB0VdYX5SLe28vKFTfA3Yj2KgR6Ng86UfxZduBuWc4QfTkTx3gQ56Gf6CeLLL/cgM5CtpNja69Kig== X-Received: by 2002:adf:ffc7:: with SMTP id x7-v6mr14781wrs.137.1535085534461; Thu, 23 Aug 2018 21:38:54 -0700 (PDT) Received: from localhost.localdomain ([141.226.8.68]) by smtp.gmail.com with ESMTPSA id u65-v6sm369835wmd.31.2018.08.23.21.38.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Aug 2018 21:38:53 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Vivek Goyal , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v3] overlay/016: split into two tests Date: Fri, 24 Aug 2018 07:40:44 +0300 Message-Id: <1535085644-23131-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 now passes with stacked overlay file operations patch set merged. The second case will still fail. By splitting the two test cases we get one regression test for the common case of ro/rw fd data inconsistecy with pread and one test to track the remaining non-standard behavior of overlayfs w.r.t mmap. Signed-off-by: Amir Goldstein --- Eryu, The overlayfs ro/rw fd data inconsistecies patches were finally merged, so we can now merge this test change to reflect new behavior. After this change on current master: - overlay/16 is expected to pass - overlay/61 is expected to fail FYI, overlay/60 (new metacopy feature test) is also expected to run and pass on master. Thanks, Amir. Changes from v2: - remove unimplemented feature copy_up_shared tests/overlay/016 | 15 ------------ tests/overlay/016.out | 3 --- tests/overlay/061 | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/061.out | 4 ++++ tests/overlay/group | 1 + 5 files changed, 70 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 5c5d9ab..4fcb31e 100755 --- a/tests/overlay/016 +++ b/tests/overlay/016 @@ -43,13 +43,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 @@ -62,18 +60,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..4b653ab --- /dev/null +++ b/tests/overlay/061 @@ -0,0 +1,65 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018 CTERA Networks. All Rights Reserved. +# +# FSQA Test No. 061 +# +# Test ro/rw fd data inconsistecies +# +# This is a variant of test overlay/016 with mread instead of pread. +# +# 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 +# +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_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 + + +# +# 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