summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-07-12 08:26:18 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2018-07-12 08:26:18 +0300
commit27356a063a8572b2d3bf57d92b0a12399478958a (patch)
tree261d7c2350840b70b258c0c67962aa2041421f49 /fs/xfs/xfs_reflink.c
parent7a7943c7e09546d4cc78b9756de23fd395b2cba4 (diff)
downloadlinux-27356a063a8572b2d3bf57d92b0a12399478958a.tar.xz
xfs: use ->t_dfops in cancel cow blocks operation
Use ->t_dfops of the transaction from the caller. Reset it before we return to avoid leaks of local stack memory. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 90457c2a7569..8ea4ba0e45d8 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -490,6 +490,7 @@ xfs_reflink_cancel_cow_blocks(
struct xfs_iext_cursor icur;
xfs_fsblock_t firstfsb;
struct xfs_defer_ops dfops;
+ struct xfs_defer_ops *odfops = (*tpp)->t_dfops;
int error = 0;
if (!xfs_is_reflink_inode(ip))
@@ -517,23 +518,24 @@ xfs_reflink_cancel_cow_blocks(
break;
} else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) {
xfs_defer_init(&dfops, &firstfsb);
+ (*tpp)->t_dfops = &dfops;
/* Free the CoW orphan record. */
error = xfs_refcount_free_cow_extent(ip->i_mount,
- &dfops, del.br_startblock,
+ (*tpp)->t_dfops, del.br_startblock,
del.br_blockcount);
if (error)
break;
- xfs_bmap_add_free(ip->i_mount, &dfops,
+ xfs_bmap_add_free(ip->i_mount, (*tpp)->t_dfops,
del.br_startblock, del.br_blockcount,
NULL);
/* Roll the transaction */
- xfs_defer_ijoin(&dfops, ip);
- error = xfs_defer_finish(tpp, &dfops);
+ xfs_defer_ijoin((*tpp)->t_dfops, ip);
+ error = xfs_defer_finish(tpp, (*tpp)->t_dfops);
if (error) {
- xfs_defer_cancel(&dfops);
+ xfs_defer_cancel((*tpp)->t_dfops);
break;
}
@@ -558,7 +560,7 @@ next_extent:
/* clear tag if cow fork is emptied */
if (!ifp->if_bytes)
xfs_inode_clear_cowblocks_tag(ip);
-
+ (*tpp)->t_dfops = odfops;
return error;
}