From patchwork Thu Apr 20 08:09:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9689829 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 C010D60326 for ; Thu, 20 Apr 2017 08:10:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B12C6283E8 for ; Thu, 20 Apr 2017 08:10:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A60932845C; Thu, 20 Apr 2017 08:10:14 +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 84A742845B for ; Thu, 20 Apr 2017 08:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943444AbdDTIKL (ORCPT ); Thu, 20 Apr 2017 04:10:11 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34737 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S943436AbdDTIJb (ORCPT ); Thu, 20 Apr 2017 04:09:31 -0400 Received: by mail-wm0-f66.google.com with SMTP id z129so9230127wmb.1; Thu, 20 Apr 2017 01:09:30 -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=aDdmCe9QELvgAS9GpKxNFOIqazSLW1j92y+PrZm7S0U=; b=bD5s8RCS08Z1wMwYiD14q7v1u+HpF+6Yy74QdWQqN6ZdRMjp7pM2TBGtV7b6bNBl6u rXAXP6zw1dVH2BzxMV5zS5B6CHAdSohsCks9vHqbQETilmr1AvCbkoD0m9NO8Ja8GBqv 2gt0g2IDFJpWpt/EsWLSh5ev228xgcuymmUhdUd6CL1AMC0fV6iI/XcYEHAuR3blxgus G+kbv/l1xudpgG/BqofHvL32OkrI1cofEsjBMqTdDiMnXYGHQuPvSrhuw0OEQMUCTYkJ 3ggGPUaUjS2WgpZjcXr99AQUEJteOHx9lfDqUUHoh2vAI1LnNsDJgp6PrZkyVcEXkGun oCJw== 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=aDdmCe9QELvgAS9GpKxNFOIqazSLW1j92y+PrZm7S0U=; b=HTh7l2ciADjoWDUfs65mIaOco2CTQYb+XrLfef966QeGh2byT7JK2O6P2y8Y0vfq/6 35+sSrLgUFu66pSfcLhjSYUZWc7GcefftjMEn1BwWXRfhDdVysw7pKg3Nnj6F0HZFuIe ZvxQI25G8GJ4P3+JMfimyHiuX/wUbh8oGhQXXT13ExA9PJoAhZ7NcNk9dZ+hF4zgZhQT ZAGEbVBRYPA3Eh1zCpxyUjfgD8X2Hbsdn5mDj+wpOss/+tVCrFo+MG98OqpKPWtLUwRw vtgUZ7cQlZsH43LkAt4cOCs/WMB3sGEANja7I0Jkarf61bMWVIk0W9a2YJhcAprlqjnM +CUA== X-Gm-Message-State: AN3rC/5lyUJkLWyYMKxWlOBI+wt7oMo/6OjYuQmEguiMgICvA2WAkfM/ OOGcyfH0mh+GIg== X-Received: by 10.28.28.69 with SMTP id c66mr1945676wmc.28.1492675769434; Thu, 20 Apr 2017 01:09:29 -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 h80sm2361180wmd.7.2017.04.20.01.09.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Apr 2017 01:09:28 -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 v3 4/4] fstests: add generic test for file handles Date: Thu, 20 Apr 2017 11:09:37 +0300 Message-Id: <1492675777-27883-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492619359-24763-5-git-send-email-amir73il@gmail.com> References: <1492619359-24763-5-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 | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/426.out | 2 ++ tests/generic/group | 1 + 3 files changed, 79 insertions(+) create mode 100755 tests/generic/426 create mode 100644 tests/generic/426.out Eryu, Avoiding unneeded spam to the list, here is a re-send of the last patch with your requested fixes. Thanks, Amir. diff --git a/tests/generic/426 b/tests/generic/426 new file mode 100755 index 0000000..d2e555f --- /dev/null +++ b/tests/generic/426 @@ -0,0 +1,76 @@ +#! /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 +rm -f $testdir/* +src/open_by_handle -c $testdir $numfiles +src/open_by_handle -l $testdir $numfiles +src/open_by_handle -u $testdir $numfiles + +echo "Silence is golden" +status=0 +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