* [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked()
@ 2022-07-10 11:38 Pali Rohár
2022-07-10 11:38 ` [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code Pali Rohár
2022-07-20 3:55 ` [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Heiko Schocher
0 siblings, 2 replies; 4+ messages in thread
From: Pali Rohár @ 2022-07-10 11:38 UTC (permalink / raw)
To: Kyungmin Park, Heiko Schocher; +Cc: u-boot
U-Boot does not implement down_write_trylock() and its stub always returns
true that lock was acquired. Therefore ubifs_assert_cmt_locked() assert
currently always fails.
Fix this issue by redefining ubifs_assert_cmt_locked() to just empty stub
as there is nothing to assert.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
fs/ubifs/debug.h | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index 5f6e12702de8..d69f1e6ac70b 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -173,13 +173,7 @@ struct ubifs_global_debug_info {
} \
} while (0)
-#define ubifs_assert_cmt_locked(c) do { \
- if (unlikely(down_write_trylock(&(c)->commit_sem))) { \
- up_write(&(c)->commit_sem); \
- pr_debug("commit lock is not locked!\n"); \
- ubifs_assert(0); \
- } \
-} while (0)
+#define ubifs_assert_cmt_locked(c) do { } while (0)
#define ubifs_dbg_msg(type, fmt, ...) \
pr_debug("UBIFS DBG " type ": " fmt "\n", \
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code
2022-07-10 11:38 [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Pali Rohár
@ 2022-07-10 11:38 ` Pali Rohár
2022-07-20 3:55 ` Heiko Schocher
2022-07-20 3:55 ` [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Heiko Schocher
1 sibling, 1 reply; 4+ messages in thread
From: Pali Rohár @ 2022-07-10 11:38 UTC (permalink / raw)
To: Kyungmin Park, Heiko Schocher; +Cc: u-boot
U-Boot already provides assert function, so it use also in ubi and ubifs code.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
drivers/mtd/ubi/debug.h | 9 ++-------
fs/ubifs/debug.h | 9 ++-------
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index 2c2faaf1b4dc..9c8ce51636b1 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -27,13 +27,8 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
} \
} while (0)
#else
-#define ubi_assert(expr) do { \
- if (unlikely(!(expr))) { \
- pr_debug("UBI assert failed in %s at %u\n", \
- __func__, __LINE__); \
- dump_stack(); \
- } \
-} while (0)
+#include <log.h>
+#define ubi_assert(expr) assert(expr)
#endif
#define ubi_dbg_print_hex_dump(ps, pt, r, g, b, len, a) \
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
index d69f1e6ac70b..0ecc2e0c8e98 100644
--- a/fs/ubifs/debug.h
+++ b/fs/ubifs/debug.h
@@ -165,14 +165,9 @@ struct ubifs_global_debug_info {
dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN)); \
} while (0)
#else
-#define ubifs_assert(expr) do { \
- if (unlikely(!(expr))) { \
- pr_debug("UBIFS assert failed in %s at %u\n", \
- __func__, __LINE__); \
- dump_stack(); \
- } \
-} while (0)
+#include <log.h>
+#define ubifs_assert(expr) assert(expr)
#define ubifs_assert_cmt_locked(c) do { } while (0)
#define ubifs_dbg_msg(type, fmt, ...) \
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked()
2022-07-10 11:38 [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Pali Rohár
2022-07-10 11:38 ` [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code Pali Rohár
@ 2022-07-20 3:55 ` Heiko Schocher
1 sibling, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2022-07-20 3:55 UTC (permalink / raw)
To: Pali Rohár, Kyungmin Park; +Cc: u-boot
Hello Pali,
On 10.07.22 13:38, Pali Rohár wrote:
> U-Boot does not implement down_write_trylock() and its stub always returns
> true that lock was acquired. Therefore ubifs_assert_cmt_locked() assert
> currently always fails.
>
> Fix this issue by redefining ubifs_assert_cmt_locked() to just empty stub
> as there is nothing to assert.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> fs/ubifs/debug.h | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
Applied to u-boot-ubi.git master
Thanks!
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs@denx.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code
2022-07-10 11:38 ` [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code Pali Rohár
@ 2022-07-20 3:55 ` Heiko Schocher
0 siblings, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2022-07-20 3:55 UTC (permalink / raw)
To: Pali Rohár, Kyungmin Park; +Cc: u-boot
Hello Pali,
On 10.07.22 13:38, Pali Rohár wrote:
> U-Boot already provides assert function, so it use also in ubi and ubifs code.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> drivers/mtd/ubi/debug.h | 9 ++-------
> fs/ubifs/debug.h | 9 ++-------
> 2 files changed, 4 insertions(+), 14 deletions(-)
Applied to u-boot-ubi.git master
Thanks!
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs@denx.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-20 3:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-10 11:38 [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Pali Rohár
2022-07-10 11:38 ` [PATCH 2/2] ubifs: Use U-Boot assert() from <log.h> in UBI/UBIFS code Pali Rohár
2022-07-20 3:55 ` Heiko Schocher
2022-07-20 3:55 ` [PATCH 1/2] ubifs: Fix ubifs_assert_cmt_locked() Heiko Schocher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox