Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] xfs: add a data I/O shutdown reason
@ 2026-06-12  9:17 Yao Sang
  2026-06-15 13:36 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Sang @ 2026-06-12  9:17 UTC (permalink / raw)
  To: linux-xfs; +Cc: cem, hch, Yao Sang

The zoned writeback shutdown path added for failed zoned data writes uses
SHUTDOWN_META_IO_ERROR because there is no shutdown reason for data I/O
errors.

That makes the shutdown look like a metadata failure even though the
failed I/O was user data writeback. Add a data I/O shutdown reason and
use it for unrecoverable zoned writeback errors.

Wire the new reason into the shutdown trace output and the health
monitoring event mask so userspace can distinguish data writeback
shutdowns from metadata and log I/O failures.

Signed-off-by: Yao Sang <sangyao@kylinos.cn>
---
This is a follow-up to the accepted zoned writeback shutdown fix:

xfs: shut down zoned file systems on writeback errors
https://lore.kernel.org/all/20260611015305.1583003-1-sangyao@kylinos.cn/

It also addresses Christoph's follow-up suggestion to use a dedicated
shutdown reason for unrecoverable data writeback errors instead of
reporting this path as a metadata I/O error.

 fs/xfs/libxfs/xfs_fs.h | 1 +
 fs/xfs/xfs_aops.c      | 2 +-
 fs/xfs/xfs_fsops.c     | 3 +++
 fs/xfs/xfs_healthmon.c | 1 +
 fs/xfs/xfs_mount.h     | 4 +++-
 5 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index 185f09f327c0..4223a51a8c3d 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -1089,6 +1089,7 @@ struct xfs_health_monitor_inode {
 #define XFS_HEALTH_SHUTDOWN_CORRUPT_INCORE	(1u << 3)
 #define XFS_HEALTH_SHUTDOWN_CORRUPT_ONDISK	(1u << 4)
 #define XFS_HEALTH_SHUTDOWN_DEVICE_REMOVED	(1u << 5)
+#define XFS_HEALTH_SHUTDOWN_DATA_IO_ERROR	(1u << 6)
 
 /* shutdown */
 struct xfs_health_monitor_shutdown {
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 2a0c54256e93..19412fa95953 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -147,7 +147,7 @@ xfs_end_ioend_write(
 		 * available.
 		 */
 		if (is_zoned) {
-			xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
+			xfs_force_shutdown(mp, SHUTDOWN_DATA_IO_ERROR);
 			goto done;
 		}
 		if (ioend->io_flags & IOMAP_IOEND_SHARED) {
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 8d64d904d73c..0decf3a02bed 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -516,6 +516,9 @@ xfs_do_force_shutdown(
 	} else if (flags & SHUTDOWN_DEVICE_REMOVED) {
 		tag = XFS_PTAG_SHUTDOWN_IOERROR;
 		why = "Block device removal";
+	} else if (flags & SHUTDOWN_DATA_IO_ERROR) {
+		tag = XFS_PTAG_SHUTDOWN_IOERROR;
+		why = "Unrecoverable Data I/O Error";
 	} else {
 		tag = XFS_PTAG_SHUTDOWN_IOERROR;
 		why = "Metadata I/O Error";
diff --git a/fs/xfs/xfs_healthmon.c b/fs/xfs/xfs_healthmon.c
index 4521ffdab9f1..1e9bae340c1e 100644
--- a/fs/xfs/xfs_healthmon.c
+++ b/fs/xfs/xfs_healthmon.c
@@ -684,6 +684,7 @@ static const struct flags_map shutdown_map[] = {
 	{ SHUTDOWN_CORRUPT_INCORE,	XFS_HEALTH_SHUTDOWN_CORRUPT_INCORE },
 	{ SHUTDOWN_CORRUPT_ONDISK,	XFS_HEALTH_SHUTDOWN_CORRUPT_ONDISK },
 	{ SHUTDOWN_DEVICE_REMOVED,	XFS_HEALTH_SHUTDOWN_DEVICE_REMOVED },
+	{ SHUTDOWN_DATA_IO_ERROR,	XFS_HEALTH_SHUTDOWN_DATA_IO_ERROR },
 };
 
 static inline unsigned int
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 66a02d1b9ad7..5fd45426356f 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -666,13 +666,15 @@ void xfs_do_force_shutdown(struct xfs_mount *mp, uint32_t flags, char *fname,
 #define SHUTDOWN_CORRUPT_INCORE	(1u << 3) /* corrupt in-memory structures */
 #define SHUTDOWN_CORRUPT_ONDISK	(1u << 4)  /* corrupt metadata on device */
 #define SHUTDOWN_DEVICE_REMOVED	(1u << 5) /* device removed underneath us */
+#define SHUTDOWN_DATA_IO_ERROR	(1u << 6) /* unrecoverable data write failed */
 
 #define XFS_SHUTDOWN_STRINGS \
 	{ SHUTDOWN_META_IO_ERROR,	"metadata_io" }, \
 	{ SHUTDOWN_LOG_IO_ERROR,	"log_io" }, \
 	{ SHUTDOWN_FORCE_UMOUNT,	"force_umount" }, \
 	{ SHUTDOWN_CORRUPT_INCORE,	"corruption" }, \
-	{ SHUTDOWN_DEVICE_REMOVED,	"device_removed" }
+	{ SHUTDOWN_DEVICE_REMOVED,	"device_removed" }, \
+	{ SHUTDOWN_DATA_IO_ERROR,	"data_io" }
 
 /*
  * Flags for xfs_mountfs
-- 
2.25.1


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

* Re: [PATCH] xfs: add a data I/O shutdown reason
  2026-06-12  9:17 [PATCH] xfs: add a data I/O shutdown reason Yao Sang
@ 2026-06-15 13:36 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-06-15 13:36 UTC (permalink / raw)
  To: Yao Sang; +Cc: linux-xfs, cem, hch

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Let me throw this into xfstests to see if the new reason confuses
anyone first, though.


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

end of thread, other threads:[~2026-06-15 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12  9:17 [PATCH] xfs: add a data I/O shutdown reason Yao Sang
2026-06-15 13:36 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox