Skip to content

Commit 3b0af7f

Browse files
robnbehlendorf
authored andcommitted
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #17420
1 parent af93006 commit 3b0af7f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

module/os/linux/zfs/zfs_vfsops.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,13 @@ zfs_sync(struct super_block *sb, int wait, cred_t *cr)
279279
return (err);
280280

281281
/*
282-
* If the system is shutting down, then skip any
283-
* filesystems which may exist on a suspended pool.
282+
* If the pool is suspended, just return an error. This is to help
283+
* with shutting down with pools suspended, as we don't want to block
284+
* in that case.
284285
*/
285286
if (spa_suspended(zfsvfs->z_os->os_spa)) {
286287
zfs_exit(zfsvfs, FTAG);
287-
return (0);
288+
return (SET_ERROR(EIO));
288289
}
289290

290291
zil_commit(zfsvfs->z_log, 0);

0 commit comments

Comments
 (0)