From patchwork Thu Apr 27 15:09:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9703011 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 35DC16032C for ; Thu, 27 Apr 2017 15:09:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3620D285EA for ; Thu, 27 Apr 2017 15:09:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A8EA28655; Thu, 27 Apr 2017 15:09:38 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 C778E285EA for ; Thu, 27 Apr 2017 15:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934551AbdD0PJh (ORCPT ); Thu, 27 Apr 2017 11:09:37 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36086 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932712AbdD0PJf (ORCPT ); Thu, 27 Apr 2017 11:09:35 -0400 Received: by mail-wm0-f68.google.com with SMTP id u65so5184559wmu.3; Thu, 27 Apr 2017 08:09:35 -0700 (PDT) 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=344LeS25DYWF7ojR2UM7W+Tyufg7Gtmz3FU55EM4a6Q=; b=KT7xjesUMwhszZtQKm/+i68LXEfG/8bAk1TV91ySV3A/ujGs/Gc36aOa/QrV3HYh55 bRu6VRvUE+mXAx9nCWWymsDqF3CLcmOF3wmAiUXiM8PJLdUyfuOyxQp8N/O6eptEvD3G zeuemgsawHhOY+88jl6CqV6nGzq26fURNq45nyKl1lpWJCL13bFm5WeobZ3OoAJbUgba SjmSMqfGq8AbmXi3QPYGGejY7guklM8POQuz8D8fQRa3ATVWwSCYq8JT7WzOzSl9KdEr V2l3Ue38vGXXdgQV5AMKR9fEjC5tWXIliuzB6h1LRoaybO8tV9qYU7Yre1J7Rv2zhftH uAAw== 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=344LeS25DYWF7ojR2UM7W+Tyufg7Gtmz3FU55EM4a6Q=; b=RfcALSCfVq4qG3hYNlxPr5iTjxjEsUEXGrjLO5RHqqPWhVoEgF9qt4P7oMTaSu81of KBfz6X+lJJ9NGF2umvTIeb2yKtgRGlmPfx+HEsZSyWyOHl7kaLmK48+PAwsESOxBu/qB 0tHgJIkX9o7MUCDFjHXX0p/BFr6W22rAQm2DHg5DBxHmmVkPzXKdk1iqHS6EKR/YfQ1x JlKO/inPpDQoXBzdOe3jBQTJ5NSrueynI7tu6TqQdhNFyZWoRKGM64wg/AsbEw9B06sB ahWga482GBoyExOzjnMnxzpm1rsFPskHFy/EV/wFgkyRq8za9qMg6JGRtpq0EWjfpz13 wNGg== X-Gm-Message-State: AN3rC/6nadWFtxAIzOcsgzepOWo8lO+B7rSLqGcfLAt3VEiqEMN4NkkE 3fqWix8BIVG9hDei X-Received: by 10.28.74.70 with SMTP id x67mr2448251wma.137.1493305774230; Thu, 27 Apr 2017 08:09:34 -0700 (PDT) Received: from amir-VirtualBox.lan (bzq-79-179-55-127.red.bezeqint.net. [79.179.55.127]) by smtp.gmail.com with ESMTPSA id p17sm3519265wmd.11.2017.04.27.08.09.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Apr 2017 08:09:33 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , Xiong Zhou , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 4/5] overlay/017: verify constant inode number after rename Date: Thu, 27 Apr 2017 18:09:34 +0300 Message-Id: <1493305775-12559-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493305775-12559-1-git-send-email-amir73il@gmail.com> References: <1493305775-12559-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 The test verifies constant inode number after copy up. Verify that inode number remains constant also after rename and drop caches (when overlayfs needs to find the lower inodes in another location). Signed-off-by: Amir Goldstein --- tests/overlay/017 | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/overlay/017 b/tests/overlay/017 index f3bf454..1cf684d 100755 --- a/tests/overlay/017 +++ b/tests/overlay/017 @@ -8,7 +8,8 @@ # - modify A to trigger copy up # - stat file A shows inode number Y != X # -# Also test if d_ino of readdir entries changes after copy up. +# Also test if d_ino of readdir entries changes after copy up +# and if inode numbers persist after rename and drop caches. # #----------------------------------------------------------------------- # @@ -94,6 +95,8 @@ _scratch_mount rm -f $tmp.* +testdir=$SCRATCH_MNT/test +mkdir -p $testdir # Test stable stat(2) st_ino @@ -106,18 +109,29 @@ for f in $FILES; do done # Record inode numbers after copy up -record_inode_numbers $SCRATCH_MNT $tmp.after +record_inode_numbers $SCRATCH_MNT $tmp.after_copyup + +for f in $FILES; do + # move to another dir + mv $SCRATCH_MNT/$f $testdir/ +done + +echo 3 > /proc/sys/vm/drop_caches + +# Record inode numbers after rename and drop caches +record_inode_numbers $testdir $tmp.after_move # Test stable readdir(3)/getdents(2) d_ino # find by inode number - expect to find file by inode number cat $tmp.before | while read ino f; do - find $SCRATCH_MNT/ -inum $ino -maxdepth 1 | grep -q $f || \ + find $testdir/ -inum $ino -maxdepth 1 | grep -q $f || \ echo "$f not found by ino $ino" done # Compare before..after - expect silence -diff $tmp.before $tmp.after +diff -u $tmp.before $tmp.after_copyup +diff -u $tmp.after_copyup $tmp.after_move echo "Silence is golden" status=0