From patchwork Mon Nov 5 05:18:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10667389 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 DCE6013A4 for ; Mon, 5 Nov 2018 05:18:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1CE428D33 for ; Mon, 5 Nov 2018 05:18:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF12828991; Mon, 5 Nov 2018 05:18:25 +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 706A4294F9 for ; Mon, 5 Nov 2018 05:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729016AbeKEOgN (ORCPT ); Mon, 5 Nov 2018 09:36:13 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41091 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728918AbeKEOgN (ORCPT ); Mon, 5 Nov 2018 09:36:13 -0500 Received: by mail-wr1-f66.google.com with SMTP id x12-v6so7953002wrw.8; Sun, 04 Nov 2018 21:18:22 -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=jjd1x8h7FAcrs+AlTOvO5mjgRxf3gegJXdfMBxBmfro=; b=aVcSPHAtXhYiBjPRmDx3NC0WbnY7LGGuF5XWpeHkW9mc+hBYgm9PQu7EFXC9arOJ33 Zm8TIjwHdI70nidl3UkF82R4Nh6S0vAKiuOUtAtSV2NtkbEOV3a+vRFXRZAr5fyBQko2 toroWM4oZtPtaL+tSlinka7RbaIAUmZ1ul4uVFxusP4Ar0Nk3XnXlhT8UfyT+A4xVxI3 9+7Aqw6ai4mhAd+HiGxKtZkaFHRI59Zao1TyfGnAStVW6tWypEyef8uoy/CcGcHpXK0B FGbd6Ky5ueZtkP9Dbp46wLUQel/eiCHSlV/EZcjKIXjhasKHIugXidH42DgfM4W9fM0p PdTg== 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=jjd1x8h7FAcrs+AlTOvO5mjgRxf3gegJXdfMBxBmfro=; b=tfg6yIrSS4+3CKkFadG+vLCKqisqiNofTdHvO1n4Bmz4bkq0vajpJ4Fthmi4iUMWtg SKItuYdBnIRZqPU/73p22IYmYz2TY8Gs7D4kt7D+mY8k3hME7PP50Ya1rBkgwuiTGN2b bSPRrzMvPGJVsO7D90d5T27jEDCkjnLsHFk7bquUZa/ZHz/Pi1JfXqTKf3IJ1PdYuW2E 03JbyRLqHIof5dyareE4Dv4P9W8NRaLugwxrPMvihUee5SNtSx2aI9wEjj2A/c8pY/Z/ /p47P1poe1sQZv3DNdsSkVezjTvVmioaop0FDSwyc3ZeBU2IgHjPju5LPu8mVPAAi/4w 64qg== X-Gm-Message-State: AGRZ1gInL0ZZ403pzuUDUxFFuvYUrQEtDErqfMDajLJQTyECHU4jF8JN 1UMxBFq7BhbzxQCGWsjB62XKxDlI X-Google-Smtp-Source: AJdET5dnup1fdSD2hf/56Bagj9smO0Q18Hhmeb22UGnOZyUELn7bLe49Ouh0sNY/fZ5XBgLh3kxoJw== X-Received: by 2002:adf:dcd1:: with SMTP id x17-v6mr17854541wrm.212.1541395101870; Sun, 04 Nov 2018 21:18:21 -0800 (PST) Received: from localhost.localdomain ([5.102.238.219]) by smtp.gmail.com with ESMTPSA id o9-v6sm48251627wra.42.2018.11.04.21.18.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Nov 2018 21:18:21 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH] overlay: test file handle decode with multi lower layers on same fs Date: Mon, 5 Nov 2018 07:18:15 +0200 Message-Id: <20181105051815.15074-1-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test is for a regression that was introduced in kernel v4.17 by commit 8b58924ad55c ("ovl: lookup in inode cache first when decoding lower file handle"). Signed-off-by: Amir Goldstein --- tests/overlay/062 | 86 +++++++++++++++++++++++++++++++++++++++++++ tests/overlay/062.out | 2 + tests/overlay/group | 1 + 3 files changed, 89 insertions(+) create mode 100755 tests/overlay/062 create mode 100644 tests/overlay/062.out diff --git a/tests/overlay/062 b/tests/overlay/062 new file mode 100755 index 00000000..2c86a4b6 --- /dev/null +++ b/tests/overlay/062 @@ -0,0 +1,86 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2018 CTERA Networks. All Rights Reserved. +# +# FS QA Test No. 062 +# +# Test file handle decode with multi lower layers on same fs +# +# This test is for a regression that was introduced in kernel v4.17 by +# commit 8b58924ad55c ("ovl: lookup in inode cache first when decoding +# lower file handle"). +# +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.* + $UMOUNT_PROG $lowertestdir +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here + +_supported_fs overlay +_supported_os Linux +_require_scratch +_require_test_program "open_by_handle" +# We need to require all features together, because nfs_export cannot +# be enabled when index is disabled +_require_scratch_overlay_features index nfs_export + +NUMFILES=1 + +# Create test dir and empty test files +create_test_files() +{ + local dir=$1 + + mkdir -p $dir + $here/src/open_by_handle -cwp $dir $NUMFILES +} + +# Test encode/decode file handles on overlay mount +test_file_handles() +{ + local dir=$1 + + $here/src/open_by_handle -rp $dir $NUMFILES +} + +_scratch_mkfs + +# All lower layers are on scratch partition +lower=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER +lower2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2 +lowertestdir=$lower2/testdir + +create_test_files $lowertestdir + +# bind mount to pin lower test dir dentry to dcache +$MOUNT_PROG --bind $lowertestdir $lowertestdir + +# For non-upper overlay mount, nfs_export requires disabling redirect_dir. +$MOUNT_PROG -t overlay $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT \ + -o ro,redirect_dir=nofollow,nfs_export=on,lowerdir=$lower:$lower2 + +# Decode an overlay directory file handle, whose underlying lower dir dentry +# is in dcache and connected and does not belong to the upper most lower layer. +# The test program drops caches, but $lowertestdir dcache in pinned, so only +# the overlay dentry is dropped. +test_file_handles $SCRATCH_MNT/testdir -rp + +echo "Silence is golden" +status=0 +exit diff --git a/tests/overlay/062.out b/tests/overlay/062.out new file mode 100644 index 00000000..a1578f48 --- /dev/null +++ b/tests/overlay/062.out @@ -0,0 +1,2 @@ +QA output created by 062 +Silence is golden diff --git a/tests/overlay/group b/tests/overlay/group index ccc71f3b..165f002d 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -64,3 +64,4 @@ 059 auto quick copyup 060 auto quick metacopy 061 auto quick copyup +062 auto quick exportfs