xfs: abort mount if xfs_fs_reserve_ag_blocks fails
PATCH 1/1 xfs: abort mount if xfs_fs_reserve_ag_blocks fails
xfs_mountfs currently ignores all errors from xfs_fs_reserve_ag_blocks, which can lead to the mount path continuing on corruption errors. Fix the check to only ignore -ENOSPC as in other callers, and unwind for all other errors.
--- fs/xfs/xfs_mount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_mount.c +5 -2
@@ -1149,9 +1149,12 @@ xfs_mountfs(* blocks. */ error =xfs_fs_reserve_ag_blocks (mp); -if (error && error == -ENOSPC ) +if (error) { +if (error != -ENOSPC ) + goto out_rtunmount;xfs_warn (mp, -"ENOSPC reserving per-AG metadata pool, log recovery may fail." ); +"ENOSPC reserving per-AG metadata pool, log recovery may fail." ); + } error =xfs_log_mount_finish (mp);xfs_fs_unreserve_ag_blocks (mp);if (error) {
Signature · 1 line
2.53.0
Quoted 5 lines · Christoph Hellwig
xfs_mountfscurrently ignores all errors fromxfs_fs_reserve_ag_blocks, which can lead to the mount path continuing on corruption errors. Fix the check to only ignore-ENOSPCas in other callers, and unwind for all other errors.
Quoted 2 lines
Fixes 81ed94751b15 ("xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes")Signed-off-by Christoph Hellwig <[email protected]>
Yeah, we shouldn't be continuing the mount when weird errors happen.
--D
Quoted 27 lines
--- fs/xfs/xfs_mount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)fs/xfs/xfs_mount.c +5
-2@@ -1149,9 +1149,12 @@ xfs_mountfs(* blocks. */ error =xfs_fs_reserve_ag_blocks (mp); -if (error && error == -ENOSPC ) +if (error) { +if (error != -ENOSPC ) + goto out_rtunmount;xfs_warn (mp, -"ENOSPC reserving per-AG metadata pool, log recovery may fail." ); +"ENOSPC reserving per-AG metadata pool, log recovery may fail." ); + } error =xfs_log_mount_finish (mp);xfs_fs_unreserve_ag_blocks (mp);if (error) {Signature · 1 line
2.53.0
Quoted 7 lines · Christoph Hellwig
xfs_mountfscurrently ignores all errors fromxfs_fs_reserve_ag_blocks, which can lead to the mount path continuing on corruption errors. Fix the check to only ignore-ENOSPCas in other callers, and unwind for all other errors.Fixes 81ed94751b15 ("xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes")Signed-off-by Christoph Hellwig <[email protected]>
Quoted 27 lines
--- fs/xfs/xfs_mount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)fs/xfs/xfs_mount.c +5
-2@@ -1149,9 +1149,12 @@ xfs_mountfs(* blocks. */ error =xfs_fs_reserve_ag_blocks (mp); -if (error && error == -ENOSPC ) +if (error) { +if (error != -ENOSPC ) + goto out_rtunmount;xfs_warn (mp, -"ENOSPC reserving per-AG metadata pool, log recovery may fail." ); +"ENOSPC reserving per-AG metadata pool, log recovery may fail." ); + } error =xfs_log_mount_finish (mp);xfs_fs_unreserve_ag_blocks (mp);if (error) {Signature · 1 line
2.53.0
Quoted 4 lines · Christoph Hellwig
xfs_mountfscurrently ignores all errors fromxfs_fs_reserve_ag_blocks, which can lead to the mount path continuing on corruption errors. Fix the check to only ignore-ENOSPCas in other callers, and unwind for all other errors.
Applied to for-next, thanks!
[1/1] xfs: abort mount if xfs_fs_reserve_ag_blocks fails
commit: 8070a50b88971f9fada55a3ae3330f529bef9adc
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>