From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>,
"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
Donald Douwsma <ddouwsma@redhat.com>
Subject: Re: [PATCH RFC] xfs: remap block layer ENODATA read errors to EIO
Date: Mon, 18 Aug 2025 16:04:35 -0700 [thread overview]
Message-ID: <20250818230435.GH7981@frogsfrogsfrogs> (raw)
In-Reply-To: <8fd28450-d577-4921-96d9-69af0c9b1aa4@sandeen.net>
On Mon, Aug 18, 2025 at 04:11:41PM -0500, Eric Sandeen wrote:
> On 8/18/25 3:45 PM, Darrick J. Wong wrote:
> > On Mon, Aug 18, 2025 at 03:22:02PM -0500, Eric Sandeen wrote:
> >> We had a report that a failing scsi disk was oopsing XFS when an xattr
> >> read encountered a media error. This is because the media error returned
> >> -ENODATA, which we map in xattr code to -ENOATTR and treat specially.
> >>
> >> In this particular case, it looked like:
> >>
> >> xfs_attr_leaf_get()
> >> error = xfs_attr_leaf_hasname(args, &bp);
> >> // here bp is NULL, error == -ENODATA from disk failure
> >> // but we define ENOATTR as ENODATA, so ...
> >> if (error == -ENOATTR) {
> >> // whoops, surprise! bp is NULL, OOPS here
> >> xfs_trans_brelse(args->trans, bp);
> >> return error;
> >> } ...
> >>
> >> To avoid whack-a-mole "test for null bp" or "which -ENODATA do we really
> >> mean in this function?" throughout the xattr code, my first thought is
> >> that we should simply map -ENODATA in lower level read functions back to
> >> -EIO, which is unambiguous, even if we lose the nuance of the underlying
> >> error code. (The block device probably already squawked.) Thoughts?
> >
> > Uhhhh where does this ENODATA come from? Is it the block layer?
> >
> > $ git grep -w ENODATA block/
> > block/blk-core.c:146: [BLK_STS_MEDIUM] = { -ENODATA, "critical medium" },
>
> That, probably, though I don't speak block layer very well. As mentioned, it was a
> SCSI disk error, and it appeared in XFS as -ENODATA:
>
> sd 0:0:23:0: [sdad] tag#937 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=2s
> sd 0:0:23:0: [sdad] tag#937 Sense Key : Medium Error [current]
> sd 0:0:23:0: [sdad] tag#937 Add. Sense: Read retries exhausted
> sd 0:0:23:0: [sdad] tag#937 CDB: Read(16) 88 00 00 00 00 00 9b df 5e 78 00 00 00 08 00 00
> critical medium error, dev sdad, sector 2615107192 op 0x0:(READ) flags 0x1000 phys_seg 1 prio class 2
Ah, yup, critical error, we ran out of retries.
> XFS (sdad1): metadata I/O error in "xfs_da_read_buf+0xe1/0x140 [xfs]" at daddr 0x9bdf5678 len 8 error 61
> (see error 61, ENODATA)
>
> > --D
> >
> >> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> >> ---
> >>
> >> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> >> index f9ef3b2a332a..6ba57ccaa25f 100644
> >> --- a/fs/xfs/xfs_buf.c
> >> +++ b/fs/xfs/xfs_buf.c
> >> @@ -747,6 +747,9 @@ xfs_buf_read_map(
> >> /* bad CRC means corrupted metadata */
> >> if (error == -EFSBADCRC)
> >> error = -EFSCORRUPTED;
> >> + /* ENODATA == ENOATTR which confuses xattr layers */
Can this comment mention that ENODATA comes from the block layer?
/*
* ENODATA means critical medium error, don't let it
* get mixed up with the xattr usage
*/
With that changed,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> >> + if (error == -ENODATA)
> >> + error = -EIO;
> >> return error;
> >> }
> >>
> >>
> >>
> >
>
next prev parent reply other threads:[~2025-08-18 23:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 20:22 [PATCH RFC] xfs: remap block layer ENODATA read errors to EIO Eric Sandeen
2025-08-18 20:45 ` Darrick J. Wong
2025-08-18 21:11 ` Eric Sandeen
2025-08-18 23:04 ` Darrick J. Wong [this message]
2025-08-21 9:16 ` Donald Douwsma
2025-08-21 9:29 ` [PATCH] xfs: test case for handling io errors when reading extended attributes Donald Douwsma
2025-08-21 12:52 ` [PATCH RFC] xfs: remap block layer ENODATA read errors to EIO Carlos Maiolino
2025-08-21 20:06 ` Eric Sandeen
2025-08-22 7:38 ` Donald Douwsma
2025-08-18 22:09 ` Dave Chinner
2025-08-19 2:27 ` Eric Sandeen
2025-08-19 8:08 ` Christoph Hellwig
2025-08-19 14:34 ` Darrick J. Wong
2025-08-19 14:48 ` Christoph Hellwig
2025-08-19 15:14 ` Eric Sandeen
2025-08-19 15:23 ` Christoph Hellwig
2025-08-19 15:38 ` Eric Sandeen
2025-08-19 15:41 ` Christoph Hellwig
2025-08-19 21:45 ` Dave Chinner
2025-08-20 0:16 ` Eric Sandeen
2025-08-25 7:51 ` Christoph Hellwig
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=20250818230435.GH7981@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=ddouwsma@redhat.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=sandeen@sandeen.net \
/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