From patchwork Mon Aug 7 15:31:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9885617 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 34E57602CC for ; Mon, 7 Aug 2017 15:31:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2657628687 for ; Mon, 7 Aug 2017 15:31:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AEF8286A4; Mon, 7 Aug 2017 15:31:07 +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 A02E628687 for ; Mon, 7 Aug 2017 15:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751761AbdHGPbG (ORCPT ); Mon, 7 Aug 2017 11:31:06 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38749 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751722AbdHGPbF (ORCPT ); Mon, 7 Aug 2017 11:31:05 -0400 Received: by mail-wm0-f67.google.com with SMTP id y206so1410821wmd.5; Mon, 07 Aug 2017 08:31:04 -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=1e6ijxz3eA5IUBHJllWiR0nS07IjR0IqZES0wMgwUgM=; b=S8kERU31Dj30BId80L3BaI9N/atKLZ3Ifz6vYfZUdZg5eirEnZ3TqIvRjgM035zfKJ 9ZB57hMRH44i1dOTFzipanH0AUjhi6zEHz+wlkKODR44eSpmVEh6uQTivYtlzvdE7qvp bLZc+v24zai5LAF9QlC9MwIBdhWfE31SB6m+DqBg/7s0KheXw3nvYQlvWJr+B3qb+rga DXPM8xo/TLTlD4izBpbd+hqqcVYcJQ7572/dY+hDHJ8HKa1U9OjoAguQB4v8zBofquSY HxqUPfi4NR08esoIo3yTMlQZJxA8L1Xk+FEYC1kaVweYIcPv4zuMhP1O1a5/AI+ebf72 9EXQ== 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=1e6ijxz3eA5IUBHJllWiR0nS07IjR0IqZES0wMgwUgM=; b=VxIwhrDFoYqB8iMMKI9Kgb81Cy8wyNTSb2XeV76ocRpXnH9IXVWSrudni8XQxFJXMU ER3lcJlG+zg2AsS1XLj1rDrJEBM/1d+lej3QrBorpivoM6CXouWb9WrbfZX0xK0htEpB iNZxbIPsj8woSMYrPBhS+iFCOqjJ+XYnM1+2IL83Uh1qePCEHM2bhK3KfcYrqmOP8QEu Dd6iAHTWPKCqNhTzTZdnl6vSb4OUHKnOis8RQtkOUXIFOqowOKwo6ALMc+utjp+PhI9f ri8AXdkHNbeHUr1mD0E1mZtOcsUwKNwFGkMyd8iEGaLXaSBPG96xd2ohJiDxf2LJR4MW 188A== X-Gm-Message-State: AHYfb5ipUcJk4cPwF911foEaB7FwMBk/LpODYHtqu2KFyPd6LQK2ebf0 pmAURR5NgB1w8MpJ X-Received: by 10.80.140.36 with SMTP id p33mr1304564edp.257.1502119863826; Mon, 07 Aug 2017 08:31:03 -0700 (PDT) Received: from amir-VirtualBox.fritz.box (200116b84282a00021bda01f726c41dc.dip.versatel-1u1.de. [2001:16b8:4282:a000:21bd:a01f:726c:41dc]) by smtp.gmail.com with ESMTPSA id x15sm5843426edk.65.2017.08.07.08.31.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 08:31:03 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH] overlay: test mount error cases with index=on Date: Mon, 7 Aug 2017 17:31:32 +0200 Message-Id: <1502119892-1171-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 - Upper/lower mismatch - Index/upper mismatch With index=on, lowerdir and upperdir are verified using a file handle stored in trusted.overlay.origin xattr in upperdir and indexdir. Failure to verify lowerdir/upperdir on mount results in ESTALE. Signed-off-by: Amir Goldstein --- Eryu, I promised one more test for overlay/mount group to test new behavior of mount with -o index=on. This test depends on a kernel commit 961af647fc9e ("ovl: fix origin verification of index dir") that was merged for v4.13-rc2. Thanks for your cleanup of previous patches, Amir. tests/overlay/037 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/037.out | 3 ++ tests/overlay/group | 1 + 3 files changed, 93 insertions(+) create mode 100755 tests/overlay/037 create mode 100644 tests/overlay/037.out diff --git a/tests/overlay/037 b/tests/overlay/037 new file mode 100755 index 0000000..77da351 --- /dev/null +++ b/tests/overlay/037 @@ -0,0 +1,89 @@ +#! /bin/bash +# FS QA Test 037 +# +# Test mount error cases with option index=on +# +# - Upper/lower mismatch +# - Index/upper mismatch +# +# With index=on, lowerdir and upperdir are verified using a file handle +# stored in trusted.overlay.origin xattr in upperdir and indexdir. +# +# Failure to verify lowerdir/upperdir on mount results in ESTALE. +# +#----------------------------------------------------------------------- +# Copyright (C) 2017 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 +_require_scratch_feature index + +# Remove all files from previous tests +_scratch_mkfs + +# Create multiple lowerdirs, upperdirs and workdir +lowerdir=$OVL_BASE_SCRATCH_MNT/lower +lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2 +upperdir=$OVL_BASE_SCRATCH_MNT/upper +upperdir2=$OVL_BASE_SCRATCH_MNT/upper2 +workdir=$OVL_BASE_SCRATCH_MNT/workdir +mkdir -p $lowerdir $lowerdir2 $upperdir $upperdir2 $workdir + +# Mount overlay with lowerdir, upperdir, workdir and index=on +# to store the file handles of lowerdir and upperdir in overlay.origin xattr +_overlay_mount_dirs $lowerdir $upperdir $workdir \ + $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT -oindex=on +$UMOUNT_PROG $SCRATCH_MNT + +# Try to mount an overlay with the same upperdir and different lowerdir - expect ESTALE +_overlay_mount_dirs $lowerdir2 $upperdir $workdir \ + $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT -oindex=on 2>&1 | _filter_scratch +$UMOUNT_PROG $SCRATCH_MNT 2>/dev/null + +# Try to mount an overlay with the same workdir and different upperdir - expect ESTALE +_overlay_mount_dirs $lowerdir $upperdir2 $workdir \ + $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT -oindex=on 2>&1 | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/overlay/037.out b/tests/overlay/037.out new file mode 100644 index 0000000..786ef85 --- /dev/null +++ b/tests/overlay/037.out @@ -0,0 +1,3 @@ +QA output created by 037 +mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Stale file handle +mount: mount SCRATCH_DEV on SCRATCH_MNT failed: Stale file handle diff --git a/tests/overlay/group b/tests/overlay/group index 4cc1d74..28f1e63 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -39,3 +39,4 @@ 034 auto quick copyup hardlink 035 auto quick mount 036 auto quick mount +037 auto quick mount