diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2020-02-19 17:01:53 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-03-03 18:47:39 -0800 |
commit | 8dd114bdb9b2ffe0355bd161bf9f883e9eb4ad88 (patch) | |
tree | d7b9460efe832e03b11c71359b30162f0c6ff351 | |
parent | 1a084ae2d6d2af99cebd5164e4ffd62adc3e3d6c (diff) |
xfs: report symlink block corruption errors to the health system
Whenever we encounter corrupt symbolic link blocks, we should report
that to the health monitoring system for later reporting.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r-- | fs/xfs/xfs_iops.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_symlink.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 81f2f93caec0..0784763a85fd 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -21,6 +21,7 @@ #include "xfs_dir2.h" #include "xfs_iomap.h" #include "xfs_error.h" +#include "xfs_health.h" #include <linux/xattr.h> #include <linux/posix_acl.h> @@ -483,8 +484,10 @@ xfs_vn_get_link_inline( * if_data is junk. */ link = ip->i_df.if_u1.if_data; - if (XFS_IS_CORRUPT(ip->i_mount, !link)) + if (XFS_IS_CORRUPT(ip->i_mount, !link)) { + xfs_inode_mark_sick(ip, XFS_SICK_INO_SYMLINK); return ERR_PTR(-EFSCORRUPTED); + } return link; } diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c index d79637ce5557..03f01281f83d 100644 --- a/fs/xfs/xfs_symlink.c +++ b/fs/xfs/xfs_symlink.c @@ -21,6 +21,7 @@ #include "xfs_trans_space.h" #include "xfs_trace.h" #include "xfs_trans.h" +#include "xfs_health.h" /* ----- Kernel only functions below ----- */ int @@ -65,6 +66,7 @@ xfs_readlink_bmap_ilocked( if (xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_symlink_hdr_ok(ip->i_ino, offset, byte_cnt, bp)) { + xfs_inode_mark_sick(ip, XFS_SICK_INO_SYMLINK); error = -EFSCORRUPTED; xfs_alert(mp, "symlink header does not match required off/len/owner (0x%x/Ox%x,0x%llx)", @@ -120,6 +122,7 @@ xfs_readlink( __func__, (unsigned long long) ip->i_ino, (long long) pathlen); ASSERT(0); + xfs_inode_mark_sick(ip, XFS_SICK_INO_SYMLINK); error = -EFSCORRUPTED; goto out; } @@ -509,6 +512,7 @@ xfs_inactive_symlink( __func__, (unsigned long long)ip->i_ino, pathlen); xfs_iunlock(ip, XFS_ILOCK_EXCL); ASSERT(0); + xfs_inode_mark_sick(ip, XFS_SICK_INO_SYMLINK); return -EFSCORRUPTED; } |