Skip to contentSkip to conversation

xfs: Use WARN_ON_ONCE rather than BUG for bailout mount-operation

PATCH In review Austin Kim 2 participants 3 messages Aug 30, 2019 XFS filesystem

lore
Share & tools
lore

Austin Kim

author
#0 lore raw

PATCH 1/1 xfs: Use WARN_ON_ONCE rather than BUG for bailout mount-operation

If the CONFIG_BUG is enabled, BUG is executed and then system is crashed. However, the bailout for mount is no longer proceeding.

For this reason, using WARN_ON_ONCE rather than BUG can prevent this situation.

---
 fs/xfs/xfs_mount.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/xfs/xfs_mount.c +1 -2
index 322da69..c0d0b72 100644
@@ -213,8 +213,7 @@ xfs_initialize_perag(
 			goto out_hash_destroy;
 
 		spin_lock(&mp->m_perag_lock);
-		if (radix_tree_insert(&mp->m_perag_tree, index, pag)) {
-			BUG();
+		if (WARN_ON_ONCE(radix_tree_insert(&mp->m_perag_tree, index, pag))) {
 			spin_unlock(&mp->m_perag_lock);
 			radix_tree_preload_end();
 			error = -EEXIST;
Signature · 1 line
2.6.2
#1 lore raw
Quoted 15 lines · Austin Kim

If the CONFIG_BUG is enabled, BUG is executed and then system is crashed. However, the bailout for mount is no longer proceeding.

For this reason, using WARN_ON_ONCE rather than BUG can prevent this situation.

---
 fs/xfs/xfs_mount.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/xfs/xfs_mount.c +0 -0
index 322da69..c0d0b72 100644

fs/xfs/xfs_mount.c xfs_initialize_perag( · line 216

Quoted 6 lines
fs/xfs/xfs_mount.c +1 -2
@@ -213,8 +213,7 @@ xfs_initialize_perag(
 			goto out_hash_destroy;
 
 		spin_lock(&mp->m_perag_lock);
-		if (radix_tree_insert(&mp->m_perag_tree, index, pag)) {
-			BUG();
+		if (WARN_ON_ONCE(radix_tree_insert(&mp->m_perag_tree, index, pag))) {

Er... please wrap the line at 80 columns.

--D

Quoted 6 lines
fs/xfs/xfs_mount.c +0 -0
 			spin_unlock(&mp->m_perag_lock);
 			radix_tree_preload_end();
 			error = -EEXIST;
Signature · 1 line
2.6.2
author
#2 lore raw

2019년 8월 30일 (금) 오전 9:33, Darrick J. Wong <[email protected]>님이 작성:

Quoted 19 lines · Austin Kim
Quoted 17 lines

If the CONFIG_BUG is enabled, BUG is executed and then system is crashed. However, the bailout for mount is no longer proceeding.

For this reason, using WARN_ON_ONCE rather than BUG can prevent this situation.

---
 fs/xfs/xfs_mount.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/xfs/xfs_mount.c +0 -0
index 322da69..c0d0b72 100644
@@ -213,8 +213,7 @@ xfs_initialize_perag(
                      goto out_hash_destroy;
 
Quoted 6 lines

fs/xfs/xfs_mount.c xfs_initialize_perag( · line 216

Quoted 4 lines
fs/xfs/xfs_mount.c +1 -2
              spin_lock(&mp->m_perag_lock);
-             if (radix_tree_insert(&mp->m_perag_tree, index, pag)) {
-                     BUG();
+             if (WARN_ON_ONCE(radix_tree_insert(&mp->m_perag_tree, index, pag))) {

Er... please wrap the line at 80 columns.

Oh..
Let me resend patch soon after wrapping 80 column lines.

Quoted 9 lines

--D

Quoted 6 lines
fs/xfs/xfs_mount.c +0 -1
                      spin_unlock(&mp->m_perag_lock);
                      radix_tree_preload_end();
                      error = -EEXIST;
--

2.6.2