From: Christoph Hellwig <hch@lst.de>
To: darrick.wong@oracle.com
Cc: xfs@oss.sgi.com
Subject: [PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one
Date: Sun, 3 Jan 2016 13:07:52 +0100 [thread overview]
Message-ID: <1451822873-12969-3-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1451822873-12969-1-git-send-email-hch@lst.de>
Without these we can see NULL pointer dereferences due to a non-existing
COW fork during xfstests runs.
Signed-off-by: Christoph Hellwig <hch@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
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-01-03 12:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-03 12:07 reflink fixes Christoph Hellwig
2016-01-03 12:07 ` [PATCH 1/3] xfs: pass inode instead of file to xfs_reflink_dirty_range Christoph Hellwig
2016-01-05 1:23 ` Darrick J. Wong
2016-01-03 12:07 ` Christoph Hellwig [this message]
2016-01-05 1:28 ` [PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one Darrick J. Wong
2016-01-03 12:07 ` [PATCH 3/3] xfs: cancel COW in xfs_cancel_ioend Christoph Hellwig
2016-01-05 1:43 ` Darrick J. Wong
2016-01-05 10:42 ` Christoph Hellwig
2016-01-07 0:32 ` Darrick J. Wong
2016-01-07 15:25 ` Christoph Hellwig
2016-01-08 10:09 ` Darrick J. Wong
2016-01-08 13:47 ` Christoph Hellwig
2016-01-09 21:17 ` Darrick J. Wong
2016-01-10 7:54 ` Christoph Hellwig
2016-01-10 22:48 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451822873-12969-3-git-send-email-hch@lst.de \
--to=hch@lst.de \
--cc=darrick.wong@oracle.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox