diff options
author | Brian Foster <bfoster@redhat.com> | 2017-02-14 07:48:17 +0100 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-02-17 02:19:15 +0100 |
commit | 9dbddd7b0c649bd6aa9442c717932325ec590303 (patch) | |
tree | 845033c1408edf5ba5f55032fda4859c07dab89c /fs/xfs/xfs_iomap.c | |
parent | xfs: clear delalloc and cache on buffered write failure (diff) | |
download | linux-9dbddd7b0c649bd6aa9442c717932325ec590303.tar.xz linux-9dbddd7b0c649bd6aa9442c717932325ec590303.zip |
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>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 4009e7c8b52b..41662fb14e87 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -1078,6 +1078,10 @@ xfs_file_iomap_end_delalloc( xfs_fileoff_t end_fsb; int error = 0; + /* behave as if the write failed if drop writes is enabled */ + if (xfs_mp_drop_writes(mp)) + written = 0; + /* * start_fsb refers to the first unused block after a short write. If * nothing was written, round offset down to point at the first block in |