* [PATCH -next,V2] fscache: support to disable assert macro
@ 2023-11-01 16:34 WoZ1zh1
2023-11-07 10:16 ` Zizhi Wo
0 siblings, 1 reply; 6+ messages in thread
From: WoZ1zh1 @ 2023-11-01 16:34 UTC (permalink / raw)
To: dhowells; +Cc: linux-cachefs, linux-kernel, wozizhi, yangerkun
In fs/fscache/internal.h, ASSERT macro is enabled by default and can not
be disabled, then assert failure will crash the kernel as the BUG() is
included in the ASSERT macro. Therefore, add FSCACHE_ASSERT to control it.
Signed-off-by: WoZ1zh1 <wozizhi@huawei.com>
---
fs/fscache/Kconfig | 10 ++++++++++
fs/fscache/internal.h | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/fscache/Kconfig b/fs/fscache/Kconfig
index b313a978ae0a..7ff844038bc3 100644
--- a/fs/fscache/Kconfig
+++ b/fs/fscache/Kconfig
@@ -38,3 +38,13 @@ config FSCACHE_DEBUG
enabled by setting bits in /sys/modules/fscache/parameter/debug.
See Documentation/filesystems/caching/fscache.rst for more information.
+
+config FSCACHE_ASSERT
+ bool "FSCACHE asserts"
+ default n
+ depends on FSCACHE
+ help
+ Support the ASSERT mode for failure behavior.
+ Say N here to disable the ASSERT by default.
+ Say Y to add assertion checks in some places. But the assertion
+ failure will result in fatal errors that BUG() the kernel.
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
index 1336f517e9b1..951166ed772f 100644
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -225,7 +225,7 @@ do { \
/*
* assertions
*/
-#if 1 /* defined(__KDEBUGALL) */
+#ifdef CONFIG_FSCACHE_ASSERT
#define ASSERT(X) \
do { \
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next,V2] fscache: support to disable assert macro
2023-11-01 16:34 [PATCH -next,V2] fscache: support to disable assert macro WoZ1zh1
@ 2023-11-07 10:16 ` Zizhi Wo
2023-11-07 12:39 ` Gao Xiang
0 siblings, 1 reply; 6+ messages in thread
From: Zizhi Wo @ 2023-11-07 10:16 UTC (permalink / raw)
To: dhowells; +Cc: linux-cachefs, linux-kernel, yangerkun, hsiangkao
friendly ping
在 2023/11/2 0:34, WoZ1zh1 写道:
> In fs/fscache/internal.h, ASSERT macro is enabled by default and can not
> be disabled, then assert failure will crash the kernel as the BUG() is
> included in the ASSERT macro. Therefore, add FSCACHE_ASSERT to control it.
>
> Signed-off-by: WoZ1zh1 <wozizhi@huawei.com>
> ---
> fs/fscache/Kconfig | 10 ++++++++++
> fs/fscache/internal.h | 2 +-
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fscache/Kconfig b/fs/fscache/Kconfig
> index b313a978ae0a..7ff844038bc3 100644
> --- a/fs/fscache/Kconfig
> +++ b/fs/fscache/Kconfig
> @@ -38,3 +38,13 @@ config FSCACHE_DEBUG
> enabled by setting bits in /sys/modules/fscache/parameter/debug.
>
> See Documentation/filesystems/caching/fscache.rst for more information.
> +
> +config FSCACHE_ASSERT
> + bool "FSCACHE asserts"
> + default n
> + depends on FSCACHE
> + help
> + Support the ASSERT mode for failure behavior.
> + Say N here to disable the ASSERT by default.
> + Say Y to add assertion checks in some places. But the assertion
> + failure will result in fatal errors that BUG() the kernel.
> diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
> index 1336f517e9b1..951166ed772f 100644
> --- a/fs/fscache/internal.h
> +++ b/fs/fscache/internal.h
> @@ -225,7 +225,7 @@ do { \
> /*
> * assertions
> */
> -#if 1 /* defined(__KDEBUGALL) */
> +#ifdef CONFIG_FSCACHE_ASSERT
>
> #define ASSERT(X) \
> do { \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next,V2] fscache: support to disable assert macro
2023-11-07 10:16 ` Zizhi Wo
@ 2023-11-07 12:39 ` Gao Xiang
2023-11-08 2:25 ` Zizhi Wo
0 siblings, 1 reply; 6+ messages in thread
From: Gao Xiang @ 2023-11-07 12:39 UTC (permalink / raw)
To: Zizhi Wo, dhowells; +Cc: linux-cachefs, linux-kernel, yangerkun
On 2023/11/7 18:16, Zizhi Wo wrote:
> friendly ping
>
> 在 2023/11/2 0:34, WoZ1zh1 写道:
>> In fs/fscache/internal.h, ASSERT macro is enabled by default and can not
>> be disabled, then assert failure will crash the kernel as the BUG() is
>> included in the ASSERT macro. Therefore, add FSCACHE_ASSERT to control it.
Personally it looks good to me, yet we could also turn
them into WARN_ON_ONCE case by case? Anyway, it depends
on how David thinks...
Thanks,
Gao Xiang
>>
>> Signed-off-by: WoZ1zh1 <wozizhi@huawei.com>
>> ---
>> fs/fscache/Kconfig | 10 ++++++++++
>> fs/fscache/internal.h | 2 +-
>> 2 files changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/fscache/Kconfig b/fs/fscache/Kconfig
>> index b313a978ae0a..7ff844038bc3 100644
>> --- a/fs/fscache/Kconfig
>> +++ b/fs/fscache/Kconfig
>> @@ -38,3 +38,13 @@ config FSCACHE_DEBUG
>> enabled by setting bits in /sys/modules/fscache/parameter/debug.
>> See Documentation/filesystems/caching/fscache.rst for more information.
>> +
>> +config FSCACHE_ASSERT
>> + bool "FSCACHE asserts"
>> + default n
>> + depends on FSCACHE
>> + help
>> + Support the ASSERT mode for failure behavior.
>> + Say N here to disable the ASSERT by default.
>> + Say Y to add assertion checks in some places. But the assertion
>> + failure will result in fatal errors that BUG() the kernel.
>> diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
>> index 1336f517e9b1..951166ed772f 100644
>> --- a/fs/fscache/internal.h
>> +++ b/fs/fscache/internal.h
>> @@ -225,7 +225,7 @@ do { \
>> /*
>> * assertions
>> */
>> -#if 1 /* defined(__KDEBUGALL) */
>> +#ifdef CONFIG_FSCACHE_ASSERT
>> #define ASSERT(X) \
>> do { \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next,V2] fscache: support to disable assert macro
2023-11-07 12:39 ` Gao Xiang
@ 2023-11-08 2:25 ` Zizhi Wo
2023-11-30 2:50 ` Zizhi Wo
0 siblings, 1 reply; 6+ messages in thread
From: Zizhi Wo @ 2023-11-08 2:25 UTC (permalink / raw)
To: Gao Xiang, dhowells; +Cc: linux-cachefs, linux-kernel, yangerkun
在 2023/11/7 20:39, Gao Xiang 写道:
>
>
> On 2023/11/7 18:16, Zizhi Wo wrote:
>> friendly ping
>>
>> 在 2023/11/2 0:34, WoZ1zh1 写道:
>>> In fs/fscache/internal.h, ASSERT macro is enabled by default and can not
>>> be disabled, then assert failure will crash the kernel as the BUG() is
>>> included in the ASSERT macro. Therefore, add FSCACHE_ASSERT to
>>> control it.
>
> Personally it looks good to me, yet we could also turn
> them into WARN_ON_ONCE case by case? Anyway, it depends
> on how David thinks...
>
Thank you for your recognition!
Thanks,
Zizhi Wo
> Thanks,
> Gao Xiang
>
>>>
>>> Signed-off-by: WoZ1zh1 <wozizhi@huawei.com>
>>> ---
>>> fs/fscache/Kconfig | 10 ++++++++++
>>> fs/fscache/internal.h | 2 +-
>>> 2 files changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/fscache/Kconfig b/fs/fscache/Kconfig
>>> index b313a978ae0a..7ff844038bc3 100644
>>> --- a/fs/fscache/Kconfig
>>> +++ b/fs/fscache/Kconfig
>>> @@ -38,3 +38,13 @@ config FSCACHE_DEBUG
>>> enabled by setting bits in /sys/modules/fscache/parameter/debug.
>>> See Documentation/filesystems/caching/fscache.rst for more
>>> information.
>>> +
>>> +config FSCACHE_ASSERT
>>> + bool "FSCACHE asserts"
>>> + default n
>>> + depends on FSCACHE
>>> + help
>>> + Support the ASSERT mode for failure behavior.
>>> + Say N here to disable the ASSERT by default.
>>> + Say Y to add assertion checks in some places. But the assertion
>>> + failure will result in fatal errors that BUG() the kernel.
>>> diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
>>> index 1336f517e9b1..951166ed772f 100644
>>> --- a/fs/fscache/internal.h
>>> +++ b/fs/fscache/internal.h
>>> @@ -225,7 +225,7 @@ do { \
>>> /*
>>> * assertions
>>> */
>>> -#if 1 /* defined(__KDEBUGALL) */
>>> +#ifdef CONFIG_FSCACHE_ASSERT
>>> #define ASSERT(X) \
>>> do { \
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next,V2] fscache: support to disable assert macro
2023-11-08 2:25 ` Zizhi Wo
@ 2023-11-30 2:50 ` Zizhi Wo
2024-01-26 2:51 ` Zizhi Wo
0 siblings, 1 reply; 6+ messages in thread
From: Zizhi Wo @ 2023-11-30 2:50 UTC (permalink / raw)
To: Gao Xiang, dhowells; +Cc: linux-cachefs, linux-kernel, yangerkun
friendly ping
在 2023/11/8 10:25, Zizhi Wo 写道:
>
>
> 在 2023/11/7 20:39, Gao Xiang 写道:
>>
>>
>> On 2023/11/7 18:16, Zizhi Wo wrote:
>>> friendly ping
>>>
>>> 在 2023/11/2 0:34, WoZ1zh1 写道:
>>>> In fs/fscache/internal.h, ASSERT macro is enabled by default and can
>>>> not
>>>> be disabled, then assert failure will crash the kernel as the BUG() is
>>>> included in the ASSERT macro. Therefore, add FSCACHE_ASSERT to
>>>> control it.
>>
>> Personally it looks good to me, yet we could also turn
>> them into WARN_ON_ONCE case by case? Anyway, it depends
>> on how David thinks...
>>
> Thank you for your recognition!
>
> Thanks,
> Zizhi Wo
>
>> Thanks,
>> Gao Xiang
>>
>>>>
>>>> Signed-off-by: WoZ1zh1 <wozizhi@huawei.com>
>>>> ---
>>>> fs/fscache/Kconfig | 10 ++++++++++
>>>> fs/fscache/internal.h | 2 +-
>>>> 2 files changed, 11 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/fs/fscache/Kconfig b/fs/fscache/Kconfig
>>>> index b313a978ae0a..7ff844038bc3 100644
>>>> --- a/fs/fscache/Kconfig
>>>> +++ b/fs/fscache/Kconfig
>>>> @@ -38,3 +38,13 @@ config FSCACHE_DEBUG
>>>> enabled by setting bits in
>>>> /sys/modules/fscache/parameter/debug.
>>>> See Documentation/filesystems/caching/fscache.rst for more
>>>> information.
>>>> +
>>>> +config FSCACHE_ASSERT
>>>> + bool "FSCACHE asserts"
>>>> + default n
>>>> + depends on FSCACHE
>>>> + help
>>>> + Support the ASSERT mode for failure behavior.
>>>> + Say N here to disable the ASSERT by default.
>>>> + Say Y to add assertion checks in some places. But the assertion
>>>> + failure will result in fatal errors that BUG() the kernel.
>>>> diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
>>>> index 1336f517e9b1..951166ed772f 100644
>>>> --- a/fs/fscache/internal.h
>>>> +++ b/fs/fscache/internal.h
>>>> @@ -225,7 +225,7 @@ do { \
>>>> /*
>>>> * assertions
>>>> */
>>>> -#if 1 /* defined(__KDEBUGALL) */
>>>> +#ifdef CONFIG_FSCACHE_ASSERT
>>>> #define ASSERT(X) \
>>>> do { \
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next,V2] fscache: support to disable assert macro
2023-11-30 2:50 ` Zizhi Wo
@ 2024-01-26 2:51 ` Zizhi Wo
0 siblings, 0 replies; 6+ messages in thread
From: Zizhi Wo @ 2024-01-26 2:51 UTC (permalink / raw)
To: Gao Xiang, dhowells; +Cc: linux-cachefs, linux-kernel, yangerkun
friendly ping
在 2023/11/30 10:50, Zizhi Wo 写道:
> friendly ping
>
> 在 2023/11/8 10:25, Zizhi Wo 写道:
>>
>>
>> 在 2023/11/7 20:39, Gao Xiang 写道:
>>>
>>>
>>> On 2023/11/7 18:16, Zizhi Wo wrote:
>>>> friendly ping
>>>>
>>>> 在 2023/11/2 0:34, WoZ1zh1 写道:
>>>>> In fs/fscache/internal.h, ASSERT macro is enabled by default and
>>>>> can not
>>>>> be disabled, then assert failure will crash the kernel as the BUG() is
>>>>> included in the ASSERT macro. Therefore, add FSCACHE_ASSERT to
>>>>> control it.
>>>
>>> Personally it looks good to me, yet we could also turn
>>> them into WARN_ON_ONCE case by case? Anyway, it depends
>>> on how David thinks...
>>>
>> Thank you for your recognition!
>>
>> Thanks,
>> Zizhi Wo
>>
>>> Thanks,
>>> Gao Xiang
>>>
>>>>>
>>>>> Signed-off-by: WoZ1zh1 <wozizhi@huawei.com>
>>>>> ---
>>>>> fs/fscache/Kconfig | 10 ++++++++++
>>>>> fs/fscache/internal.h | 2 +-
>>>>> 2 files changed, 11 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/fscache/Kconfig b/fs/fscache/Kconfig
>>>>> index b313a978ae0a..7ff844038bc3 100644
>>>>> --- a/fs/fscache/Kconfig
>>>>> +++ b/fs/fscache/Kconfig
>>>>> @@ -38,3 +38,13 @@ config FSCACHE_DEBUG
>>>>> enabled by setting bits in
>>>>> /sys/modules/fscache/parameter/debug.
>>>>> See Documentation/filesystems/caching/fscache.rst for more
>>>>> information.
>>>>> +
>>>>> +config FSCACHE_ASSERT
>>>>> + bool "FSCACHE asserts"
>>>>> + default n
>>>>> + depends on FSCACHE
>>>>> + help
>>>>> + Support the ASSERT mode for failure behavior.
>>>>> + Say N here to disable the ASSERT by default.
>>>>> + Say Y to add assertion checks in some places. But the assertion
>>>>> + failure will result in fatal errors that BUG() the kernel.
>>>>> diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
>>>>> index 1336f517e9b1..951166ed772f 100644
>>>>> --- a/fs/fscache/internal.h
>>>>> +++ b/fs/fscache/internal.h
>>>>> @@ -225,7 +225,7 @@ do { \
>>>>> /*
>>>>> * assertions
>>>>> */
>>>>> -#if 1 /* defined(__KDEBUGALL) */
>>>>> +#ifdef CONFIG_FSCACHE_ASSERT
>>>>> #define ASSERT(X) \
>>>>> do { \
>>>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-26 2:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01 16:34 [PATCH -next,V2] fscache: support to disable assert macro WoZ1zh1
2023-11-07 10:16 ` Zizhi Wo
2023-11-07 12:39 ` Gao Xiang
2023-11-08 2:25 ` Zizhi Wo
2023-11-30 2:50 ` Zizhi Wo
2024-01-26 2:51 ` Zizhi Wo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®