Skip to contentSkip to conversation

xfs: abort mount if xfs_fs_reserve_ag_blocks fails

PATCH Applied Christoph Hellwig 3 participants 4 messages May 27 – May 30 XFS filesystem

lore
Share & tools
lore
#0 lore raw

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.

Fixes 81ed94751b15 ("xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes")
---
 fs/xfs/xfs_mount.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_mount.c +5 -2
index b24195f570cd..7aa51826b1ca 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Christoph Hellwig

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.

Cc <[email protected]> # v5.14
Quoted 2 lines
Fixes 81ed94751b15 ("xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes")

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
index b24195f570cd..7aa51826b1ca 100644
@@ -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
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig

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.

Fixes 81ed94751b15 ("xfs: fix log intent recovery ENOSPC shutdowns when inactivating inodes")
Quoted 27 lines
---
 fs/xfs/xfs_mount.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_mount.c +5 -2
index b24195f570cd..7aa51826b1ca 100644
@@ -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
maintainer Applied
#3 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

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.

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]>