Without these we can see NULL pointer dereferences due to a non-existing COW fork during xfstests runs. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- fs/xfs/xfs_bmap_util.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 7bee3c7..e777095 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1226,13 +1226,15 @@ xfs_zero_remaining_bytes( error = xfs_bwrite(bp); xfs_buf_relse(bp); - if (error) { - err2 = xfs_reflink_end_cow_failed(ip, offset, + if (should_fork) { + if (error) { + err2 = xfs_reflink_end_cow_failed(ip, offset, + lastoffset - offset + 1); + return error; + } + error = xfs_reflink_end_cow(ip, offset, lastoffset - offset + 1); - return error; } - error = xfs_reflink_end_cow(ip, offset, - lastoffset - offset + 1); if (error) return error; } -- 1.9.1 _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs