From e3f5e317e0ed4da44a10fe202ec80abed1c8cc87 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Wed, 4 Jun 2025 15:15:27 +1000 Subject: [PATCH] zfs_sync: return error when pool suspends If the pool is suspended, we'll just block in zil_commit(). If the system is shutting down, blocking wouldn't help anyone. So, we should keep this test for now, but at least return an error for anyone who is actually interested. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Paul Dagnelie Reviewed-by: Brian Behlendorf Reviewed-by: Alexander Motin Signed-off-by: Rob Norris Closes #17420 --- module/os/linux/zfs/zfs_vfsops.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/os/linux/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c index 5aeaffac9..a3837f784 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -279,12 +279,13 @@ zfs_sync(struct super_block *sb, int wait, cred_t *cr) return (err); /* - * If the system is shutting down, then skip any - * filesystems which may exist on a suspended pool. + * If the pool is suspended, just return an error. This is to help + * with shutting down with pools suspended, as we don't want to block + * in that case. */ if (spa_suspended(zfsvfs->z_os->os_spa)) { zfs_exit(zfsvfs, FTAG); - return (0); + return (SET_ERROR(EIO)); } zil_commit(zfsvfs->z_log, 0);