From patchwork Sun Jan 7 18:07:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10148439 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 76F2A601BE for ; Sun, 7 Jan 2018 18:07:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C6C728628 for ; Sun, 7 Jan 2018 18:07:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60D6C28633; Sun, 7 Jan 2018 18:07:10 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 0795928628 for ; Sun, 7 Jan 2018 18:07:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754424AbeAGSHJ (ORCPT ); Sun, 7 Jan 2018 13:07:09 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37088 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754341AbeAGSGm (ORCPT ); Sun, 7 Jan 2018 13:06:42 -0500 Received: by mail-wm0-f65.google.com with SMTP id f140so10477656wmd.2; Sun, 07 Jan 2018 10:06:41 -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:in-reply-to:references; bh=Au5us7b5nobWeD7b11Yj8+x/5Pentyqh88ecoyDGFHU=; b=fRVP9Lefeq2YJrB/5bsn5KAVrOoleP11PtHlgsMCEOrhMvOj4eliYU7trRVoWaVqJN bLZbm6MRaGKEiNpghW6VhxLEpJig8vNQ7Y9CpRHEgzLy56kNZOJVKZaXzK2HcNHNLuUH hI6fOqd6FYnvtgZhT4iiYX0ZxsJHF4Nj1+/XUXnhGVTGc8ZSbzqwv/Tf7LISwUBsghph wcTFuyJe7Z8Pzjm/hMAHn9miX/XQnBl0IGT5CFcXDzjauN6kRrnNcwhsZa+Jf95hps7N 3tCim6+kK2TPlmgNyFDnknPtTv9RqE1cuKlbce+nulLsbMMYU1W/eIsoiBC1zzP545OE J7qA== 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=Au5us7b5nobWeD7b11Yj8+x/5Pentyqh88ecoyDGFHU=; b=t/xpSR4fI9y3I9VOHFp2GtGPAAQPGmhuAKMwXCoAEUE2rJh37E51f35xbgeJT+LXYt m9u8eh8OP/js2it0Wm4yPiqKVS+1bve94GNOyMF2HsAe5kWosofnwd/phe4a0sSQvRwI 7KwPc63ckwgcTmqZ+49M7XR0RKS9zAZdvrfttfXl7F7kt0g0yb4tF2RjYohT4lAxkvt3 /ltUV3MlWCsdGHjyBbbLzh1s+i5YmyqmaG96uzKGLOUaJ/PU2Pm2crbrr2siAlE5IrTR CmUNh5VsGW0sIT6df657uonijtwr/wePd9Wal080Qxd+uoPxox240ldMUPTcpbl+33ez qQgA== X-Gm-Message-State: AKGB3mLyRcVwHHQIeZDlTHMIm1RfaSIgf91grn38dh7Rzu69qQDfh8au sf2n6C97Mw8uMFOBrLMIYRk= X-Google-Smtp-Source: ACJfBoutvq5j0LxKrPtlJWWzwwtObAaLUDu3ZBmO3qQ2exkKM7bEzJLbRGkNRQJktpYFOCMdSqXybw== X-Received: by 10.28.230.20 with SMTP id d20mr7788710wmh.138.1515348400951; Sun, 07 Jan 2018 10:06:40 -0800 (PST) Received: from localhost.localdomain (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id k42sm11433750wrf.37.2018.01.07.10.06.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Jan 2018 10:06:40 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Jeff Layton , "J . Bruce Fields" , Miklos Szeredi , fstests@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org Subject: [PATCH 4/7] generic/exportfs: store and load file handles from file Date: Sun, 7 Jan 2018 20:07:22 +0200 Message-Id: <1515348445-1403-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515348445-1403-1-git-send-email-amir73il@gmail.com> References: <1515348445-1403-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 For the test cases of renaming test directory and moving files to new test directory, encoding the file handles is done after files/dir have been renamed, so the test does not exercise decoding file hanldes that were exported before the rename. For those test cases, store the test set file handles to a temp file, then move the files/dir, then try to open test set by stored file handles. Signed-off-by: Amir Goldstein --- tests/generic/467 | 29 ++++++++++++++++++----------- tests/generic/467.out | 6 ++++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/tests/generic/467 b/tests/generic/467 index 56dfcbd..592ffbe 100755 --- a/tests/generic/467 +++ b/tests/generic/467 @@ -74,10 +74,10 @@ create_test_files() test_file_handles() { local dir=$1 - local opt=$2 + shift - echo test_file_handles $* | _filter_test_dir - $here/src/open_by_handle $opt $dir $NUMFILES + echo test_file_handles $dir $* | _filter_test_dir | sed -e "s,$tmp\.,,g" + $here/src/open_by_handle $* $dir $NUMFILES } # Check stale handles to deleted files/dir @@ -101,18 +101,25 @@ test_file_handles $testdir -ur create_test_files $testdir test_file_handles $testdir -mr -# Check non-stale file handles after rename of parent -create_test_files $testdir -rm -rf $testdir.renamed -mv $testdir $testdir.renamed/ -test_file_handles $testdir.renamed -rp - -# Check non-stale file handles after move to new parent +# Check non-stale file handles of moved files create_test_files $testdir rm -rf $testdir.new mkdir -p $testdir.new +# Store file handles before move to new testdir +test_file_handles $testdir -o $tmp.file_handles mv $testdir/* $testdir.new/ -test_file_handles $testdir.new -rp +# Check open and read from stored file handles +# (testdir argument is the mount point and NOT the old nor new testdir) +test_file_handles $TEST_DIR -r -i $tmp.file_handles + +# Check non-stale file handles of renamed dirs +create_test_files $testdir +rm -rf $testdir.renamed +# Store file handles before rename of testdir +test_file_handles $testdir -p -o $tmp.file_handles +mv $testdir $testdir.renamed/ +# Check open, read and readdir from stored file handles +test_file_handles $TEST_DIR -rp -i $tmp.file_handles status=0 exit diff --git a/tests/generic/467.out b/tests/generic/467.out index 39d6a95..c29289e 100644 --- a/tests/generic/467.out +++ b/tests/generic/467.out @@ -5,5 +5,7 @@ test_file_handles TEST_DIR/467-dir -dkr test_file_handles TEST_DIR/467-dir -lr test_file_handles TEST_DIR/467-dir -ur test_file_handles TEST_DIR/467-dir -mr -test_file_handles TEST_DIR/467-dir.renamed -rp -test_file_handles TEST_DIR/467-dir.new -rp +test_file_handles TEST_DIR/467-dir -o file_handles +test_file_handles TEST_DIR -r -i file_handles +test_file_handles TEST_DIR/467-dir -p -o file_handles +test_file_handles TEST_DIR -rp -i file_handles