xfs: Use WARN_ON_ONCE for bailout mount-operation
authorAustin Kim <austindh.kim@gmail.com>
Fri, 6 Sep 2019 01:08:50 +0000 (18:08 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 6 Sep 2019 04:36:12 +0000 (21:36 -0700)
If the CONFIG_BUG is enabled, BUG is executed and then system is crashed.
However, the bailout for mount is no longer proceeding.

Using WARN_ON_ONCE rather than BUG can prevent this situation.

Signed-off-by: Austin Kim <austindh.kim@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_mount.c

index da50b12ef634a412beeb3b925b0881a312129d12..ba5b6f3b2b88a13cf79b33cab58270db8075585d 100644 (file)
@@ -214,7 +214,7 @@ xfs_initialize_perag(
 
                spin_lock(&mp->m_perag_lock);
                if (radix_tree_insert(&mp->m_perag_tree, index, pag)) {
-                       BUG();
+                       WARN_ON_ONCE(1);
                        spin_unlock(&mp->m_perag_lock);
                        radix_tree_preload_end();
                        error = -EEXIST;