xfs: resurrect debug mode drop buffered writes mechanism
authorBrian Foster <bfoster@redhat.com>
Tue, 14 Feb 2017 06:48:17 +0000 (22:48 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 17 Feb 2017 01:19:15 +0000 (17:19 -0800)
commit9dbddd7b0c649bd6aa9442c717932325ec590303
tree845033c1408edf5ba5f55032fda4859c07dab89c
parentfa7f138ac4c70dc00519c124cf7cd4862a0a5b0e
xfs: resurrect debug mode drop buffered writes mechanism

A debug mode write failure mechanism was introduced to XFS in commit
801cc4e17a ("xfs: debug mode forced buffered write failure") to
facilitate targeted testing of delalloc indirect reservation management
from userspace. This code was subsequently rendered ineffective by the
move to iomap based buffered writes in commit 68a9f5e700 ("xfs:
implement iomap based buffered write path"). This likely went unnoticed
because the associated userspace code had not made it into xfstests.

Resurrect this mechanism to facilitate effective indlen reservation
testing from xfstests. The move to iomap based buffered writes relocated
the hook this mechanism needs to return write failure from XFS to
generic code. The failure trigger must remain in XFS. Given that
limitation, convert this from a write failure mechanism to one that
simply drops writes without returning failure to userspace. Rename all
"fail_writes" references to "drop_writes" to illustrate the point. This
is more hacky than preferred, but still triggers the XFS error handling
behavior required to drive the indlen tests. This is only available in
DEBUG mode and for testing purposes only.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_iomap.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_sysfs.c