aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorGravatar Christoph Hellwig <hch@lst.de> 2020-05-14 14:01:31 -0700
committerGravatar Darrick J. Wong <darrick.wong@oracle.com> 2020-05-19 09:40:58 -0700
commit0f45a1b20cd8f9cfc985a1f91a1e7a86e5e14dd6 (patch)
treec3ab5331914a34625abf757520b6c8a61fad6662 /fs/xfs/libxfs
parentxfs: refactor xfs_inode_verify_forks (diff)
downloadlinux-0f45a1b20cd8f9cfc985a1f91a1e7a86e5e14dd6.tar.gz
linux-0f45a1b20cd8f9cfc985a1f91a1e7a86e5e14dd6.tar.bz2
linux-0f45a1b20cd8f9cfc985a1f91a1e7a86e5e14dd6.zip
xfs: improve local fork verification
Call the data/attr local fork verifiers as soon as we are ready for them. This keeps them close to the code setting up the forks, and avoids a few branches later on. Also open code xfs_inode_verify_forks in the only remaining caller. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 2d424ab9d734..6c24c27f5f44 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -227,6 +227,7 @@ xfs_iformat_data_fork(
struct xfs_dinode *dip)
{
struct inode *inode = VFS_I(ip);
+ int error;
switch (inode->i_mode & S_IFMT) {
case S_IFIFO:
@@ -241,8 +242,11 @@ xfs_iformat_data_fork(
case S_IFDIR:
switch (dip->di_format) {
case XFS_DINODE_FMT_LOCAL:
- return xfs_iformat_local(ip, dip, XFS_DATA_FORK,
+ error = xfs_iformat_local(ip, dip, XFS_DATA_FORK,
be64_to_cpu(dip->di_size));
+ if (!error)
+ error = xfs_ifork_verify_local_data(ip);
+ return error;
case XFS_DINODE_FMT_EXTENTS:
return xfs_iformat_extents(ip, dip, XFS_DATA_FORK);
case XFS_DINODE_FMT_BTREE:
@@ -282,6 +286,8 @@ xfs_iformat_attr_fork(
case XFS_DINODE_FMT_LOCAL:
error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK,
xfs_dfork_attr_shortform_size(dip));
+ if (!error)
+ error = xfs_ifork_verify_local_attr(ip);
break;
case XFS_DINODE_FMT_EXTENTS:
error = xfs_iformat_extents(ip, dip, XFS_ATTR_FORK);