From patchwork Wed Sep 30 19:57:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Lebedev X-Patchwork-Id: 7302211 Return-Path: X-Original-To: patchwork-linux-fsdevel@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 2B6FA9F1D5 for ; Wed, 30 Sep 2015 19:59:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43E00206DC for ; Wed, 30 Sep 2015 19:59:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4524A206FB for ; Wed, 30 Sep 2015 19:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932743AbbI3T7P (ORCPT ); Wed, 30 Sep 2015 15:59:15 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:36545 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932257AbbI3T7N (ORCPT ); Wed, 30 Sep 2015 15:59:13 -0400 Received: by laclj5 with SMTP id lj5so59579115lac.3; Wed, 30 Sep 2015 12:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U6shtWNYaOHzuVd2FXANKZ5OHW4ZMhFbO+OzFo6CDdA=; b=T8brLtZfc8viA1hzGmRJaKyRy2mG7VsSzp4RBgDOtFcvDI1+ebBNc3AlR+cv2GM6pL zSvWCRM22MUKmq2Cu/KJ30koJZJl++WnhC6k7PYvHxc2DlHCQONclYlf0x3Gzq/jtUPN +48hx6f2AtytHS8H1Hm+mM4NaccjKmWmW7KSzvVHfjZ3fuPRtyynWYfyPV0UskY8VJXb r4dVSK+MlZ0RjL0fe5JS1e6ReQDf36TLsCcanAFpSncH7EIuf+/DWHI70xyTKmXOR0Vl w5elSGK6/Oqr3wLdMv372iWQY0/vFBR0qqNzYS0A1BwqayME/kvobmkJZlV7lx1cGwyL umvw== X-Received: by 10.152.23.138 with SMTP id m10mr1646290laf.105.1443643151729; Wed, 30 Sep 2015 12:59:11 -0700 (PDT) Received: from pini-pini.lcl (0896116206.static.corbina.ru. [78.107.250.75]) by smtp.googlemail.com with ESMTPSA id k12sm246942lfb.44.2015.09.30.12.59.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 12:59:10 -0700 (PDT) From: Roman Lebedev To: linux-btrfs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, fstests@vger.kernel.org Cc: Roman Lebedev Subject: [RFC PATCH] fstests: generic: Test that fsync works on file in overlayfs merged directory Date: Wed, 30 Sep 2015 22:57:45 +0300 Message-Id: <1443643065-16460-2-git-send-email-lebedev.ri@gmail.com> X-Mailer: git-send-email 2.6.0 In-Reply-To: <1443643065-16460-1-git-send-email-lebedev.ri@gmail.com> References: <1443643065-16460-1-git-send-email-lebedev.ri@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 As per overlayfs documentation, any activity on a merged directory for a application that is doing such activity should work exactly as if that would be a normal, non overlayfs-merged directory. That is, e.g. simple fopen-fwrite-fsync-fclose sequence should work just fine. But apparently it does not. Add a simple generic test to check that. As of right now (linux-4.2.1) this test fails at least on btrfs. PS: An alternative (and probably better approach) would be to run fstests test suite with TEST_DIR set to overlayfs work directory. Also, i'm not sure that this test fits here, but it's my best guess. Signed-off-by: Roman Lebedev --- tests/generic/111 | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/111.out | 5 ++++ tests/generic/group | 1 + 3 files changed, 86 insertions(+) create mode 100755 tests/generic/111 create mode 100644 tests/generic/111.out diff --git a/tests/generic/111 b/tests/generic/111 new file mode 100755 index 0000000..3c2599b --- /dev/null +++ b/tests/generic/111 @@ -0,0 +1,80 @@ +#! /bin/bash +# FS QA Test 111 +# +# Test that fsync works on file in overlayfs merged directory +# +#----------------------------------------------------------------------- +# Copyright (c) 2015 Roman Lebedev. 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 + +lower=$TEST_DIR/lower.$$ +upper=$TEST_DIR/upper.$$ +work=$TEST_DIR/work.$$ +merged=$TEST_DIR/merged.$$ + +_cleanup() +{ + cd / + rm -f $tmp.* + umount $merged + rm -rf $merged + rm -rf $work + rm -rf $upper + rm -rf $lower +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here + +_supported_fs generic +_supported_os IRIX Linux +_require_test + +mkdir $lower + +$XFS_IO_PROG -f -c "pwrite 0 4k" -c "fsync" \ + $lower/file | _filter_xfs_io + +mkdir $upper +mkdir $work +mkdir $merged + +sync + +mount -t overlay overlay -olowerdir=$lower \ + -oupperdir=$upper -oworkdir=$work $merged + +$XFS_IO_PROG -f -c "pwrite 0 4k" -c "fsync" \ + $merged/file | _filter_xfs_io + +# if we are here, then fsync did not crash, so we're good. + +# success, all done +status=0 +exit diff --git a/tests/generic/111.out b/tests/generic/111.out new file mode 100644 index 0000000..36c7fde --- /dev/null +++ b/tests/generic/111.out @@ -0,0 +1,5 @@ +QA output created by 111 +wrote 4096/4096 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 4096/4096 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/generic/group b/tests/generic/group index 4ae256f..d3516f9 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -112,6 +112,7 @@ 107 auto quick metadata 108 auto quick rw 109 auto metadata dir +111 auto quick 112 rw aio auto quick 113 rw aio auto quick 117 attr auto quick