linux-xfs.vger.kernel.org archive mirror
 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 3/3] xfs/348: test readlink/readdir with malformed inode mode
Date: Sun, 25 Dec 2016 20:09:36 +0200	[thread overview]
Message-ID: <1482689376-23553-4-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,
and fstat of those inodes on a mounted fs, try to also list content
of mock directory and readlink of mock symlink.

Readdir of mock directory triggers XFS assertion on umount:
 XFS: Assertion failed: !rwsem_is_locked(&inode->i_rwsem), file:
 /home/amir/build/src/linux/fs/xfs/xfs_super.c, line: 951

To reproduce, need to comment out the variable 'safety'.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 tests/xfs/348 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/xfs/348 b/tests/xfs/348
index 2a54f9e..cb0e3ea 100755
--- a/tests/xfs/348
+++ b/tests/xfs/348
@@ -132,6 +132,16 @@ for dt in $dtypes; do
 			cat $tmp.stat.err
 		else
 			echo "stat: '$testdir/$file' is a $ftype"
+			# Verify that readlink of a file posing as a symlink
+			# and ls of a file posing as a directory does not blow up
+			safety="-d"
+			# NOTE that ls DOES blow up with kernel 4.9 on malformed
+			# directory - remove the safety pin to explode
+			if [ -d $testdir/$file ]; then
+				ls "$safety" $testdir/$file &> /dev/null
+			elif [ -h $testdir/$file ]; then
+				readlink $testdir/$file &> /dev/null
+			fi
 		fi | _filter_scratch
 	done
 	_scratch_unmount
-- 
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 ` [PATCH v2 2/3] xfs/348: test fstat with malformed inode mode Amir Goldstein
2016-12-25 18:09 ` Amir Goldstein [this message]
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-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).