From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: Christoph Hellwig <hch@lst.de>, linux-xfs@vger.kernel.org, hch@lst.de
Subject: [PATCH 07/11] xfs: report symlink block corruption errors to the health system
Date: Mon, 29 Jan 2024 21:11:03 -0800 [thread overview]
Message-ID: <170659063843.3353909.2865979227550203105.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <170659063695.3353909.12657412146136100266.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_symlink.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index fd5397085f379..c8b1d7cd6ba17 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -58,6 +58,8 @@ xfs_readlink_bmap_ilocked(
error = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0,
&bp, &xfs_symlink_buf_ops);
+ if (xfs_metadata_is_sick(error))
+ xfs_inode_mark_sick(ip, XFS_SICK_INO_SYMLINK);
if (error)
return error;
byte_cnt = XFS_SYMLINK_BUF_SPACE(mp, byte_cnt);
@@ -68,6 +70,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)",
@@ -103,7 +106,7 @@ xfs_readlink(
{
struct xfs_mount *mp = ip->i_mount;
xfs_fsize_t pathlen;
- int error = -EFSCORRUPTED;
+ int error;
trace_xfs_readlink(ip);
@@ -116,14 +119,14 @@ xfs_readlink(
pathlen = ip->i_disk_size;
if (!pathlen)
- goto out;
+ goto out_corrupt;
if (pathlen < 0 || pathlen > XFS_SYMLINK_MAXLEN) {
xfs_alert(mp, "%s: inode (%llu) bad symlink length (%lld)",
__func__, (unsigned long long) ip->i_ino,
(long long) pathlen);
ASSERT(0);
- goto out;
+ goto out_corrupt;
}
if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) {
@@ -132,7 +135,7 @@ xfs_readlink(
* if if_data is junk.
*/
if (XFS_IS_CORRUPT(ip->i_mount, !ip->i_df.if_data))
- goto out;
+ goto out_corrupt;
memcpy(link, ip->i_df.if_data, pathlen + 1);
error = 0;
@@ -140,9 +143,12 @@ xfs_readlink(
error = xfs_readlink_bmap_ilocked(ip, link);
}
- out:
xfs_iunlock(ip, XFS_ILOCK_SHARED);
return error;
+ out_corrupt:
+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
+ xfs_inode_mark_sick(ip, XFS_SICK_INO_SYMLINK);
+ return -EFSCORRUPTED;
}
int
@@ -497,6 +503,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;
}
next prev parent reply other threads:[~2024-01-30 5:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 5:03 [PATCHSET v29.2 5/7] xfs: report corruption to the health trackers Darrick J. Wong
2024-01-30 5:09 ` [PATCH 01/11] xfs: separate the marking of sick and checked metadata Darrick J. Wong
2024-01-30 5:09 ` [PATCH 02/11] xfs: report fs corruption errors to the health tracking system Darrick J. Wong
2024-01-30 5:10 ` [PATCH 03/11] xfs: report ag header " Darrick J. Wong
2024-01-30 5:10 ` [PATCH 04/11] xfs: report block map " Darrick J. Wong
2024-01-30 5:10 ` [PATCH 05/11] xfs: report btree block corruption errors to the health system Darrick J. Wong
2024-01-30 5:10 ` [PATCH 06/11] xfs: report dir/attr " Darrick J. Wong
2024-01-30 5:11 ` Darrick J. Wong [this message]
2024-01-30 5:11 ` [PATCH 08/11] xfs: report inode " Darrick J. Wong
2024-01-30 5:11 ` [PATCH 09/11] xfs: report quota block " Darrick J. Wong
2024-01-30 5:11 ` [PATCH 10/11] xfs: report realtime metadata " Darrick J. Wong
2024-01-30 5:12 ` [PATCH 11/11] xfs: report XFS_IS_CORRUPT " Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2023-12-31 19:26 [PATCHSET v29.0 05/28] xfs: report corruption to the health trackers Darrick J. Wong
2023-12-31 20:11 ` [PATCH 07/11] xfs: report symlink block corruption errors to the health system Darrick J. Wong
2024-01-05 5:44 ` Christoph Hellwig
2023-05-26 0:31 [PATCHSET v25.0 00/11] xfs: report corruption to the health trackers Darrick J. Wong
2023-05-26 1:01 ` [PATCH 07/11] xfs: report symlink block corruption errors to the health system Darrick J. Wong
2022-12-30 22:13 [PATCHSET v24.0 00/11] xfs: report corruption to the health trackers Darrick J. Wong
2022-12-30 22:13 ` [PATCH 07/11] xfs: report symlink block corruption errors to the health system Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=170659063843.3353909.2865979227550203105.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox