xfs: test readlink/readdir with malformed inode mode
authorAmir Goldstein <amir73il@gmail.com>
Wed, 11 Jan 2017 06:41:12 +0000 (08:41 +0200)
committerEryu Guan <eguan@redhat.com>
Fri, 20 Jan 2017 12:05:39 +0000 (20:05 +0800)
commit9b80c46ed0d3c892591ee3004ba9d8283f7e400b
tree38a17554cf397833659ecbc7ec9803b31aed93b3
parent707a5890cadba3404813cb59b509f7f9c9e97f87
xfs: test readlink/readdir with malformed inode mode

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 kernel 4.9 with
XFS_DEBUG=y

XFS: Assertion failed:
     rval == 0 || args->dp->i_d.di_size == args->geo->blksize,
file: /home/amir/build/src/linux/fs/xfs/libxfs/xfs_dir2.c, line: 634

A fix patch, as suggested by Darrick, changes this ASSERT() to
return -EFSCORRUPTED ("xfs: sanity check directory inode di_size").

Merging this test should be deferred to after fix patch is merged.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/xfs/348