summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_inode_fork.h
diff options
context:
space:
mode:
authorChandan Babu R <chandanrlinux@gmail.com>2021-01-22 16:48:13 -0800
committerDarrick J. Wong <djwong@kernel.org>2021-01-22 16:54:48 -0800
commit3a19bb147c72d2e9b77137bf5130b9cfb50a5eef (patch)
tree9f39a5a28d86e10b55e39d7309f0b74ed8ccdcf9 /fs/xfs/libxfs/xfs_inode_fork.h
parent02092a2f034fdeabab524ae39c2de86ba9ffa15a (diff)
xfs: Check for extent overflow when adding/removing xattrs
Adding/removing an xattr can cause XFS_DA_NODE_MAXDEPTH extents to be added. One extra extent for dabtree in case a local attr is large enough to cause a double split. It can also cause extent count to increase proportional to the size of a remote xattr's value. 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/libxfs/xfs_inode_fork.h')
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_inode_fork.h b/fs/xfs/libxfs/xfs_inode_fork.h
index ea1a9dd8a763..8d89838e23f8 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.h
+++ b/fs/xfs/libxfs/xfs_inode_fork.h
@@ -61,6 +61,16 @@ struct xfs_ifork {
((XFS_DA_NODE_MAXDEPTH + 1 + 1) * (mp)->m_dir_geo->fsbcount)
/*
+ * Adding/removing an xattr can cause XFS_DA_NODE_MAXDEPTH extents to
+ * be added. One extra extent for dabtree in case a local attr is
+ * large enough to cause a double split. It can also cause extent
+ * count to increase proportional to the size of a remote xattr's
+ * value.
+ */
+#define XFS_IEXT_ATTR_MANIP_CNT(rmt_blks) \
+ (XFS_DA_NODE_MAXDEPTH + max(1, rmt_blks))
+
+/*
* Fork handling.
*/