Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] xfs fix and clean up
@ 2023-04-21 11:37 Guo Xuenan
  2023-04-21 11:37 ` [PATCH v2 1/2] xfs: fix xfs print level wrong parsing Guo Xuenan
  2023-04-21 11:37 ` [PATCH v2 2/2] xfs: clean up some unnecessary xfs_stack_trace Guo Xuenan
  0 siblings, 2 replies; 6+ messages in thread
From: Guo Xuenan @ 2023-04-21 11:37 UTC (permalink / raw)
  To: djwong, dchinner, linux-xfs
  Cc: sandeen, guoxuenan, guoxuenan, houtao1, fangwei1, jack.qiu,
	yi.zhang

Hi Dave & Darrick,

Recent xfs work, I found xfs debug print code doesn't work properly.
The two patches for fix print level parsing and try to make it works.

v1: fix parsing failed of `kstrtoint` by skip KERN_SOH 
v2: with Dave's suggestion, directly set loglevel in their definition

Thanks.

Guo Xuenan (2):
  xfs: fix xfs print level wrong parsing
  xfs: clean up some unnecessary xfs_stack_trace

 fs/xfs/libxfs/xfs_ialloc.c |  1 -
 fs/xfs/xfs_error.c         |  9 ---------
 fs/xfs/xfs_fsops.c         |  2 --
 fs/xfs/xfs_log.c           |  2 --
 fs/xfs/xfs_message.c       |  5 ++---
 fs/xfs/xfs_message.h       | 28 ++++++++++++++--------------
 6 files changed, 16 insertions(+), 31 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] xfs: fix xfs print level wrong parsing
  2023-04-21 11:37 [PATCH v2 0/2] xfs fix and clean up Guo Xuenan
@ 2023-04-21 11:37 ` Guo Xuenan
  2023-04-22  3:55   ` Darrick J. Wong
  2023-04-21 11:37 ` [PATCH v2 2/2] xfs: clean up some unnecessary xfs_stack_trace Guo Xuenan
  1 sibling, 1 reply; 6+ messages in thread
From: Guo Xuenan @ 2023-04-21 11:37 UTC (permalink / raw)
  To: djwong, dchinner, linux-xfs
  Cc: sandeen, guoxuenan, guoxuenan, houtao1, fangwei1, jack.qiu,
	yi.zhang

Recently, during my xfs bugfix work, notice a bug that makes
xfs_stack_trace never take effect. This has been around here at xfs
debug framework for a long time.

The root cause is misuse of `kstrtoint` which always return -EINVAL,
because KERN_<LEVEL> with KERN_SOH prefix will always parse failed.
Directly set loglevel in xfs print definition to make it work properly.

Fixes: 847f9f6875fb ("xfs: more info from kmem deadlocks and high-level error msgs")
Signed-off-by: Guo Xuenan <guoxuenan@huawei.com>
---
 fs/xfs/xfs_message.c |  5 ++---
 fs/xfs/xfs_message.h | 28 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
index 8f495cc23903..1cfa21d62514 100644
--- a/fs/xfs/xfs_message.c
+++ b/fs/xfs/xfs_message.c
@@ -30,12 +30,12 @@ __xfs_printk(
 void
 xfs_printk_level(
 	const char *kern_level,
+	const int log_level,
 	const struct xfs_mount *mp,
 	const char *fmt, ...)
 {
 	struct va_format	vaf;
 	va_list			args;
-	int			level;
 
 	va_start(args, fmt);
 	vaf.fmt = fmt;
@@ -45,8 +45,7 @@ xfs_printk_level(
 
 	va_end(args);
 
-	if (!kstrtoint(kern_level, 0, &level) &&
-	    level <= LOGLEVEL_ERR &&
+	if (log_level <= LOGLEVEL_ERR &&
 	    xfs_error_level >= XFS_ERRLEVEL_HIGH)
 		xfs_stack_trace();
 }
diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
index cc323775a12c..666a549eb989 100644
--- a/fs/xfs/xfs_message.h
+++ b/fs/xfs/xfs_message.h
@@ -6,32 +6,32 @@
 
 struct xfs_mount;
 
-extern __printf(3, 4)
-void xfs_printk_level(const char *kern_level, const struct xfs_mount *mp,
-			const char *fmt, ...);
+extern __printf(4, 5)
+void xfs_printk_level(const char *kern_level, const int log_level,
+		const struct xfs_mount *mp, const char *fmt, ...);
 
-#define xfs_printk_index_wrap(kern_level, mp, fmt, ...)		\
+#define xfs_printk_index_wrap(level, mp, fmt, ...)		\
 ({								\
-	printk_index_subsys_emit("%sXFS%s: ", kern_level, fmt);	\
-	xfs_printk_level(kern_level, mp, fmt, ##__VA_ARGS__);	\
+	printk_index_subsys_emit("%sXFS%s: ", KERN_##level, fmt);	\
+	xfs_printk_level(KERN_##level, LOGLEVEL_##level, mp, fmt, ##__VA_ARGS__); \
 })
 #define xfs_emerg(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_EMERG, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(EMERG, mp, fmt, ##__VA_ARGS__)
 #define xfs_alert(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_ALERT, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(ALERT, mp, fmt, ##__VA_ARGS__)
 #define xfs_crit(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_CRIT, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(CRIT, mp, fmt, ##__VA_ARGS__)
 #define xfs_err(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_ERR, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(ERR, mp, fmt, ##__VA_ARGS__)
 #define xfs_warn(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_WARNING, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(WARNING, mp, fmt, ##__VA_ARGS__)
 #define xfs_notice(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_NOTICE, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(NOTICE, mp, fmt, ##__VA_ARGS__)
 #define xfs_info(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_INFO, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(INFO, mp, fmt, ##__VA_ARGS__)
 #ifdef DEBUG
 #define xfs_debug(mp, fmt, ...) \
-	xfs_printk_index_wrap(KERN_DEBUG, mp, fmt, ##__VA_ARGS__)
+	xfs_printk_index_wrap(DEBUG, mp, fmt, ##__VA_ARGS__)
 #else
 #define xfs_debug(mp, fmt, ...) do {} while (0)
 #endif
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] xfs: clean up some unnecessary xfs_stack_trace
  2023-04-21 11:37 [PATCH v2 0/2] xfs fix and clean up Guo Xuenan
  2023-04-21 11:37 ` [PATCH v2 1/2] xfs: fix xfs print level wrong parsing Guo Xuenan
