All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>,
	"Darrick J . Wong" <darrick.wong@oracle.com>,
	Christoph Hellwig <hch@infradead.org>
Cc: Brian Foster <bfoster@redhat.com>,
	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	[thread overview]
Message-ID: <1482689376-23553-3-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1482689376-23553-1-git-send-email-amir73il@gmail.com>

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 <amir73il@gmail.com>
---
 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
-- 
2.7.4


  parent reply	other threads:[~2016-12-25 18:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-25 18:09 [PATCH v2 0/3] xfs/348: test handling of malformed inode mode Amir Goldstein
2016-12-25 18:09 ` [PATCH v2 1/3] xfs/348: test handling of invalid inode modes Amir Goldstein
2017-01-03 20:36   ` Darrick J. Wong
2017-01-04 10:36     ` Amir Goldstein
2017-01-04 20:33       ` Darrick J. Wong
2016-12-25 18:09 ` Amir Goldstein [this message]
2016-12-25 18:09 ` [PATCH v2 3/3] xfs/348: test readlink/readdir with malformed inode mode Amir Goldstein
2017-01-03  5:52 ` [PATCH v2 0/3] xfs/348: test handling of " Eryu Guan
2017-01-11  6:45   ` Amir Goldstein
2017-01-11  9:08     ` Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482689376-23553-3-git-send-email-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.