From patchwork Wed Apr 19 16:29:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9688009 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 B5F216037F for ; Wed, 19 Apr 2017 16:29:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7EC8283E2 for ; Wed, 19 Apr 2017 16:29:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CD1128418; Wed, 19 Apr 2017 16:29:18 +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 3FC61283E2 for ; Wed, 19 Apr 2017 16:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937983AbdDSQ3R (ORCPT ); Wed, 19 Apr 2017 12:29:17 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34735 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937977AbdDSQ3R (ORCPT ); Wed, 19 Apr 2017 12:29:17 -0400 Received: by mail-wr0-f193.google.com with SMTP id u18so3917730wrc.1; Wed, 19 Apr 2017 09:29:16 -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=0ERfeJvxIODRHfYbvyjhrugc1VKTIXpgNYxrEpdwiGc=; b=GUWbTpBTXgbZVh2mqbxkz4MBpV1UNmI8rMi/CM7ovFMRrKEC6azFRxZSe/tlBNHTkT mNI+hqN0WqtDklgmGIfesdKhc/gGglWdUaMRx08DLoThDTUj5uE9NqNX5G5drI7R+9ni /hAeUjsOLKafC5zwWA7tzcXwG0H0ES/dJ6L6cRNdFR/hm7oO8HJYvwSmPlwm9P84gUCb wclaCNAnad9XXlwEg0DKg68RymQgnT3C1L8BR/XjmVUdxBMq8fArqpi8lK1tsFxk5+iS cFJFMs2re5MwgHL0C02awm2P5U1IVnuJVShQ/sxIbt7ocglWpcEoGI8wum8U3nuB5kFW gvkw== 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=0ERfeJvxIODRHfYbvyjhrugc1VKTIXpgNYxrEpdwiGc=; b=BYpEJA65+DRLw3YLmF1h1vNy3YA3hb/azpuyqKddt67AnsyvFwfwGBqX4KbCKcL4UM Uu28EWBgIfdHsfpkKLpJz65KydsL6Uq2Urz3LjjXq5kLyDYOlg8P0iIWU780u4fFebNX tpetg2g5OdvRURmQlfifmEOhNEQp3GS0zGRahZlCSGfoNOldCkokbSZRBWGL+MFZ+GrK 6KE8kZmYu+3P96PHciRNBvgFFT0xyCiFep6Kb43JqBirxxHQrG7nNZoujM5gkqkgjHPP Qfkztjncv10xuSrc4WnHdxPiQ1n1wMxophAZW2C8Yn2X5VfFk2JlZfP1tLm0Nq5soHVq /iIQ== X-Gm-Message-State: AN3rC/4DwQ+8wFfdSy27DNaS4E/rkKGd9zoQ47PJJO9NcbEZKo58v33j bYcRuCP6YwvcDw== X-Received: by 10.223.146.225 with SMTP id 88mr3672989wrn.161.1492619355301; Wed, 19 Apr 2017 09:29:15 -0700 (PDT) Received: from amir-VirtualBox.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id l19sm3983981wre.2.2017.04.19.09.29.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 09:29:14 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Trond Myklebust , Jeff Layton , "J . Bruce Fields" , David Howells , Miklos Szeredi , fstests@vger.kernel.org, linux-unionfs@vger.kernel.org Subject: [PATCH v2 4/4] fstests: add generic test for file handles Date: Wed, 19 Apr 2017 19:29:19 +0300 Message-Id: <1492619359-24763-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492619359-24763-1-git-send-email-amir73il@gmail.com> References: <1492619359-24763-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 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/426.out | 2 ++ tests/generic/group | 1 + 3 files changed, 77 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..c39c165 --- /dev/null +++ b/tests/generic/426 @@ -0,0 +1,74 @@ +#! /bin/bash +# FS QA Test No. 426 +# +# Check stale handles pointing to unlinked files +# and non-stale handles pointing to linked files +# +#----------------------------------------------------------------------- +# 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 + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +# _require_exportfs already requires open_by_handle, but let's not count on it +_require_test_program "open_by_handle" +_require_exportfs + +numfiles=1024 +testdir=$TEST_DIR/$seq-dir +mkdir -p $testdir + +# Check stale handles to deleted files +rm -f $testdir/* +src/open_by_handle -c $testdir $numfiles +src/open_by_handle -d $testdir $numfiles + +# Check non-stale handles to linked files +rm -f $testdir/* +src/open_by_handle -c $testdir $numfiles +src/open_by_handle $testdir $numfiles + +# Check non-stale handles to files that were hardlinked and original deleted +src/open_by_handle -l $testdir $numfiles +src/open_by_handle -u $testdir $numfiles + +echo "Silence is golden" +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