@ 2023-04-21 11:37 ` Guo Xuenan
  2023-04-22  3:57   ` Darrick J. Wong
  1 sibling, 1 reply; 6+ messages in thread
From: Guo Xuenan @ 2023-04-21 11:37 UTC (permalink / raw)
  To: djwong, dchinner, linux-xfs
  Cc: sandeen, guoxuenan, guoxuenan, houtao1, fangwei1, jack.qiu,
	yi.zhang

With xfs print level parsing correctly, these duplicate dump
information can be removed.

Signed-off-by: Guo Xuenan <guoxuenan@huawei.com>
---
 fs/xfs/libxfs/xfs_ialloc.c | 1 -
 fs/xfs/xfs_error.c         | 9 ---------
 fs/xfs/xfs_fsops.c         | 2 --
 fs/xfs/xfs_log.c           | 2 --
 4 files changed, 14 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index a16d5de16933..df4e4eb19f14 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2329,7 +2329,6 @@ xfs_imap(
 				__func__, ino,
 				XFS_AGINO_TO_INO(mp, pag->pag_agno, agino));
 		}
-		xfs_stack_trace();
 #endif /* DEBUG */
 		return error;
 	}
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index b2cbbba3e15a..7c8e1f3b69a6 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -421,9 +421,6 @@ xfs_buf_corruption_error(
 		  fa, bp->b_ops->name, xfs_buf_daddr(bp));
 
 	xfs_alert(mp, "Unmount and run xfs_repair");
