summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 10:46:24 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:40:39 -0700
commitfba39b3b5ff60abec8fa61eec0930a892ff51a04 (patch)
tree627b56a3a14f0d1960cbd00d76bd1a9177248d92 /fs
parentb1a041c0f179cc73a7e48768d61f657d94180afe (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 <djwong@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_iops.c5
-rw-r--r--fs/xfs/xfs_symlink.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index a607d6aca5c4..9262ac051bb3 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -22,6 +22,7 @@
#include "xfs_iomap.h"
#include "xfs_error.h"
#include "xfs_ioctl.h"
+#include "xfs_health.h"
#include <linux/posix_acl.h>
#include <linux/security.h>
@@ -527,8 +528,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 adaa92d8d1ef..8abb07333eea 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -22,6 +22,7 @@
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_ialloc.h"
+#include "xfs_health.h"
/* ----- Kernel only functions below ----- */
int
@@ -66,6 +67,7 @@ xfs_readlink_bmap_ilocked(
if (xfs_has_crc(mp)) {
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)",
@@ -121,6 +123,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;
}
@@ -506,6 +509,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;
}