| To: | darrick.wong@xxxxxxxxxx |
|---|---|
| Subject: | [PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one |
| From: | Christoph Hellwig <hch@xxxxxx> |
| Date: | Sun, 3 Jan 2016 13:07:52 +0100 |
| Cc: | david@xxxxxxxxxxxxx, xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1451822873-12969-1-git-send-email-hch@xxxxxx> |
| References: | <1451822873-12969-1-git-send-email-hch@xxxxxx> |
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
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | reflink fixes, Christoph Hellwig |
|---|---|
| Next by Date: | [PATCH 3/3] xfs: cancel COW in xfs_cancel_ioend, Christoph Hellwig |
| Previous by Thread: | Re: [PATCH 1/3] xfs: pass inode instead of file to xfs_reflink_dirty_range, Darrick J. Wong |
| Next by Thread: | Re: [PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one, Darrick J. Wong |
| Indexes: | [Date] [Thread] [Top] [All Lists] |