From patchwork Mon Nov 20 14:34:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 10066635 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 78114603FA for ; Mon, 20 Nov 2017 14:33:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 693BF29332 for ; Mon, 20 Nov 2017 14:33:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D8F829336; Mon, 20 Nov 2017 14:33:26 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 C8E4129332 for ; Mon, 20 Nov 2017 14:33:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751186AbdKTOdZ (ORCPT ); Mon, 20 Nov 2017 09:33:25 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42324 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbdKTOdZ (ORCPT ); Mon, 20 Nov 2017 09:33:25 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAKEUnIe022991 for ; Mon, 20 Nov 2017 09:33:24 -0500 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ebyu14n62-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 20 Nov 2017 09:33:24 -0500 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 20 Nov 2017 09:33:22 -0500 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 20 Nov 2017 09:33:19 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vAKEXJm540108072; Mon, 20 Nov 2017 14:33:19 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1300AE034; Mon, 20 Nov 2017 09:34:11 -0500 (EST) Received: from localhost.localdomain.com (unknown [9.102.1.167]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id D30F4AE03B; Mon, 20 Nov 2017 09:34:09 -0500 (EST) From: Chandan Rajendra To: fstests@vger.kernel.org, amir73il@gmail.com Cc: Chandan Rajendra , linux-unionfs@vger.kernel.org, eguan@redhat.com Subject: [PATCH 2/2] overlay/038: test consistent values of st_ino/d_ino for subdirs Date: Mon, 20 Nov 2017 20:04:10 +0530 X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171120143410.23357-1-chandan@linux.vnet.ibm.com> References: <20171120143410.23357-1-chandan@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17112014-0056-0000-0000-000003ECD014 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008099; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000240; SDB=6.00948640; UDB=6.00479029; IPR=6.00728922; BA=6.00005702; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018107; XFM=3.00000015; UTC=2017-11-20 14:33:21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17112014-0057-0000-0000-00000823F3D5 Message-Id: <20171120143410.23357-2-chandan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-11-20_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711200196 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This commit implements similar changes made to overlay/038 test i.e. 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: Chandan Rajendra --- tests/overlay/038 | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/tests/overlay/038 b/tests/overlay/038 index fd804c4..5415324 100755 --- a/tests/overlay/038 +++ b/tests/overlay/038 @@ -59,7 +59,7 @@ upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER mkdir -p $lowerdir -mkdir -p $lowerdir/test_dir/pure_lower_dir +mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir touch $lowerdir/test_file @@ -69,10 +69,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) @@ -83,6 +84,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) @@ -100,6 +105,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" ]] || \ @@ -107,19 +116,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" ]] || \ @@ -129,6 +142,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 @@ -140,6 +157,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 @@ -158,8 +179,7 @@ mkdir -p $lowerdir mkdir -p $upperdir mkdir -p $workdir -mkdir -p $middir/test_dir -mkdir -p $lowerdir/test_dir/pure_lower_dir +mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir _overlay_scratch_mount_dirs "$middir:$lowerdir" $upperdir $workdir @@ -168,10 +188,19 @@ 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