From patchwork Mon Jan 9 13:30:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9504649 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 1F74A60710 for ; Mon, 9 Jan 2017 13:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CD6D28112 for ; Mon, 9 Jan 2017 13:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1095A284AD; Mon, 9 Jan 2017 13:34:07 +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 ED40F28112 for ; Mon, 9 Jan 2017 13:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761962AbdAINc2 (ORCPT ); Mon, 9 Jan 2017 08:32:28 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35059 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938450AbdAINa4 (ORCPT ); Mon, 9 Jan 2017 08:30:56 -0500 Received: by mail-wm0-f65.google.com with SMTP id l2so22231850wml.2; Mon, 09 Jan 2017 05:30:55 -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=T8NyJyUhPsDLWUYQwlfyHeik2cak8TFa8SGprxTHFsk=; b=M5Hyuy1+MVL6FuG2d5qEvtmuckfMvtxjlMQ2E6imQwOFwMIGYT6+8PoVr7nLYLH00F kT4+j6AdODK/3GfvOu9vvexxAoaRHtPR1EX3krhSDv0AA8elOKZFEWR6jD8jPOwrGWBl Or+BEZG4uNt9z4cRCFGmMh3KlxEr1OjagRMUFZifY0Zhq/ai9+VlERU/rhlAGFe2Q7tG 0Zds/ExRHhlxCamPTjAvnQ1c/5z3e5VeXrBLOKt9FXmASD58zvzIo5xytOp0+X+LWMlP AmFknW29tQXQYeDISApXFP9Krz5n5OOKfKxN39pLsNRoJ6F+rkwm2964YRn4DAVw1tw+ 6oCQ== 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=T8NyJyUhPsDLWUYQwlfyHeik2cak8TFa8SGprxTHFsk=; b=nWxkuIU3P51WpQdx1nT3FgP2hJd1wZ3kEGD/DUwrMV7xHFlOJKHkMM7yToTFu0W7S6 E/IYxSkv0IuSJzuJak7hCfhWPf9Gqk4r0djvDHny4F5xc3vRzyJ7L2vwE1EnQdQrTWHM At493+/fQbE/q6l+l0iJVwJYUykksDqQQkPTS4+FBRpBPHJ10HWpQygITVPgvMSuH6q8 fD4NI16SN/Q4DL9uLA1uw5yWUelxysJsGlP37HbwBaGKXHZcNGl9h52ERZAKvWOBJ/tO RatiQuCCAPAaGgSl6njG4CAo7YNYashF13rBdpxKCrDOuQU9A6yUQ4cSetc0wCtgfVDY 7Gyw== X-Gm-Message-State: AIkVDXJz/g9gFCTOvPQjwEoqgspFVe4dp9maIIUXtbhioslXecHfFCnkDI78K/+3wfqVsw== X-Received: by 10.28.127.20 with SMTP id a20mr4970160wmd.15.1483968654577; Mon, 09 Jan 2017 05:30:54 -0800 (PST) Received: from amir-VirtualBox.ctera.local (bzq-82-81-193-202.cablep.bezeqint.net. [82.81.193.202]) by smtp.gmail.com with ESMTPSA id 81sm18946348wmw.7.2017.01.09.05.30.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jan 2017 05:30:53 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Brian Foster , "Darrick J . Wong" , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v3 2/3] xfs: test fstat with malformed inode mode Date: Mon, 9 Jan 2017 15:30:24 +0200 Message-Id: <1483968625-29160-3-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483968625-29160-1-git-send-email-amir73il@gmail.com> References: <1483968625-29160-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 testing xfs_repair on inodes with malformed mode, also test fstat of those inodes on a mounted fs. This additional test is quite noisy with dmesg warnings, so check dmesg has been disabled. This test fails on kernel 4.9 because a zero size inode is not identified as malformed dir. A patch has been sent to fix this ("xfs: sanity check directory inode di_size"). This test may be merged before the fix patch. Signed-off-by: Amir Goldstein --- tests/xfs/348 | 16 ++++++++ tests/xfs/348.out | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/tests/xfs/348 b/tests/xfs/348 index c5249eb..30825a4 100755 --- a/tests/xfs/348 +++ b/tests/xfs/348 @@ -49,6 +49,10 @@ _supported_fs xfs _supported_os Linux _require_scratch +# This test will corrupt fs intentionally, so there will be WARNINGs +# in dmesg as expected +_disable_dmesg_check + rm -f $seqres.full _scratch_mkfs >>$seqres.full 2>&1 @@ -120,6 +124,18 @@ for dt in $dtypes; do _scratch_xfs_repair -n 2>&1 | grep -q -v "^would fix ftype mismatch" || \ _fail "xfs_repair should not fix ftype mismatch" fi + + _scratch_mount + for file in DIR DATA EMPTY SYMLINK CHRDEV BLKDEV FIFO; do + rm -f $tmp.stat.err + ftype=$(stat --printf=%F $testdir/$file 2>$tmp.stat.err) + if [ -s $tmp.stat.err ]; then + cat $tmp.stat.err + else + echo "stat: '$testdir/$file' is a $ftype" + fi | _filter_scratch + done + _scratch_unmount done # Repair should detect and junk all test files diff --git a/tests/xfs/348.out b/tests/xfs/348.out index 31cf415..805d530 100644 --- a/tests/xfs/348.out +++ b/tests/xfs/348.out @@ -23,6 +23,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=1 to all files: core.mode = 010644 @@ -36,6 +43,13 @@ would have junked entry "DATA" in directory PARENT_INO would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: 'SCRATCH_MNT/test/CHRDEV' is a fifo +stat: 'SCRATCH_MNT/test/BLKDEV' is a fifo +stat: 'SCRATCH_MNT/test/FIFO' is a fifo ===== Setting dt=2 to all files: core.mode = 020644 @@ -49,6 +63,13 @@ would have junked entry "DATA" in directory PARENT_INO would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: 'SCRATCH_MNT/test/CHRDEV' is a character special file +stat: 'SCRATCH_MNT/test/BLKDEV' is a character special file +stat: 'SCRATCH_MNT/test/FIFO' is a character special file ===== Setting dt=3 to all files: core.mode = 030644 @@ -65,6 +86,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=4 to all files: core.mode = 040644 @@ -79,6 +107,13 @@ would have junked entry "CHRDEV" in directory PARENT_INO would have junked entry "DATA" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO +stat: 'SCRATCH_MNT/test/DIR' is a directory +stat: 'SCRATCH_MNT/test/DATA' is a directory +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: 'SCRATCH_MNT/test/SYMLINK' is a directory +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=5 to all files: core.mode = 050644 @@ -95,6 +130,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=6 to all files: core.mode = 060644 @@ -108,6 +150,13 @@ would have junked entry "DATA" in directory PARENT_INO would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: 'SCRATCH_MNT/test/CHRDEV' is a block special file +stat: 'SCRATCH_MNT/test/BLKDEV' is a block special file +stat: 'SCRATCH_MNT/test/FIFO' is a block special file ===== Setting dt=7 to all files: core.mode = 070644 @@ -124,6 +173,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=10 to all files: core.mode = 0100644 @@ -138,6 +194,13 @@ would have junked entry "CHRDEV" in directory PARENT_INO would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: 'SCRATCH_MNT/test/DATA' is a regular file +stat: 'SCRATCH_MNT/test/EMPTY' is a regular empty file +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=11 to all files: core.mode = 0110644 @@ -154,6 +217,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=12 to all files: core.mode = 0120644 @@ -169,6 +239,13 @@ would have junked entry "DATA" in directory PARENT_INO would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO +stat: 'SCRATCH_MNT/test/DIR' is a symbolic link +stat: 'SCRATCH_MNT/test/DATA' is a symbolic link +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: 'SCRATCH_MNT/test/SYMLINK' is a symbolic link +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=13 to all files: core.mode = 0130644 @@ -185,6 +262,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=14 to all files: core.mode = 0140644 @@ -198,6 +282,13 @@ would have junked entry "DATA" in directory PARENT_INO would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: 'SCRATCH_MNT/test/CHRDEV' is a socket +stat: 'SCRATCH_MNT/test/BLKDEV' is a socket +stat: 'SCRATCH_MNT/test/FIFO' is a socket ===== Setting dt=15 to all files: core.mode = 0150644 @@ -214,6 +305,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=16 to all files: core.mode = 0160644 @@ -230,6 +328,13 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning ===== Setting dt=17 to all files: core.mode = 0170644 @@ -246,3 +351,10 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "EMPTY" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "SYMLINK" in directory PARENT_INO +stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/DATA': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/EMPTY': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning +stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning