From patchwork Tue Apr 18 18:17:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9685975 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 98715602C2 for ; Tue, 18 Apr 2017 18:17:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D5111FFD6 for ; Tue, 18 Apr 2017 18:17:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8226B2022C; Tue, 18 Apr 2017 18:17: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=-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 214221FFD6 for ; Tue, 18 Apr 2017 18:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752610AbdDRSRY (ORCPT ); Tue, 18 Apr 2017 14:17:24 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33825 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752748AbdDRSRX (ORCPT ); Tue, 18 Apr 2017 14:17:23 -0400 Received: by mail-wr0-f196.google.com with SMTP id u18so127366wrc.1; Tue, 18 Apr 2017 11:17:22 -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=cxRYuYLrpQ4Cl7l6AAd5lZBHp+XlJQzwcbyfzqFr0no=; b=YEKvD/pqDpk2jNnXyheOIEQNKlVt9TCRgCaI3Rqs5NSiTmdJvbg3sDX5iu446jiYTb swYGMCLyhUwwEhyYuEixrgO0+ZKSuLMrpHrHu85rhoYSF+h2116zwmxKLybF+vSaUU6b rmep+hiTe3aG+Cw04E13nneJAZN7QyNLDkrjQ8vthHpP60pxeuXAOlQpfWjb5BDDoOLg PM6/Gcyk7C+tufky/6Z4WjKQxUAkUKrKSN/wZUGmvfsKS1/EAGiCCpY1qZ16QSK1aOkN K3t/Xs8m8YOzfcGUKPgMEuhy4szoweMnkKPv2pwQDN6O6typkdHVg+unhgdYdIObONuK OxBg== 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=cxRYuYLrpQ4Cl7l6AAd5lZBHp+XlJQzwcbyfzqFr0no=; b=PewfxNXr5RmFqZ0EggbXRmeaIZibxbTIlqdojAuSWnyV/Zas8plKjnFfz1MpfSQ3n+ NwA2Fs78VUCtOcSDT7BRuXG5so0C4TqdJtVYiM4xIEXkyV0mN+U6DMq+GvIzDFahMIHd QlNoYWBqrwXFZozpT7leYCRUqA2cnyIEwKx/ZYRYUYZVOUm2KwX54ynH36zdzxERZ3Xp 1pjlyt/pcaZN1e8CaSwZ4N4NS3aYYhG5A2TgMUyttVliqd1CXee7MJc9gv89mBNgpgas 6TaBe3QzeMl4PbFurL+iqec5zziUvSqiB0yocyfdT1VYuY5J7pFKq61CTcFvmpvQnzPK 5nug== X-Gm-Message-State: AN3rC/44BaGE9albiYUWNWcofZ4QgGRV/KraXjg89zqHEATUKvwcZjoQ gQSBCVYhveJg0w== X-Received: by 10.223.161.222 with SMTP id v30mr25727340wrv.132.1492539441816; Tue, 18 Apr 2017 11:17:21 -0700 (PDT) Received: from amir-VirtualBox.lan (bzq-79-179-55-127.red.bezeqint.net. [79.179.55.127]) by smtp.gmail.com with ESMTPSA id v126sm15958709wmd.11.2017.04.18.11.17.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Apr 2017 11:17:21 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Trond Myklebust , Jeff Layton , "J . Bruce Fields" , fstests@vger.kernel.org, linux-unionfs@vger.kernel.org Subject: [PATCH 4/4] fstests: add generic test for file handles Date: Tue, 18 Apr 2017 21:17:24 +0300 Message-Id: <1492539444-25938-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492539444-25938-1-git-send-email-amir73il@gmail.com> References: <1492539444-25938-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 Cloned from xfs specific test xfs/238, which checks stale file handles of deleted files. This test uses the generic open_by_handle_at() syscall and also tests for non-stale file handles of linked files. Signed-off-by: Amir Goldstein --- tests/generic/426 | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/426.out | 2 ++ tests/generic/group | 1 + 3 files changed, 76 insertions(+) create mode 100755 tests/generic/426 create mode 100644 tests/generic/426.out diff --git a/tests/generic/426 b/tests/generic/426 new file mode 100755 index 0000000..62bb85e --- /dev/null +++ b/tests/generic/426 @@ -0,0 +1,73 @@ +#! /bin/bash +# FS QA Test No. 426 +# +# Check stale handles pointing to unlinked files +# and non-stale handles pointing to linked files +# +#----------------------------------------------------------------------- +# Copyright (C) 2016 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 + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratch +_require_exportfs + +echo "Silence is golden" + +_scratch_mkfs > /dev/null 2>&1 +_scratch_mount > /dev/null 2>&1 + +numfiles=1024 + +# Check stale handles to deleted files +src/open_by_handle -c $SCRATCH_MNT $numfiles +src/open_by_handle -d $SCRATCH_MNT $numfiles + +# Check non-stale handles to linked files +src/open_by_handle -c $SCRATCH_MNT $numfiles +src/open_by_handle $SCRATCH_MNT $numfiles + +# Check non-stale handles to files that were hardlinked and original deleted +src/open_by_handle -l $SCRATCH_MNT $numfiles +src/open_by_handle -u $SCRATCH_MNT $numfiles + +status=$? +exit diff --git a/tests/generic/426.out b/tests/generic/426.out new file mode 100644 index 0000000..777cbcd --- /dev/null +++ b/tests/generic/426.out @@ -0,0 +1,2 @@ +QA output created by 426 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index 6d6e4f6..f29009c 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -428,3 +428,4 @@ 423 auto quick 424 auto quick 425 auto quick attr +426 auto quick exportfs