diff options
author | Dave Chinner <david@fromorbit.com> | 2016-03-15 11:44:35 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-03-15 11:44:35 +1100 |
commit | 2cdb958aba6afbced5bc563167813b972b6acbfe (patch) | |
tree | 1ad9f3ec2753f80e94e62353ffd5d80d24c3c8f9 /fs/xfs/xfs_aops.c | |
parent | ab9d1e4f7b0217948a3b35a64178602ab30ff45d (diff) | |
parent | 355cced45286ed7e710058174066628ff9ad9fa4 (diff) | |
download | linux-2cdb958aba6afbced5bc563167813b972b6acbfe.tar.bz2 |
Merge branch 'xfs-misc-fixes-4.6-4' into for-next
Diffstat (limited to 'fs/xfs/xfs_aops.c')
-rw-r--r-- | fs/xfs/xfs_aops.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 75a39a8257ee..7ba680e572fc 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -1474,6 +1474,7 @@ xfs_vm_write_failed( loff_t from = pos & (PAGE_CACHE_SIZE - 1); loff_t to = from + len; struct buffer_head *bh, *head; + struct xfs_mount *mp = XFS_I(inode)->i_mount; /* * The request pos offset might be 32 or 64 bit, this is all fine @@ -1515,7 +1516,8 @@ xfs_vm_write_failed( if (!buffer_delay(bh) && !buffer_unwritten(bh)) continue; - if (!buffer_new(bh) && block_offset < i_size_read(inode)) + if (!xfs_mp_fail_writes(mp) && !buffer_new(bh) && + block_offset < i_size_read(inode)) continue; if (buffer_delay(bh)) @@ -1555,6 +1557,7 @@ xfs_vm_write_begin( pgoff_t index = pos >> PAGE_CACHE_SHIFT; struct page *page; int status; + struct xfs_mount *mp = XFS_I(mapping->host)->i_mount; ASSERT(len <= PAGE_CACHE_SIZE); @@ -1563,6 +1566,8 @@ xfs_vm_write_begin( return -ENOMEM; status = __block_write_begin(page, pos, len, xfs_get_blocks); + if (xfs_mp_fail_writes(mp)) + status = -EIO; if (unlikely(status)) { struct inode *inode = mapping->host; size_t isize = i_size_read(inode); @@ -1575,6 +1580,8 @@ xfs_vm_write_begin( * allocated in this write, not blocks that were previously * written successfully. */ + if (xfs_mp_fail_writes(mp)) + isize = 0; if (pos + len > isize) { ssize_t start = max_t(ssize_t, pos, isize); |