-
-	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
-		xfs_stack_trace();
 }
 
 /*
@@ -459,9 +456,6 @@ xfs_buf_verifier_error(
 				sz);
 		xfs_hex_dump(buf, sz);
 	}
-
-	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
-		xfs_stack_trace();
 }
 
 /*
@@ -509,7 +503,4 @@ xfs_inode_verifier_error(
 				sz);
 		xfs_hex_dump(buf, sz);
 	}
-
-	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
-		xfs_stack_trace();
 }
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 13851c0d640b..e08b1ce109d9 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -546,8 +546,6 @@ xfs_do_force_shutdown(
 			why, flags, __return_address, fname, lnnum);
 	xfs_alert(mp,
 		"Please unmount the filesystem and rectify the problem(s)");
-	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
-		xfs_stack_trace();
 }
 
 /*
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index fc61cc024023..e4e4da33281d 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3808,8 +3808,6 @@ xlog_force_shutdown(
 				shutdown_flags);
 		xfs_alert(log->l_mp,
 "Please unmount the filesystem and rectify the problem(s).");
-		if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
-			xfs_stack_trace();
 	}
 
 	/*
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] xfs: fix xfs print level wrong parsing
  2023-04-21 11:37 ` [PATCH v2 1/2] xfs: fix xfs print level wrong parsing Guo Xuenan
@ 2023-04-22  3:55   ` Darrick J. Wong
  0 siblings, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2023-04-22  3:55 UTC (permalink / raw)
  To: Guo Xuenan
  Cc: dchinner, linux-xfs, sandeen, guoxuenan, houtao1, fangwei1,
	jack.qiu, yi.zhang

On Fri, Apr 21, 2023 at 07:37:15PM +0800, Guo Xuenan wrote:
> Recently, during my xfs bugfix work, notice a bug that makes
> xfs_stack_trace never take effect. This has been around here at xfs
> debug framework for a long time.
> 
> The root cause is misuse of `kstrtoint` which always return -EINVAL,
> because KERN_<LEVEL> with KERN_SOH prefix will always parse failed.
> Directly set loglevel in xfs print definition to make it work properly.
> 
> Fixes: 847f9f6875fb ("xfs: more info from kmem deadlocks and high-level error msgs")
> Signed-off-by: Guo Xuenan <guoxuenan@huawei.com>
> ---
>  fs/xfs/xfs_message.c |  5 ++---
>  fs/xfs/xfs_message.h | 28 ++++++++++++++--------------
>  2 files changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
> index 8f495cc23903..1cfa21d62514 100644
> --- a/fs/xfs/xfs_message.c
> +++ b/fs/xfs/xfs_message.c
> @@ -30,12 +30,12 @@ __xfs_printk(
>  void
>  xfs_printk_level(
>  	const char *kern_level,
> +	const int log_level,
>  	const struct xfs_mount *mp,
>  	const char *fmt, ...)
>  {
>  	struct va_format	vaf;
>  	va_list			args;
> -	int			level;
>  
>  	va_start(args, fmt);
>  	vaf.fmt = fmt;
> @@ -45,8 +45,7 @@ xfs_printk_level(
>  
>  	va_end(args);
>  
> -	if (!kstrtoint(kern_level, 0, &level) &&
> -	    level <= LOGLEVEL_ERR &&
> +	if (log_level <= LOGLEVEL_ERR &&

Ok, this resolves my occasional squinting at this and wondering "how in
the h*** does this work?" after I set the log level, fail to get any
messages, and then decide to just do it with ftrace so I can concentrate
on finishing the problem I'm working on.

IOWs, thank you for sorting this out finally.

>  	    xfs_error_level >= XFS_ERRLEVEL_HIGH)
>  		xfs_stack_trace();
>  }
> diff --git a/fs/xfs/xfs_message.h b/fs/xfs/xfs_message.h
> index cc323775a12c..666a549eb989 100644
> --- a/fs/xfs/xfs_message.h
> +++ b/fs/xfs/xfs_message.h
> @@ -6,32 +6,32 @@
>  
>  struct xfs_mount;
>  
> -extern __printf(3, 4)
> -void xfs_printk_level(const char *kern_level, const struct xfs_mount *mp,
> -			const char *fmt, ...);
> +extern __printf(4, 5)
> +void xfs_printk_level(const char *kern_level, const int log_level,
> +		const struct xfs_mount *mp, const char *fmt, ...);
>  
> -#define xfs_printk_index_wrap(kern_level, mp, fmt, ...)		\
> +#define xfs_printk_index_wrap(level, mp, fmt, ...)		\
>  ({								\
> -	printk_index_subsys_emit("%sXFS%s: ", kern_level, fmt);	\
> -	xfs_printk_level(kern_level, mp, fmt, ##__VA_ARGS__);	\
> +	printk_index_subsys_emit("%sXFS%s: ", KERN_##level, fmt);	\
> +	xfs_printk_level(KERN_##level, LOGLEVEL_##level, mp, fmt, ##__VA_ARGS__); \

Not in love with the macro mess, but it seems to get the job done.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

>  })
>  #define xfs_emerg(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_EMERG, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(EMERG, mp, fmt, ##__VA_ARGS__)
>  #define xfs_alert(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_ALERT, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(ALERT, mp, fmt, ##__VA_ARGS__)
>  #define xfs_crit(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_CRIT, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(CRIT, mp, fmt, ##__VA_ARGS__)
>  #define xfs_err(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_ERR, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(ERR, mp, fmt, ##__VA_ARGS__)
>  #define xfs_warn(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_WARNING, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(WARNING, mp, fmt, ##__VA_ARGS__)
>  #define xfs_notice(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_NOTICE, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(NOTICE, mp, fmt, ##__VA_ARGS__)
>  #define xfs_info(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_INFO, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(INFO, mp, fmt, ##__VA_ARGS__)
>  #ifdef DEBUG
>  #define xfs_debug(mp, fmt, ...) \
> -	xfs_printk_index_wrap(KERN_DEBUG, mp, fmt, ##__VA_ARGS__)
> +	xfs_printk_index_wrap(DEBUG, mp, fmt, ##__VA_ARGS__)
>  #else
>  #define xfs_debug(mp, fmt, ...) do {} while (0)
>  #endif
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] xfs: clean up some unnecessary xfs_stack_trace
  2023-04-21 11:37 ` [PATCH v2 2/2] xfs: clean up some unnecessary xfs_stack_trace Guo Xuenan
@ 2023-04-22  3:57   ` Darrick J. Wong
  2023-04-23  1:44     ` Guo Xuenan
  0 siblings, 1 reply; 6+ messages in thread
From: Darrick J. Wong @ 2023-04-22  3:57 UTC (permalink / raw)
  To: Guo Xuenan
  Cc: dchinner, linux-xfs, sandeen, guoxuenan, houtao1, fangwei1,
	jack.qiu, yi.zhang

On Fri, Apr 21, 2023 at 07:37:16PM +0800, Guo Xuenan wrote:
> With xfs print level parsing correctly, these duplicate dump
> information can be removed.
> 
> Signed-off-by: Guo Xuenan <guoxuenan@huawei.com>
> ---
>  fs/xfs/libxfs/xfs_ialloc.c | 1 -
>  fs/xfs/xfs_error.c         | 9 ---------
>  fs/xfs/xfs_fsops.c         | 2 --
>  fs/xfs/xfs_log.c           | 2 --
>  4 files changed, 14 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index a16d5de16933..df4e4eb19f14 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2329,7 +2329,6 @@ xfs_imap(
>  				__func__, ino,
>  				XFS_AGINO_TO_INO(mp, pag->pag_agno, agino));
>  		}
> -		xfs_stack_trace();

Hmm, this one was unconditional, wasn't it?  That looks like an omission
to me, so I'm calling it out in case anyone had hard opinions about it.
Otherwise,

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

>  #endif /* DEBUG */
>  		return error;
>  	}
> diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> index b2cbbba3e15a..7c8e1f3b69a6 100644
> --- a/fs/xfs/xfs_error.c
> +++ b/fs/xfs/xfs_error.c
> @@ -421,9 +421,6 @@ xfs_buf_corruption_error(
>  		  fa, bp->b_ops->name, xfs_buf_daddr(bp));
>  
>  	xfs_alert(mp, "Unmount and run xfs_repair");
> -
> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
> -		xfs_stack_trace();
>  }
>  
>  /*
> @@ -459,9 +456,6 @@ xfs_buf_verifier_error(
>  				sz);
>  		xfs_hex_dump(buf, sz);
>  	}
> -
> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
> -		xfs_stack_trace();
>  }
>  
>  /*
> @@ -509,7 +503,4 @@ xfs_inode_verifier_error(
>  				sz);
>  		xfs_hex_dump(buf, sz);
>  	}
> -
> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
> -		xfs_stack_trace();
>  }
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 13851c0d640b..e08b1ce109d9 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -546,8 +546,6 @@ xfs_do_force_shutdown(
>  			why, flags, __return_address, fname, lnnum);
>  	xfs_alert(mp,
>  		"Please unmount the filesystem and rectify the problem(s)");
> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
> -		xfs_stack_trace();
>  }
>  
>  /*
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index fc61cc024023..e4e4da33281d 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -3808,8 +3808,6 @@ xlog_force_shutdown(
>  				shutdown_flags);
>  		xfs_alert(log->l_mp,
>  "Please unmount the filesystem and rectify the problem(s).");
> -		if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
> -			xfs_stack_trace();
>  	}
>  
>  	/*
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] xfs: clean up some unnecessary xfs_stack_trace
  2023-04-22  3:57   ` Darrick J. Wong
@ 2023-04-23  1:44     ` Guo Xuenan
  0 siblings, 0 replies; 6+ messages in thread
From: Guo Xuenan @ 2023-04-23  1:44 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: dchinner, linux-xfs, sandeen, guoxuenan, houtao1, fangwei1,
	jack.qiu, yi.zhang

Hi Darrick,
On 2023/4/22 11:57, Darrick J. Wong wrote:
> On Fri, Apr 21, 2023 at 07:37:16PM +0800, Guo Xuenan wrote:
>> With xfs print level parsing correctly, these duplicate dump
>> information can be removed.
>>
>> Signed-off-by: Guo Xuenan <guoxuenan@huawei.com>
>> ---
>>   fs/xfs/libxfs/xfs_ialloc.c | 1 -
>>   fs/xfs/xfs_error.c         | 9 ---------
>>   fs/xfs/xfs_fsops.c         | 2 --
>>   fs/xfs/xfs_log.c           | 2 --
>>   4 files changed, 14 deletions(-)
>>
>> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
>> index a16d5de16933..df4e4eb19f14 100644
>> --- a/fs/xfs/libxfs/xfs_ialloc.c
>> +++ b/fs/xfs/libxfs/xfs_ialloc.c
>> @@ -2329,7 +2329,6 @@ xfs_imap(
>>   				__func__, ino,
>>   				XFS_AGINO_TO_INO(mp, pag->pag_agno, agino));
>>   		}
>> -		xfs_stack_trace();
> Hmm, this one was unconditional, wasn't it?  That looks like an omission
> to me, so I'm calling it out in case anyone had hard opinions about it.
> Otherwise,
It is unnecessary, since there are xfs_alert to report failure here.
if really need to get stack information, set error_level is enough, because
both of conditional branch have xfs_alert. To avoid repetition, in my 
opinion,
it's better to be removed.

Thanks
Xuenan
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
>
> --D
>
>>   #endif /* DEBUG */
>>   		return error;
>>   	}
>> diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
>> index b2cbbba3e15a..7c8e1f3b69a6 100644
>> --- a/fs/xfs/xfs_error.c
>> +++ b/fs/xfs/xfs_error.c
>> @@ -421,9 +421,6 @@ xfs_buf_corruption_error(
>>   		  fa, bp->b_ops->name, xfs_buf_daddr(bp));
>>   
>>   	xfs_alert(mp, "Unmount and run xfs_repair");
>> -
>> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
>> -		xfs_stack_trace();
>>   }
>>   
>>   /*
>> @@ -459,9 +456,6 @@ xfs_buf_verifier_error(
>>   				sz);
>>   		xfs_hex_dump(buf, sz);
>>   	}
>> -
>> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
>> -		xfs_stack_trace();
>>   }
>>   
>>   /*
>> @@ -509,7 +503,4 @@ xfs_inode_verifier_error(
>>   				sz);
>>   		xfs_hex_dump(buf, sz);
>>   	}
>> -
>> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
>> -		xfs_stack_trace();
>>   }
>> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
>> index 13851c0d640b..e08b1ce109d9 100644
>> --- a/fs/xfs/xfs_fsops.c
>> +++ b/fs/xfs/xfs_fsops.c
>> @@ -546,8 +546,6 @@ xfs_do_force_shutdown(
>>   			why, flags, __return_address, fname, lnnum);
>>   	xfs_alert(mp,
>>   		"Please unmount the filesystem and rectify the problem(s)");
>> -	if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
>> -		xfs_stack_trace();
>>   }
>>   
>>   /*
>> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
>> index fc61cc024023..e4e4da33281d 100644
>> --- a/fs/xfs/xfs_log.c
>> +++ b/fs/xfs/xfs_log.c
>> @@ -3808,8 +3808,6 @@ xlog_force_shutdown(
>>   				shutdown_flags);
>>   		xfs_alert(log->l_mp,
>>   "Please unmount the filesystem and rectify the problem(s).");
>> -		if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
>> -			xfs_stack_trace();
>>   	}
>>   
>>   	/*
>> -- 
>> 2.31.1
>>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-23  1:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 11:37 [PATCH v2 0/2] xfs fix and clean up Guo Xuenan
2023-04-21 11:37 ` [PATCH v2 1/2] xfs: fix xfs print level wrong parsing Guo Xuenan
2023-04-22  3:55   ` Darrick J. Wong
2023-04-21 11:37 ` [PATCH v2 2/2] xfs: clean up some unnecessary xfs_stack_trace Guo Xuenan
2023-04-22  3:57   ` Darrick J. Wong
2023-04-23  1:44     ` Guo Xuenan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox