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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230731061521.GB30409@lst.de>
Date:   Mon, 31 Jul 2023 08:15:21 +0200
From:   Christoph Hellwig <hch@....de>
To:     chengming.zhou@...ux.dev
Cc:     axboe@...nel.dk, hch@....de, ming.lei@...hat.com,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        zhouchengming@...edance.com
Subject: Re: [PATCH v2 2/4] blk-flush: split queues for preflush and
 postflush requests

> -	list_for_each_entry_safe(rq, n, running, queuelist) {
> +	list_for_each_entry_safe(rq, n, preflush_running, queuelist) {
> +		unsigned int seq = blk_flush_cur_seq(rq);
> +
> +		BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH);
> +		blk_flush_complete_seq(rq, fq, seq, error);
> +	}
> +
> +	list_for_each_entry_safe(rq, n, postflush_running, queuelist) {
>  		unsigned int seq = blk_flush_cur_seq(rq);
>  
>  		BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH);

Shouldn't the BUG_ON be split into one that only checks for PREFLUSH and
one only for POSTFLUSH?

> +	if (fq->flush_pending_idx != fq->flush_running_idx)
> +		return;
> +
> +	if (!list_empty(preflush_pending))
> +		first_rq = list_first_entry(preflush_pending, struct request, queuelist);
> +	else if (!list_empty(postflush_pending))
> +		first_rq = list_first_entry(postflush_pending, struct request, queuelist);
> +	else
>  		return;

Hmm, I don't think both lists can be empty here?

I'd simplify this and avoid the overly long lines as:

	first_rq = list_first_entry_or_null(preflush_pending, struct request,
					    queuelist);
	if (!first_rq)
		first_rq = list_first_entry_or_null(postflush_pending,
						    struct request, queuelist);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