summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iomap.c
diff options
context:
space:
mode:
authorChandan Babu R <chandanrlinux@gmail.com>2021-01-23 01:48:11 +0100
committerDarrick J. Wong <djwong@kernel.org>2021-01-23 01:54:47 +0100
commit727e1acd297cae15449607d6e2ee39c71216cf1a (patch)
tree3057407785005630e7d01a6a6ed491a5c31fdde8 /fs/xfs/xfs_iomap.c
parentxfs: Add helper for checking per-inode extent count overflow (diff)
downloadlinux-727e1acd297cae15449607d6e2ee39c71216cf1a.tar.xz
linux-727e1acd297cae15449607d6e2ee39c71216cf1a.zip
xfs: Check for extent overflow when trivally adding a new extent
When adding a new data extent (without modifying an inode's existing extents) the extent count increases only by 1. This commit checks for extent count overflow in such cases. Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r--fs/xfs/xfs_iomap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 7b9ff824e82d..32246d90b9cb 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -250,6 +250,11 @@ xfs_iomap_write_direct(
if (error)
goto out_trans_cancel;
+ error = xfs_iext_count_may_overflow(ip, XFS_DATA_FORK,
+ XFS_IEXT_ADD_NOSPLIT_CNT);
+ if (error)
+ goto out_res_cancel;
+
xfs_trans_ijoin(tp, ip, 0);
/*