From patchwork Mon Nov 20 14:34:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 10066633 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 90167603FA for ; Mon, 20 Nov 2017 14:33:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80E8329322 for ; Mon, 20 Nov 2017 14:33:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 742E329331; Mon, 20 Nov 2017 14:33:22 +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 E2E4B29322 for ; Mon, 20 Nov 2017 14:33:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751155AbdKTOdV (ORCPT ); Mon, 20 Nov 2017 09:33:21 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42614 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbdKTOdU (ORCPT ); Mon, 20 Nov 2017 09:33:20 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAKEWWwK056393 for ; Mon, 20 Nov 2017 09:33:19 -0500 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ebx2m216a-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 20 Nov 2017 09:33:19 -0500 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 20 Nov 2017 09:33:18 -0500 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 20 Nov 2017 09:33:16 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vAKEXFnN43647110; Mon, 20 Nov 2017 14:33:15 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4631AAE03C; Mon, 20 Nov 2017 09:34:08 -0500 (EST) Received: from localhost.localdomain.com (unknown [9.102.1.167]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 82FE1AE03B; Mon, 20 Nov 2017 09:34:06 -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 1/2] overlay/038: code cleanup Date: Mon, 20 Nov 2017 20:04:09 +0530 X-Mailer: git-send-email 2.9.5 X-TM-AS-GCONF: 00 x-cbid: 17112014-0048-0000-0000-00000208D080 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.00948639; 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:17 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17112014-0049-0000-0000-0000433AC501 Message-Id: <20171120143410.23357-1-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/041 test i.e. - Remove duplicate merged dir tests - Remove duplicate pure upper dir inside merged dir tests - Sort out comments and error messages Signed-off-by: Chandan Rajendra --- tests/overlay/038 | 66 +++++++++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/tests/overlay/038 b/tests/overlay/038 index 28c9c4e..fd804c4 100755 --- a/tests/overlay/038 +++ b/tests/overlay/038 @@ -59,32 +59,13 @@ upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER mkdir -p $lowerdir -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_mount 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 @@ -96,12 +77,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) @@ -112,11 +94,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) @@ -128,30 +110,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 ." -# Verify d_ino of ".." entry of a merged dir. -merged_dir=$SCRATCH_MNT/test_dir/merged_dir +# Create a file in pure lower dir to make it a merge dir +touch $pure_lower_dir/newfile -parent_d=$($here/src/t_dir_type $merged_dir $parent_st_ino) -[[ $parent_d == ".. d" ]] || echo "Merged dir: Invalid d_ino reported for .." +parent_d=$($here/src/t_dir_type $pure_lower_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 @@ -177,11 +164,12 @@ mkdir -p $lowerdir/test_dir/pure_lower_dir _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 .."