From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 2/6] f2fs: fix to wait on block writeback for post_read case
Date: Sun, 10 Dec 2023 19:35:43 +0800 [thread overview]
Message-ID: <20231210113547.3412782-2-chao@kernel.org> (raw)
In-Reply-To: <20231210113547.3412782-1-chao@kernel.org>
If inode is compressed, but not encrypted, it missed to call
f2fs_wait_on_block_writeback() to wait for GCed page writeback
in IPU write path.
Thread A GC-Thread
- f2fs_gc
- do_garbage_collect
- gc_data_segment
- move_data_block
- f2fs_submit_page_write
migrate normal cluster's block via
meta_inode's page cache
- f2fs_write_single_data_page
- f2fs_do_write_data_page
- f2fs_inplace_write_data
- f2fs_submit_page_bio
IRQ
- f2fs_read_end_io
IRQ
old data overrides new data due to
out-of-order GC and common IO.
- f2fs_read_end_io
Fixes: 4c8ff7095bef ("f2fs: support data compression")
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/data.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 27015b7875ae..dce8defdf4c7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2556,9 +2556,6 @@ int f2fs_encrypt_one_page(struct f2fs_io_info *fio)
page = fio->compressed_page ? fio->compressed_page : fio->page;
- /* wait for GCed page writeback via META_MAPPING */
- f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
-
if (fscrypt_inode_uses_inline_crypto(inode))
return 0;
@@ -2745,6 +2742,10 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
goto out_writepage;
}
+ /* wait for GCed page writeback via META_MAPPING */
+ if (fio->post_read)
+ f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
+
/*
* If current allocation needs SSR,
* it had better in-place writes for updated data.
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>
Subject: [PATCH 2/6] f2fs: fix to wait on block writeback for post_read case
Date: Sun, 10 Dec 2023 19:35:43 +0800 [thread overview]
Message-ID: <20231210113547.3412782-2-chao@kernel.org> (raw)
In-Reply-To: <20231210113547.3412782-1-chao@kernel.org>
If inode is compressed, but not encrypted, it missed to call
f2fs_wait_on_block_writeback() to wait for GCed page writeback
in IPU write path.
Thread A GC-Thread
- f2fs_gc
- do_garbage_collect
- gc_data_segment
- move_data_block
- f2fs_submit_page_write
migrate normal cluster's block via
meta_inode's page cache
- f2fs_write_single_data_page
- f2fs_do_write_data_page
- f2fs_inplace_write_data
- f2fs_submit_page_bio
IRQ
- f2fs_read_end_io
IRQ
old data overrides new data due to
out-of-order GC and common IO.
- f2fs_read_end_io
Fixes: 4c8ff7095bef ("f2fs: support data compression")
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/data.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 27015b7875ae..dce8defdf4c7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2556,9 +2556,6 @@ int f2fs_encrypt_one_page(struct f2fs_io_info *fio)
page = fio->compressed_page ? fio->compressed_page : fio->page;
- /* wait for GCed page writeback via META_MAPPING */
- f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
-
if (fscrypt_inode_uses_inline_crypto(inode))
return 0;
@@ -2745,6 +2742,10 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio)
goto out_writepage;
}
+ /* wait for GCed page writeback via META_MAPPING */
+ if (fio->post_read)
+ f2fs_wait_on_block_writeback(inode, fio->old_blkaddr);
+
/*
* If current allocation needs SSR,
* it had better in-place writes for updated data.
--
2.40.1
next prev parent reply other threads:[~2023-12-10 11:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-10 11:35 [f2fs-dev] [PATCH 1/6] f2fs: fix to tag gcing flag on page during block migration Chao Yu
2023-12-10 11:35 ` Chao Yu
2023-12-10 11:35 ` Chao Yu [this message]
2023-12-10 11:35 ` [PATCH 2/6] f2fs: fix to wait on block writeback for post_read case Chao Yu
2023-12-10 11:35 ` [f2fs-dev] [PATCH 3/6] f2fs: fix to check compress file in f2fs_move_file_range() Chao Yu
2023-12-10 11:35 ` Chao Yu
2023-12-10 11:35 ` [f2fs-dev] [PATCH 4/6] f2fs: don't set FI_PREALLOCATED_ALL for partial write Chao Yu
2023-12-10 11:35 ` Chao Yu
2023-12-11 22:08 ` [f2fs-dev] " Jaegeuk Kim
2023-12-11 22:08 ` Jaegeuk Kim
2023-12-10 11:35 ` [f2fs-dev] [PATCH 5/6] f2fs: fix to restrict condition of compress inode conversion Chao Yu
2023-12-10 11:35 ` Chao Yu
2023-12-11 22:11 ` [f2fs-dev] " Jaegeuk Kim
2023-12-11 22:11 ` Jaegeuk Kim
2023-12-12 1:05 ` [f2fs-dev] " Chao Yu
2023-12-12 1:05 ` Chao Yu
2023-12-12 22:21 ` [f2fs-dev] " Jaegeuk Kim
2023-12-12 22:21 ` Jaegeuk Kim
2023-12-28 15:33 ` [f2fs-dev] " Chao Yu
2023-12-28 15:33 ` Chao Yu
2024-01-02 22:54 ` [f2fs-dev] " Jaegeuk Kim
2024-01-02 22:54 ` Jaegeuk Kim
2024-01-11 3:07 ` [f2fs-dev] " Chao Yu
2024-01-11 3:07 ` Chao Yu
2023-12-10 11:35 ` [f2fs-dev] [PATCH 6/6] f2fs: fix to update iostat correctly in f2fs_filemap_fault() Chao Yu
2023-12-10 11:35 ` Chao Yu
2023-12-14 20:50 ` [f2fs-dev] [PATCH 1/6] f2fs: fix to tag gcing flag on page during block migration patchwork-bot+f2fs
2023-12-14 20:50 ` patchwork-bot+f2fs
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=20231210113547.3412782-2-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.