| To: | Christoph Hellwig <hch@xxxxxx> |
|---|---|
| Subject: | Re: [PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one |
| From: | "Darrick J. Wong" <darrick.wong@xxxxxxxxxx> |
| Date: | Mon, 4 Jan 2016 17:28:32 -0800 |
| Cc: | xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1451822873-12969-3-git-send-email-hch@xxxxxx> |
| References: | <1451822873-12969-1-git-send-email-hch@xxxxxx> <1451822873-12969-3-git-send-email-hch@xxxxxx> |
| User-agent: | Mutt/1.5.21 (2010-09-15) |
On Sun, Jan 03, 2016 at 01:07:52PM +0100, Christoph Hellwig wrote:
> 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;
> }
Good catch! There's a buffer leak in the error case for xfs_map_cow_blocks()
so I'll fold them both into the original patch.
--D
> - 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
|
| Previous by Date: | Re: [PATCH 1/3] xfs: pass inode instead of file to xfs_reflink_dirty_range, Darrick J. Wong |
|---|---|
| Next by Date: | Re: [PATCH 3/3] xfs: cancel COW in xfs_cancel_ioend, Darrick J. Wong |
| Previous by Thread: | [PATCH 2/3] xfs: only end a COW operation in xfs_zero_remaining_bytes if we started one, Christoph Hellwig |
| Next by Thread: | [PATCH 3/3] xfs: cancel COW in xfs_cancel_ioend, Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |