From patchwork Sun Dec 25 18:09:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9488259 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 2FFC060860 for ; Sun, 25 Dec 2016 18:10:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 353CE25D97 for ; Sun, 25 Dec 2016 18:10:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A3B026E1A; Sun, 25 Dec 2016 18:10:05 +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=unavailable 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 5692D22A63 for ; Sun, 25 Dec 2016 18:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753064AbcLYSKD (ORCPT ); Sun, 25 Dec 2016 13:10:03 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:32816 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851AbcLYSKB (ORCPT ); Sun, 25 Dec 2016 13:10:01 -0500 Received: by mail-wj0-f193.google.com with SMTP id kp2so46495787wjc.0; Sun, 25 Dec 2016 10:10:00 -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=kvYh2B8PQUOQkbWLRfFHYQOqMCLq7MjjiuO2QEjqQI4=; b=qXrUo48x4ywgXkuathAPf1vkxq3xwlha9MCbvl9wwp/Kas2IX04U5O6g4bNF7b6iVQ s68HAHJAIWi4WSdGFiyUlkt2CeKGbcVwL2Yep6dVKFxN1H7CDRWy+9cjlGvarN8dQucm QHb6fPmbvic9RfG9GGnpf2KpBQH+lpCuMbF4mizLZTJ0if0LN4RxhQQtdeq8j3T/BBLJ tjVu/PSBta6hqlMbdNRK7t9XetHdoHk0ogvKqtrq2DHNTBc8XIYLKOWZNcFVVNcwVl/m GuGlsSdwZ9bqUJ3yB/wKEC+ewJ+UMBt2Q7vut8lmUfIgcMEmZ6bh9z9ckpzLExcAf5cX A4Mg== 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=kvYh2B8PQUOQkbWLRfFHYQOqMCLq7MjjiuO2QEjqQI4=; b=Q9HjQzl4nUCMLSwDx+ivhHHCdxtZeoN4Fivl/xrCZBrQk2f5e1wY8ZcAevWbfQSoRR ADOewwTm7YtSUEwqpwqwpBT/eIUFA4RIYu/DjH2Hh1Z6LhY7rw7an1pB/smeSBsiQuGg sPFra/CpfDIhoq4fm9K906sfgUbtZu2aA5nqMT6Ak3BmczegZ3bVXqoP6dtO8hMHa999 purFKzBPIo2TkwBxvqNzvMcMXBspP+ziH9vouEDyKzQfXiAcioRb1auZsh3BBqAQ5Zqn EtKeuo+MhILa2rMp2av+1WTW9oV46KBLD5VWwq11gwESikxHvV4+rL157Ou2UsLiu7l3 mVqg== X-Gm-Message-State: AIkVDXLz8PJAAd4JqJg8aMsA2t8yTr28oL1GH6s1qZOpse9Bacy8EZGATehcEGss07qM+A== X-Received: by 10.194.123.137 with SMTP id ma9mr8471945wjb.106.1482689399948; Sun, 25 Dec 2016 10:09:59 -0800 (PST) Received: from amir-VirtualBox.Home (bzq-79-180-107-203.red.bezeqint.net. [79.180.107.203]) by smtp.gmail.com with ESMTPSA id d184sm48068733wmd.8.2016.12.25.10.09.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Dec 2016 10:09:59 -0800 (PST) From: Amir Goldstein To: Eryu Guan , "Darrick J . Wong" , Christoph Hellwig Cc: Brian Foster , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v2 2/3] xfs/348: test fstat with malformed inode mode Date: Sun, 25 Dec 2016 20:09:35 +0200 Message-Id: <1482689376-23553-3-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482689376-23553-1-git-send-email-amir73il@gmail.com> References: <1482689376-23553-1-git-send-email-amir73il@gmail.com> Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@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. Signed-off-by: Amir Goldstein --- tests/xfs/348 | 16 ++++++++++ tests/xfs/348.out | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) diff --git a/tests/xfs/348 b/tests/xfs/348 index 9ec696a..2a54f9e 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 @@ -119,6 +123,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 FILE 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 bf4924b..cdb7d78 100644 --- a/tests/xfs/348.out +++ b/tests/xfs/348.out @@ -20,6 +20,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -31,6 +37,12 @@ core.mode = 010644 would have junked entry "DIR" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -42,6 +54,12 @@ core.mode = 020644 would have junked entry "DIR" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -56,6 +74,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -68,6 +92,12 @@ would have junked entry "BLKDEV" in directory PARENT_INO would have junked entry "CHRDEV" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" in directory PARENT_INO +stat: 'SCRATCH_MNT/test/DIR' is a directory +stat: 'SCRATCH_MNT/test/FILE' is a directory +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 @@ -82,6 +112,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -93,6 +129,12 @@ core.mode = 060644 would have junked entry "DIR" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -107,6 +149,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -120,6 +168,12 @@ 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/FILE' is a regular 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 @@ -134,6 +188,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -147,6 +207,12 @@ 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 "FILE" in directory PARENT_INO +stat: 'SCRATCH_MNT/test/DIR' is a symbolic link +stat: 'SCRATCH_MNT/test/FILE' is a symbolic link +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 @@ -161,6 +227,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -172,6 +244,12 @@ core.mode = 0140644 would have junked entry "DIR" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -186,6 +264,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -200,6 +284,12 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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 @@ -214,3 +304,9 @@ would have junked entry "DIR" in directory PARENT_INO would have junked entry "FIFO" in directory PARENT_INO would have junked entry "FILE" 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/FILE': 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