lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xjdoodv3rxgz74sfqoosfr6jt2td5zdxz55t6cuqknua5347r6@hfkq6e56jsmx>
Date: Wed, 12 Nov 2025 20:29:17 +0100
From: Jan Kara <jack@...e.cz>
To: Baolin Liu <liubaolin12138@....com>
Cc: tytso@....edu, jack@...e.com, linux-ext4@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Baolin Liu <liubaolin@...inos.cn>
Subject: Re: [PATCH v1] jbd2: use J_ASSERT instead of BUG_ON for checkpoint
 mutex

Hello!

On Wed 12-11-25 18:29:14, Baolin Liu wrote:
> From: Baolin Liu <liubaolin@...inos.cn>
> 
> Replace BUG_ON with J_ASSERT to write the assertion in a positive form.
> 
> No functional change.
> 
> Signed-off-by: Baolin Liu <liubaolin@...inos.cn>

Thanks for the patch I don't think this is really useful. It is IMO just
a pointless churn... If something, we could get rid of J_ASSERT,
J_ASSERT_JH and J_ASSERT_BH macros which are mostly pointless obfuscation
but even that will cause newer patches to not apply to later stable kernels
and thus I don't think it's really worth it.

								Honza

> ---
>  fs/jbd2/journal.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index d480b94117cd..c858ade1f7f3 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1058,7 +1058,7 @@ int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)
>  	unsigned long freed;
>  	int ret;
>  
> -	BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
> +	J_ASSERT(mutex_is_locked(&journal->j_checkpoint_mutex));
>  
>  	/*
>  	 * We cannot afford for write to remain in drive's caches since as
> @@ -1863,7 +1863,7 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,
>  		return -EIO;
>  	}
>  
> -	BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
> +	J_ASSERT(mutex_is_locked(&journal->j_checkpoint_mutex));
>  	jbd2_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n",
>  		  tail_block, tail_tid);
>  
> @@ -1897,7 +1897,7 @@ static void jbd2_mark_journal_empty(journal_t *journal, blk_opf_t write_flags)
>  	journal_superblock_t *sb = journal->j_superblock;
>  	bool had_fast_commit = false;
>  
> -	BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
> +	J_ASSERT(mutex_is_locked(&journal->j_checkpoint_mutex));
>  	lock_buffer(journal->j_sb_buffer);
>  	if (sb->s_start == 0) {		/* Is it already empty? */
>  		unlock_buffer(journal->j_sb_buffer);
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