From patchwork Sun Nov 19 11:56:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10065123 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 343D360597 for ; Sun, 19 Nov 2017 11:55:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35BBC291C6 for ; Sun, 19 Nov 2017 11:55:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AE8B291DC; Sun, 19 Nov 2017 11:55:56 +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 2949C291C6 for ; Sun, 19 Nov 2017 11:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750865AbdKSLzx (ORCPT ); Sun, 19 Nov 2017 06:55:53 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46155 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbdKSLzw (ORCPT ); Sun, 19 Nov 2017 06:55:52 -0500 Received: by mail-wr0-f195.google.com with SMTP id u98so5684456wrb.13; Sun, 19 Nov 2017 03:55:52 -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=m+QB5IvCFxG3eNSuJoJFs8kRyG9zvIYpOq0hUubhKZg=; b=GSvDO2rRbeB3wdODHrLI8UjXVIAmSx0mQBLQrSDEzhL0VjLKlP1u2I15ZsVk5h1niC hzX2CG3srqQPyhHL2YXQ9sLv4jjywVO9FBruETe7PqnExozwz/DLJ/EmFjOuPrZuWoDY +IJPzZkNeSAdqR4yWQAhVI5FplXkGLlnpFTLPny91TE0Si5+lCyGDgM180pkHSSyrzjs GnvTvObVBk9v+RpSkm+xvJp6j7St/OEcpezVGTaPIo+n80SkXK8lxWng95Rc8UHs3lkT 2HXwKDWc7ivuD7Nuc3lSQgxIrRAbvE4vroU/aW2nFe0PTmXIDMZ1nBXn8W9fYGOmRWdq kLVQ== 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=m+QB5IvCFxG3eNSuJoJFs8kRyG9zvIYpOq0hUubhKZg=; b=MVTMc8Ysp3uaeGM1/4ISm+3ZOh0vRg9Bm54V/GSEHR9bHSSctCbLijmtmX0lcbSCOV 6B3/5pnuEzEAjsa4IypFkxZVk7AVOVSWO4c68kDO+HTGBe5XedIoWssLZC4FV4H1tep3 2LcotiI3/esaH4kszFrpRqhyIyZW6vjJTogej8umr9/lwOQKVZ6XII6tjHgsgZoFz5X3 p/pUfcF2NaP9USjgbr1K73dFbi7GJOhLK8TxZXUwXPV3W5xmfv3i5P/BFm3qUWxCtIXu VgTRlXmUNdozfbzEiw9k7V2pKBnEhZBXhS/vhk0uaJsVOe9KRM5g+qNPctOwOM+Okp5c Zi3A== X-Gm-Message-State: AJaThX4i7xBx6kBu8fm+nIFBOhoJJuzaGUktgrA9WziF8hZhOhXHPp/y pGfZYlL+p5evMDo06gx60ZE= X-Google-Smtp-Source: AGs4zMYwqYJB+NC9f9pRjAxbxhJOrsoqOYKiHVPQmWbeTzqtGPDQlQ6weS8ftx00tLHJUPJjLAPDjg== X-Received: by 10.223.152.66 with SMTP id v60mr8995665wrb.277.1511092551321; Sun, 19 Nov 2017 03:55:51 -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 o2sm3318026wmo.5.2017.11.19.03.55.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Nov 2017 03:55:50 -0800 (PST) From: Amir Goldstein To: Chandan Rajendra Cc: Eryu Guan , Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 1/3] overlay/041: code cleanup Date: Sun, 19 Nov 2017 13:56:27 +0200 Message-Id: <1511092589-29179-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511092589-29179-1-git-send-email-amir73il@gmail.com> References: <1511092589-29179-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 - Remove duplicate merged dir tests - Remove duplicate pure upper dir inside merged dir tests - Sort out comments and error messages Signed-off-by: Amir Goldstein --- tests/overlay/041 | 67 ++++++++++++++++++++++--------------------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/tests/overlay/041 b/tests/overlay/041 index 4d7feb8..a615fcc 100755 --- a/tests/overlay/041 +++ b/tests/overlay/041 @@ -60,9 +60,7 @@ rm -rf $lowerdir mkdir $lowerdir # Create our test files. -mkdir $lowerdir/test_dir/ -mkdir $lowerdir/test_dir/pure_lower_dir -mkdir $lowerdir/test_dir/merged_dir +mkdir -p $lowerdir/test_dir/pure_lower_dir touch $lowerdir/test_file _scratch_mkfs @@ -73,23 +71,6 @@ workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir test_dir=$SCRATCH_MNT/test_dir/ -merged_dir=$test_dir/merged_dir -pure_upper_dir=$merged_dir/pure_upper_dir - -mkdir -p $pure_upper_dir - -merged_dir_st_ino=$(stat -c '%i' $merged_dir) - -# Pure dir's parent d_ino must always be calculated because -# it can be residing inside a merged dir. -parent_d=$($here/src/t_dir_type $pure_upper_dir $merged_dir_st_ino) -[[ $parent_d == ".. d" ]] || \ - echo "Pure dir inside a merged dir: Invalid d_ino reported for .." - -# d_ino for "." must always be calculated because the present -# directory can have a copy-up origin. -current_d=$($here/src/t_dir_type $merged_dir $merged_dir_st_ino) -[[ $current_d == ". d" ]] || echo "Merged dir: Invalid d_ino reported for ." # Verify d_ino of '.' and '..' before and after dir becomes impure. impure_dir=$test_dir/impure_dir @@ -101,13 +82,13 @@ impure_dir_parent_st_ino=$(stat -c '%i' $test_dir) # Before $impure_dir becomes impure parent_d=$($here/src/t_dir_type $impure_dir $impure_dir_parent_st_ino) [[ $parent_d == ".. d" ]] || \ - echo "Before dir becomes impure: Invalid d_ino reported for .." + echo "Pure upper dir: Invalid d_ino reported for .." current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino) [[ $current_d == ". d" ]] || \ - echo "Before dir becomes impure: Invalid d_ino reported for ." - + echo "Pure upper dir: Invalid d_ino reported for ." +# Move a copied up file into pure dir to make it impure mv $SCRATCH_MNT/test_file $impure_dir test_file_st_ino=$(stat -c '%i' $impure_dir/test_file) @@ -118,11 +99,11 @@ impure=$($GETFATTR_PROG --absolute-names --only-values -n 'trusted.overlay.impur # After $impure_dir becomes impure parent_d=$($here/src/t_dir_type $impure_dir $impure_dir_parent_st_ino) [[ $parent_d == ".. d" ]] || \ - echo "After dir becomes impure: Invalid d_ino reported for .." + echo "Impure dir: Invalid d_ino reported for .." current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino) [[ $current_d == ". d" ]] || \ - echo "After dir becomes impure: Invalid d_ino reported for ." + echo "Impure dir: Invalid d_ino reported for ." # Verify copy up file's d_ino file_d=$($here/src/t_dir_type $impure_dir $test_file_st_ino) @@ -134,30 +115,35 @@ rm -rf $impure_dir/test_file # Verify invalidation of readdir cache $here/src/t_dir_type $impure_dir $test_file_st_ino -[[ $? != 0 ]] || echo "Directory's readdir cache has stale entries" +[[ $? != 0 ]] || echo "Directory's readdir cache has stale file entries" impure=$($GETFATTR_PROG --absolute-names --only-values -n 'trusted.overlay.impure' \ $upperdir/test_dir/impure_dir 2>/dev/null) [[ -z $impure ]] || echo "Pure directory has impure xattr" -# Verify d_ino values corresponding to "." and ".." entries of a -# pure lower dir. -parent_st_ino=$(stat -c '%i' $SCRATCH_MNT/test_dir) +# Verify d_ino of '.' and '..' before and after dir becomes merge dir. +parent_st_ino=$(stat -c '%i' $test_dir) pure_lower_dir=$SCRATCH_MNT/test_dir/pure_lower_dir +pure_lower_dir_st_ino=$(stat -c '%i' $pure_lower_dir) parent_d=$($here/src/t_dir_type $pure_lower_dir $parent_st_ino) -[[ $parent_d == ".. d" ]] || echo "Pure lower dir: Invalid d_ino reported for .." - -pure_lower_dir_st_ino=$(stat -c '%i' $pure_lower_dir) +[[ $parent_d == ".. d" ]] || \ + echo "Pure lower dir: Invalid d_ino reported for .." current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino) -[[ $current_d == ". d" ]] || echo "Pure lower dir: Invalid d_ino reported for ." +[[ $current_d == ". d" ]] || \ + echo "Pure lower dir: Invalid d_ino reported for ." + +# Create a file in pure lower dir to make it a merge dir +touch $pure_lower_dir/newfile -# Verify d_ino of ".." entry of a merged dir. -merged_dir=$SCRATCH_MNT/test_dir/merged_dir +parent_d=$($here/src/t_dir_type $pure_lower_dir $parent_st_ino) +[[ $parent_d == ".. d" ]] || \ + echo "Merged dir: Invalid d_ino reported for .." -parent_d=$($here/src/t_dir_type $merged_dir $parent_st_ino) -[[ $parent_d == ".. d" ]] || echo "Merged dir: Invalid d_ino reported for .." +current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino) +[[ $current_d == ". d" ]] || \ + echo "Merged dir: Invalid d_ino reported for ." _scratch_unmount @@ -180,11 +166,12 @@ workdir=$OVL_BASE_SCRATCH_MNT/ovl-work _overlay_scratch_mount_dirs $middir:$lowerdir $upperdir $workdir # Copy up test_dir -touch $SCRATCH_MNT/test_dir/test_file +touch $test_dir/test_file -test_dir_st_ino=$(stat -c '%i' $SCRATCH_MNT/test_dir) +test_dir_st_ino=$(stat -c '%i' $test_dir) +pure_lower_dir=$test_dir/pure_lower_dir -parent_d=$($here/src/t_dir_type $SCRATCH_MNT/test_dir/pure_lower_dir $test_dir_st_ino) +parent_d=$($here/src/t_dir_type $pure_lower_dir $test_dir_st_ino) [[ $parent_d == ".. d" ]] || \ echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for .."