[PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one
Christoph Hellwig
hch at lst.de
Sun Jan 3 06:07:52 CST 2016
Without these we can see NULL pointer dereferences due to a non-existing
COW fork during xfstests runs.
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
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
More information about the xfs
mailing list