From patchwork Sun Nov 19 11:56:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10065121 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 08433602CB 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 0A0D4291DC for ; Sun, 19 Nov 2017 11:55:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3060291D1; Sun, 19 Nov 2017 11:55:55 +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 7233E291D1 for ; Sun, 19 Nov 2017 11:55:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750886AbdKSLzy (ORCPT ); Sun, 19 Nov 2017 06:55:54 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:45740 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbdKSLzy (ORCPT ); Sun, 19 Nov 2017 06:55:54 -0500 Received: by mail-wr0-f196.google.com with SMTP id a63so5671889wrc.12; Sun, 19 Nov 2017 03:55:53 -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=GFObFC2+oz7t+Dqb3lj/icyiff+WE5Yu+g/P3z9FtKw=; b=ec4uIloa0Zx++3tArpNmfU75hbDR85vxPrHxFK5qj3nX1QR3yalsPQ7dmvS9LZ8dIe qAa23BUaBA7L3okZ0Zd7aYaVvUe1w/Y7rPrujpN/wCO3qzCv9qr86PWdOmeU6JDSr3iw 70BPIjvOwEYcPfrRQyfXvyAphhNxj9zXo23rQoYjbrAv9j1ZI9XPOkgCjc3TaVEQZQlg qTUk+eKN/hkvoW3tWGmIcYnXBoxgjrfiS/U9F7mYXBxTnCqWurWA6kszux8WF2w/0hcK Gc+qv3S+sGbWrJMF2VyVfSNpYBWhgW9T3OGbPGB0iU/gwvG5CVsPZhBLr518kD6nuNW7 Lh/A== 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=GFObFC2+oz7t+Dqb3lj/icyiff+WE5Yu+g/P3z9FtKw=; b=S5fI1WwJ408PFvgDJy6QSpvvs/GBhtYvXoRYn76LCqe6Oz7kic31U7PQrDOyXodNsS tfZGKhJh1oGpmN/gV1PF96P4F7zCBlhOTwzhslwKlu5MMWaiavRl8q3BHUzhj35for1y axTcohuWRfaPQTPOWmutqJM7g1mCwJ1wFy2/YHoMKS8uT99JfszXXSopSsFO4Vxkpw9d B3q3yBUu0ayL/8NVBPq0KXKsXxU3ior/CYnv+KUfLDOSMn0UM7PN0OTC8eAGuu9Ox87g 9qADriVP2tNB6P/Z4n/W30rw/QiYbKuY51A92ns9PJyllILH9cLTNHwMsROzrnEd+MkP C+BA== X-Gm-Message-State: AJaThX4niLsSUcbEwrdjQQoGICtADGxSsrynjX+h0PiawBz1tlu45hjv xPGdhGdNCYDla7RkLMEIQoQI9w== X-Google-Smtp-Source: AGs4zMbGqng0XH/HLUuEcU/mL15BXn7/1qf3Q/ZkxzWYZItOKkOyl4rAB/9sm1STSkFiU6B2GX9HbA== X-Received: by 10.223.134.106 with SMTP id 39mr8359065wrw.134.1511092552673; Sun, 19 Nov 2017 03:55:52 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Nov 2017 03:55:52 -0800 (PST) From: Amir Goldstein To: Chandan Rajendra Cc: Eryu Guan , Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 2/3] overlay/041: test consistent values of st_ino/d_ino for subdirs Date: Sun, 19 Nov 2017 13:56:28 +0200 Message-Id: <1511092589-29179-3-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 In addition to checking consistent values of st_ino/d_ino for "." and ".." entries, check also the values for subdir inside each tested directory setup. Signed-off-by: Amir Goldstein --- tests/overlay/041 | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/tests/overlay/041 b/tests/overlay/041 index a615fcc..11efacb 100755 --- a/tests/overlay/041 +++ b/tests/overlay/041 @@ -60,7 +60,7 @@ rm -rf $lowerdir mkdir $lowerdir # Create our test files. -mkdir -p $lowerdir/test_dir/pure_lower_dir +mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir touch $lowerdir/test_file _scratch_mkfs @@ -74,10 +74,11 @@ test_dir=$SCRATCH_MNT/test_dir/ # Verify d_ino of '.' and '..' before and after dir becomes impure. impure_dir=$test_dir/impure_dir -mkdir -p $impure_dir +mkdir -p $impure_dir/subdir impure_dir_st_ino=$(stat -c '%i' $impure_dir) impure_dir_parent_st_ino=$(stat -c '%i' $test_dir) +impure_subdir_st_ino=$(stat -c '%i' $impure_dir/subdir) # Before $impure_dir becomes impure parent_d=$($here/src/t_dir_type $impure_dir $impure_dir_parent_st_ino) @@ -88,6 +89,10 @@ current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino) [[ $current_d == ". d" ]] || \ echo "Pure upper dir: Invalid d_ino reported for ." +subdir_d=$($here/src/t_dir_type $impure_dir $impure_subdir_st_ino) +[[ $subdir_d == "subdir d" ]] || \ + echo "Pure upper dir: Invalid d_ino reported for subdir" + # 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) @@ -105,6 +110,10 @@ current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino) [[ $current_d == ". d" ]] || \ echo "Impure dir: Invalid d_ino reported for ." +subdir_d=$($here/src/t_dir_type $impure_dir $impure_subdir_st_ino) +[[ $subdir_d == "subdir d" ]] || \ + echo "Impure dir: Invalid d_ino reported for subdir" + # Verify copy up file's d_ino file_d=$($here/src/t_dir_type $impure_dir $test_file_st_ino) [[ $file_d == "test_file f" ]] || \ @@ -112,19 +121,23 @@ file_d=$($here/src/t_dir_type $impure_dir $test_file_st_ino) # Make $impure_dir pure rm -rf $impure_dir/test_file +rm -rf $impure_dir/subdir # Verify invalidation of readdir cache $here/src/t_dir_type $impure_dir $test_file_st_ino [[ $? != 0 ]] || echo "Directory's readdir cache has stale file entries" +$here/src/t_dir_type $impure_dir $impure_subdir_st_ino +[[ $? != 0 ]] || echo "Directory's readdir cache has stale subdir 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 of '.' and '..' before and after dir becomes merge dir. +# Verify d_ino values of subdir entries of a pure lower 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) +pure_lower_subdir_st_ino=$(stat -c '%i' $pure_lower_dir/subdir) parent_d=$($here/src/t_dir_type $pure_lower_dir $parent_st_ino) [[ $parent_d == ".. d" ]] || \ @@ -134,6 +147,10 @@ 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 ." +subdir_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_subdir_st_ino) +[[ $subdir_d == "subdir d" ]] || \ + echo "Pure lower dir: Invalid d_ino reported for subdir" + # Create a file in pure lower dir to make it a merge dir touch $pure_lower_dir/newfile @@ -145,6 +162,10 @@ 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 ." +subdir_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_subdir_st_ino) +[[ $subdir_d == "subdir d" ]] || \ + echo "Merged dir: Invalid d_ino reported for subdir" + _scratch_unmount # Verify pure lower residing in dir which has another lower layer @@ -156,7 +177,7 @@ mkdir $middir mkdir $lowerdir mkdir -p $middir/test_dir -mkdir -p $lowerdir/test_dir/pure_lower_dir +mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir _scratch_mkfs @@ -170,11 +191,21 @@ touch $test_dir/test_file test_dir_st_ino=$(stat -c '%i' $test_dir) pure_lower_dir=$test_dir/pure_lower_dir +pure_lower_dir_st_ino=$(stat -c '%i' $pure_lower_dir) +pure_lower_subdir_st_ino=$(stat -c '%i' $pure_lower_dir/subdir) 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 .." +current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino) +[[ $current_d == ". d" ]] || \ + echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for ." + +subdir_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_subdir_st_ino) +[[ $subdir_d == "subdir d" ]] || \ + echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for subdir" + echo "Silence is golden" status=0 exit