From patchwork Tue Jul 11 19:52:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9835441 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 8E754602A0 for ; Tue, 11 Jul 2017 19:52:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F9A028553 for ; Tue, 11 Jul 2017 19:52:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 747832856A; Tue, 11 Jul 2017 19:52:04 +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 06D6A28553 for ; Tue, 11 Jul 2017 19:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934211AbdGKTwD (ORCPT ); Tue, 11 Jul 2017 15:52:03 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34835 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934209AbdGKTwC (ORCPT ); Tue, 11 Jul 2017 15:52:02 -0400 Received: by mail-wr0-f195.google.com with SMTP id z45so624576wrb.2; Tue, 11 Jul 2017 12:52:01 -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:in-reply-to:references; bh=dqmTljtlnVhzJxx0okERgZN+Md3bkyhX4jHxF+3Yjls=; b=L7Ca0HlrMcicGW2MD3SxZmvk+Wa6dfZEw461gBjYrXrrjHRbUwubW6aghjLXiQGMdE cD5wy9EM05EX+QdKN07hITZKKw/Ix3pf8VnbQEX9AcVwHJN3T+jEoVossAkmQvnlb04X oa4lhXQBivYBTCkQD/TBRuX+Il3z5GH5XditnZ7dpEZnoXMTw2Td++2+ipH0/IKYle/X EL0UNu5xJHMDTCfrrbPn3sRl5Ccoj6f0KB5IPd1UzH57c714KnDRHoQSerZBKvgl0g74 BDe/7gQguhejX82Z3+UxQHM6vAi5UqMY7ODVzmCNOwJBKK72CvlEus+2grn8p5OF702d y3pw== 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:in-reply-to :references; bh=dqmTljtlnVhzJxx0okERgZN+Md3bkyhX4jHxF+3Yjls=; b=tEX0qX3JNmnbIu0nNogXgxEql2cRdTORquRHBtrpsaJTXmocdoevCDD8l52yl5+1Fw pIPKgzzSo7ws6oYP2Uzs2sAJJ2Gw3twxg2hrrHkqVfrMvF0jecGR++NirUBsvbFHdQ+5 1AcstYdR1LDT2Uj2in4E0tVwvG1yD6YZpeHVI6ZCKOXawfk7TKe2rRnNNpMLA+bszcqg h8Kh22ZO0lYjGs7K9sLROjw5HW30YGiX6mGOCCrQYzlwuLUcSYw9lrKbgCcXuTUUd64m 6Qk6CNMh0ICYcn5hzZUO3CiT8jT0LPL+jrkcAhxFM+ah/0zCjvtQEvAOwSYip+dsFMN9 KPfg== X-Gm-Message-State: AIVw113+JzHYusoopcTL2YiB+PFO8gw0uCwgCcx15Ue7odVljHlUl61u 1OBpW5Syl+rrTeJn X-Received: by 10.28.142.133 with SMTP id q127mr47183wmd.4.1499802720993; Tue, 11 Jul 2017 12:52:00 -0700 (PDT) Received: from localhost.localdomain (bzq-79-182-137-119.red.bezeqint.net. [79.182.137.119]) by smtp.gmail.com with ESMTPSA id q2sm302581wmg.3.2017.07.11.12.51.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Jul 2017 12:52:00 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 5/5] overlay: test mount error cases with exclusive directories Date: Tue, 11 Jul 2017 22:52:06 +0300 Message-Id: <1499802726-11045-6-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499802726-11045-1-git-send-email-amir73il@gmail.com> References: <1499802726-11045-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Expect EBUSY when trying to mount overlay when: - Upper dir is in-use by another overlay mount - Work dir is in-use by another overlay mount Signed-off-by: Amir Goldstein --- tests/overlay/036 | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/036.out | 3 ++ tests/overlay/group | 1 + 3 files changed, 86 insertions(+) create mode 100755 tests/overlay/036 create mode 100644 tests/overlay/036.out diff --git a/tests/overlay/036 b/tests/overlay/036 new file mode 100755 index 0000000..4100b80 --- /dev/null +++ b/tests/overlay/036 @@ -0,0 +1,82 @@ +#! /bin/bash +# FS QA Test 036 +# +# Test mount error cases with exclusive directories +# +# - Upper dir is in-use by another overlay mount +# - Work dir is in-use by another overlay mount +# +#----------------------------------------------------------------------- +# 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.* + # unmount the two extra mounts in case they did not fail + $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null + $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null +} + +# 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 + +# Remove all files from previous tests +_scratch_mkfs + +# Create multiple lowerdirs, upperdirs and workdirs +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 +workdir2=$OVL_BASE_SCRATCH_MNT/workdir2 +mkdir -p $lowerdir $lowerdir2 $upperdir $upperdir2 $workdir $workdir2 + +# Mount overlay with lowerdir, upperdir, workdir +_overlay_mount_dirs $lowerdir $upperdir $workdir \ + overlay1 $SCRATCH_MNT +# Try to mount another overlay with the same upperdir - expect EBUSY +_overlay_mount_dirs $lowerdir2 $upperdir $workdir2 \ + overlay2 $SCRATCH_MNT 2>&1 | _filter_scratch +# Try to mount another overlay with the same workdir - expect EBUSY +_overlay_mount_dirs $lowerdir2 $upperdir2 $workdir \ + overlay3 $SCRATCH_MNT 2>&1 | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/overlay/036.out b/tests/overlay/036.out new file mode 100644 index 0000000..5174611 --- /dev/null +++ b/tests/overlay/036.out @@ -0,0 +1,3 @@ +QA output created by 036 +mount: overlay2 is already mounted or SCRATCH_MNT busy +mount: overlay3 is already mounted or SCRATCH_MNT busy diff --git a/tests/overlay/group b/tests/overlay/group index 87e3aaf..4cc1d74 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -38,3 +38,4 @@ 033 auto quick copyup hardlink 034 auto quick copyup hardlink 035 auto quick mount +036 auto quick mount