linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] xfs: remap block layer ENODATA read errors to EIO
@ 2025-08-18 20:22 Eric Sandeen
  2025-08-18 20:45 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Eric Sandeen @ 2025-08-18 20:22 UTC (permalink / raw)
  To: linux-xfs@vger.kernel.org; +Cc: Donald Douwsma

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?

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 */
+		if (error == -ENODATA)
+			error = -EIO;
 		return error;
 	}
 


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-08-25  7:51 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).