linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Zhang Yi <yi.zhang@huawei.com>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, cluster-devel@redhat.com,
	ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com,
	reiserfs-devel@vger.kernel.org, jack@suse.cz, tytso@mit.edu,
	akpm@linux-foundation.org, axboe@kernel.dk,
	viro@zeniv.linux.org.uk, rpeterso@redhat.com,
	agruenba@redhat.com, almaz.alexandrovich@paragon-software.com,
	mark@fasheh.com, dushistov@mail.ru, hch@infradead.org,
	chengzhihao1@huawei.com, yukuai3@huawei.com
Subject: Re: [PATCH v2 09/14] reiserfs: replace ll_rw_block()
Date: Thu, 1 Sep 2022 17:52:35 +0200	[thread overview]
Message-ID: <20220901155235.4m3hrnxk65wbimco@quack3> (raw)
In-Reply-To: <20220901133505.2510834-10-yi.zhang@huawei.com>

On Thu 01-09-22 21:35:00, Zhang Yi wrote:
> ll_rw_block() is not safe for the sync read/write path because it cannot
> guarantee that submitting read/write IO if the buffer has been locked.
> We could get false positive EIO after wait_on_buffer() in read path if
> the buffer has been locked by others. So stop using ll_rw_block() in
> reiserfs. We also switch to new bh_readahead_batch() helper for the
> buffer array readahead path.
> 
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>


Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/reiserfs/journal.c | 11 ++++++-----
>  fs/reiserfs/stree.c   |  4 ++--
>  fs/reiserfs/super.c   |  4 +---
>  3 files changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
> index 94addfcefede..9f62da7471c9 100644
> --- a/fs/reiserfs/journal.c
> +++ b/fs/reiserfs/journal.c
> @@ -868,7 +868,7 @@ static int write_ordered_buffers(spinlock_t * lock,
>  		 */
>  		if (buffer_dirty(bh) && unlikely(bh->b_page->mapping == NULL)) {
>  			spin_unlock(lock);
> -			ll_rw_block(REQ_OP_WRITE, 1, &bh);
> +			write_dirty_buffer(bh, 0);
>  			spin_lock(lock);
>  		}
>  		put_bh(bh);
> @@ -1054,7 +1054,7 @@ static int flush_commit_list(struct super_block *s,
>  		if (tbh) {
>  			if (buffer_dirty(tbh)) {
>  		            depth = reiserfs_write_unlock_nested(s);
> -			    ll_rw_block(REQ_OP_WRITE, 1, &tbh);
> +			    write_dirty_buffer(tbh, 0);
>  			    reiserfs_write_lock_nested(s, depth);
>  			}
>  			put_bh(tbh) ;
> @@ -2240,7 +2240,7 @@ static int journal_read_transaction(struct super_block *sb,
>  		}
>  	}
>  	/* read in the log blocks, memcpy to the corresponding real block */
> -	ll_rw_block(REQ_OP_READ, get_desc_trans_len(desc), log_blocks);
> +	bh_read_batch(get_desc_trans_len(desc), log_blocks);
>  	for (i = 0; i < get_desc_trans_len(desc); i++) {
>  
>  		wait_on_buffer(log_blocks[i]);
> @@ -2342,10 +2342,11 @@ static struct buffer_head *reiserfs_breada(struct block_device *dev,
>  		} else
>  			bhlist[j++] = bh;
>  	}
> -	ll_rw_block(REQ_OP_READ, j, bhlist);
> +	bh = bhlist[0];
> +	bh_read_nowait(bh, 0);
> +	bh_readahead_batch(j - 1, &bhlist[1], 0);
>  	for (i = 1; i < j; i++)
>  		brelse(bhlist[i]);
> -	bh = bhlist[0];
>  	wait_on_buffer(bh);
>  	if (buffer_uptodate(bh))
>  		return bh;
> diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
> index 9a293609a022..84c12a1947b2 100644
> --- a/fs/reiserfs/stree.c
> +++ b/fs/reiserfs/stree.c
> @@ -579,7 +579,7 @@ static int search_by_key_reada(struct super_block *s,
>  		if (!buffer_uptodate(bh[j])) {
>  			if (depth == -1)
>  				depth = reiserfs_write_unlock_nested(s);
> -			ll_rw_block(REQ_OP_READ | REQ_RAHEAD, 1, bh + j);
> +			bh_readahead(bh[j], REQ_RAHEAD);
>  		}
>  		brelse(bh[j]);
>  	}
> @@ -685,7 +685,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *key,
>  			if (!buffer_uptodate(bh) && depth == -1)
>  				depth = reiserfs_write_unlock_nested(sb);
>  
> -			ll_rw_block(REQ_OP_READ, 1, &bh);
> +			bh_read_nowait(bh, 0);
>  			wait_on_buffer(bh);
>  
>  			if (depth != -1)
> diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
> index c88cd2ce0665..a5ffec0c7517 100644
> --- a/fs/reiserfs/super.c
> +++ b/fs/reiserfs/super.c
> @@ -1702,9 +1702,7 @@ static int read_super_block(struct super_block *s, int offset)
>  /* after journal replay, reread all bitmap and super blocks */
>  static int reread_meta_blocks(struct super_block *s)
>  {
> -	ll_rw_block(REQ_OP_READ, 1, &SB_BUFFER_WITH_SB(s));
> -	wait_on_buffer(SB_BUFFER_WITH_SB(s));
> -	if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
> +	if (bh_read(SB_BUFFER_WITH_SB(s), 0) < 0) {
>  		reiserfs_warning(s, "reiserfs-2504", "error reading the super");
>  		return 1;
>  	}
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2022-09-01 15:52 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 13:34 [PATCH v2 00/14] fs/buffer: remove ll_rw_block() Zhang Yi
2022-09-01 13:34 ` [PATCH v2 01/14] fs/buffer: remove __breadahead_gfp() Zhang Yi
2022-09-05  5:52   ` Christoph Hellwig
2022-09-01 13:34 ` [PATCH v2 02/14] fs/buffer: add some new buffer read helpers Zhang Yi
2022-09-01 15:44   ` Jan Kara
2022-09-05  5:52   ` Christoph Hellwig
2022-09-01 13:34 ` [PATCH v2 03/14] fs/buffer: replace ll_rw_block() Zhang Yi
2022-09-01 15:45   ` Jan Kara
2022-09-05  5:53   ` Christoph Hellwig
2022-09-01 13:34 ` [PATCH v2 04/14] gfs2: " Zhang Yi
2022-09-01 15:46   ` Jan Kara
2022-09-05  5:54   ` Christoph Hellwig
2022-09-05 14:10   ` Andreas Gruenbacher
2022-09-01 13:34 ` [PATCH v2 05/14] isofs: " Zhang Yi
2022-09-05  5:54   ` Christoph Hellwig
2022-09-01 13:34 ` [PATCH v2 06/14] jbd2: " Zhang Yi
2022-09-01 15:50   ` Jan Kara
2022-09-05  5:54   ` Christoph Hellwig
2022-09-05  8:23   ` Theodore Ts'o
2022-09-01 13:34 ` [PATCH v2 07/14] ntfs3: " Zhang Yi
2022-09-01 15:47   ` Jan Kara
2022-09-05  5:54   ` Christoph Hellwig
2022-09-01 13:34 ` [PATCH v2 08/14] ocfs2: " Zhang Yi
2022-09-01 15:51   ` Jan Kara
2022-09-05  5:55   ` Christoph Hellwig
2022-09-06  1:06   ` [Ocfs2-devel] " Joseph Qi
2022-09-01 13:35 ` [PATCH v2 09/14] reiserfs: " Zhang Yi
2022-09-01 15:52   ` Jan Kara [this message]
2022-09-05  5:55   ` Christoph Hellwig
2022-09-01 13:35 ` [PATCH v2 10/14] udf: " Zhang Yi
2022-09-01 15:58   ` Jan Kara
2022-09-05  5:55   ` Christoph Hellwig
2022-09-01 13:35 ` [PATCH v2 11/14] ufs: " Zhang Yi
2022-09-01 15:59   ` Jan Kara
2022-09-05  5:56   ` Christoph Hellwig
2022-09-01 13:35 ` [PATCH v2 12/14] fs/buffer: remove ll_rw_block() helper Zhang Yi
2022-09-05  5:56   ` Christoph Hellwig
2022-09-01 13:35 ` [PATCH v2 13/14] ext2: replace bh_submit_read() helper with bh_read_locked() Zhang Yi
2022-09-01 15:59   ` Jan Kara
2022-09-02  0:30   ` Al Viro
2022-09-02  1:32     ` Zhang Yi
2022-09-02  1:51       ` Al Viro
2022-09-02  1:58         ` Zhang Yi
2022-09-05  5:56   ` Christoph Hellwig
2022-09-01 13:35 ` [PATCH v2 14/14] fs/buffer: remove bh_submit_read() helper Zhang Yi
2022-09-05  5:57   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220901155235.4m3hrnxk65wbimco@quack3 \
    --to=jack@suse.cz \
    --cc=agruenba@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=axboe@kernel.dk \
    --cc=chengzhihao1@huawei.com \
    --cc=cluster-devel@redhat.com \
    --cc=dushistov@mail.ru \
    --cc=hch@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=rpeterso@redhat.com \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).