summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2016-10-10 16:47:32 +1100
committerDave Chinner <david@fromorbit.com>2016-10-10 16:47:32 +1100
commit63646fc58d666f149b85ccf470bfc1576a779d4c (patch)
treedc640908f7a21bf0f81f0b3e51a05d5f583e9ec1 /fs/xfs/xfs_reflink.c
parent1f08af52e7c981e9877796a2d90b0e0f08666945 (diff)
downloadop-kernel-dev-63646fc58d666f149b85ccf470bfc1576a779d4c.zip
op-kernel-dev-63646fc58d666f149b85ccf470bfc1576a779d4c.tar.gz
xfs: check inode reflink flag before calling reflink functions
There are a couple of places where we don't check the inode's reflink flag before calling into the reflink code. Fix those, and add some asserts so we don't make this mistake again. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reported-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 685c419..9c58b4a 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -624,6 +624,7 @@ xfs_reflink_cancel_cow_range(
int error;
trace_xfs_reflink_cancel_cow_range(ip, offset, count);
+ ASSERT(xfs_is_reflink_inode(ip));
offset_fsb = XFS_B_TO_FSBT(ip->i_mount, offset);
if (count == NULLFILEOFF)
@@ -1510,8 +1511,7 @@ xfs_reflink_clear_inode_flag(
int nmaps;
int error = 0;
- if (!(ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK))
- return 0;
+ ASSERT(xfs_is_reflink_inode(ip));
fbno = 0;
end = XFS_B_TO_FSB(mp, i_size_read(VFS_I(ip)));
OpenPOWER on IntegriCloud