From patchwork Sat Nov 18 05:58:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 10064381 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 1F0D36023A for ; Sat, 18 Nov 2017 05:57:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 158C62AE3C for ; Sat, 18 Nov 2017 05:57:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08C122AE53; Sat, 18 Nov 2017 05:57: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 C668C2AEE5 for ; Sat, 18 Nov 2017 05:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161459AbdKRF5Q (ORCPT ); Sat, 18 Nov 2017 00:57:16 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51368 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161421AbdKRF5P (ORCPT ); Sat, 18 Nov 2017 00:57:15 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAI5ru1v036035 for ; Sat, 18 Nov 2017 00:57:15 -0500 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0b-001b2d01.pphosted.com with ESMTP id 2eaehuh3c6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 18 Nov 2017 00:57:15 -0500 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 18 Nov 2017 00:57:14 -0500 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 18 Nov 2017 00:57:12 -0500 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vAI5vB6u41812028; Sat, 18 Nov 2017 05:57:11 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD7A6B2046; Sat, 18 Nov 2017 00:54:21 -0500 (EST) Received: from localhost.localdomain.com (unknown [9.85.75.144]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id E3170B204E; Sat, 18 Nov 2017 00:54:19 -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/3] overlay/018: Add constant d_ino test Date: Sat, 18 Nov 2017 11:28:03 +0530 X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171118055804.17611-1-chandan@linux.vnet.ibm.com> References: <20171118055804.17611-1-chandan@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17111805-0048-0000-0000-00000207EB65 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008085; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000240; SDB=6.00947514; UDB=6.00478381; IPR=6.00727806; BA=6.00005698; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018077; XFM=3.00000015; UTC=2017-11-18 05:57:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17111805-0049-0000-0000-000043355C16 Message-Id: <20171118055804.17611-2-chandan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-11-18_03:, , 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-1711180084 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Constant d_ino for hardlinks is possible only when "index" config feature/mount option is enabled. Signed-off-by: Chandan Rajendra --- tests/overlay/018 | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/overlay/018 b/tests/overlay/018 index a4f67d1..6e026c1 100755 --- a/tests/overlay/018 +++ b/tests/overlay/018 @@ -50,6 +50,7 @@ _supported_fs overlay _supported_os Linux _require_scratch _require_scratch_feature index +_require_test_program "t_dir_type" rm -f $seqres.full @@ -65,14 +66,15 @@ ln $lowerdir/foo $lowerdir/bar # Record inode numbers in format function record_ino_nlink() { - ls -li $FILES | awk '{ print $1, $3 }' > $1 + ls -li $FILES | awk '{ print $1, $3, $10}' > $1 } # Check inode numbers match recorded inode numbers function check_ino_nlink() { - before=$1 - after=$2 + dir=$1 + before=$2 + after=$3 record_ino_nlink $after @@ -80,6 +82,13 @@ function check_ino_nlink() # Compare before..after - expect silence # We use diff -u so out.bad will tell us which stage failed diff -u $before $after + + # Test constant readdir(3)/getdents(2) d_ino - + # Expect to find file by inode number + cat $before | while read ino nlink f; do + $here/src/t_dir_type $dir $ino | grep -q $(basename $f) || \ + echo "$(basename $f) not found by ino $ino (from $before)" + done } # Enable overlay index feature to prevent breaking hardlinks on copy up @@ -104,14 +113,14 @@ echo "one" >> $bar echo "== After write one ==" cat $FILES -check_ino_nlink $tmp.before $tmp.after_one +check_ino_nlink $SCRATCH_MNT $tmp.before $tmp.after_one # Verify that the hardlinks survive a mount cycle _scratch_cycle_mount index=on echo "== After mount cycle ==" cat $FILES -check_ino_nlink $tmp.after_one $tmp.after_cycle +check_ino_nlink $SCRATCH_MNT $tmp.after_one $tmp.after_cycle # Drop caches to get the copied up hardlink out of cache echo 3 > /proc/sys/vm/drop_caches @@ -121,7 +130,7 @@ echo "two" >> $foo echo "== After write two ==" cat $FILES -check_ino_nlink $tmp.after_one $tmp.after_two +check_ino_nlink $SCRATCH_MNT $tmp.after_one $tmp.after_two status=0 exit