Linux-EROFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] erofs: fix mis-inplace determination related with noio chain
@ 2019-09-22 10:04 Gao Xiang
  2019-09-24  3:03 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Gao Xiang @ 2019-09-22 10:04 UTC (permalink / raw)
  To: Chao Yu, linux-erofs; +Cc: Miao Xie, LKML

Fix a recent cleanup patch. noio (bypass) chain is
handled asynchronously against submit chain, therefore
inplace I/O or pagevec cannot be applied to such pages.
Add detailed comment for this as well.

Fixes: 97e86a858bc3 ("staging: erofs: tidy up decompression frontend")
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---

[ Need stress for more hours on phones to catch this race.
  No more smoke out till now on latest mainline for our
  stress I/O & memory workloads compared with old versions. ]

 fs/erofs/zdata.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 96e34c90f814..fad80c97d247 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -575,7 +575,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
 	struct erofs_map_blocks *const map = &fe->map;
 	struct z_erofs_collector *const clt = &fe->clt;
 	const loff_t offset = page_offset(page);
-	bool tight = (clt->mode >= COLLECT_PRIMARY_HOOKED);
+	bool tight = true;
 
 	enum z_erofs_cache_alloctype cache_strategy;
 	enum z_erofs_page_type page_type;
@@ -628,8 +628,16 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
 	preload_compressed_pages(clt, MNGD_MAPPING(sbi),
 				 cache_strategy, pagepool);
 
-	tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED);
 hitted:
+	/*
+	 * Ensure the current partial page belongs to this submit chain rather
+	 * than other concurrent submit chains or the noio(bypass) chain since
+	 * those chains are handled asynchronously thus the page cannot be used
+	 * for inplace I/O or pagevec (should be processed in strict order.)
+	 */
+	tight &= (clt->mode >= COLLECT_PRIMARY_HOOKED &&
+		  clt->mode != COLLECT_PRIMARY_FOLLOWED_NOINPLACE);
+
 	cur = end - min_t(unsigned int, offset + end - map->m_la, end);
 	if (!(map->m_flags & EROFS_MAP_MAPPED)) {
 		zero_user_segment(page, cur, end);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] erofs: fix mis-inplace determination related with noio chain
  2019-09-22 10:04 [PATCH] erofs: fix mis-inplace determination related with noio chain Gao Xiang
@ 2019-09-24  3:03 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2019-09-24  3:03 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs; +Cc: Miao Xie, LKML

On 2019/9/22 18:04, Gao Xiang wrote:
> Fix a recent cleanup patch. noio (bypass) chain is
> handled asynchronously against submit chain, therefore
> inplace I/O or pagevec cannot be applied to such pages.
> Add detailed comment for this as well.
> 
> Fixes: 97e86a858bc3 ("staging: erofs: tidy up decompression frontend")
> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22 10:04 [PATCH] erofs: fix mis-inplace determination related with noio chain Gao Xiang
2019-09-24  3:03 ` Chao Yu

Linux-EROFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-erofs/0 linux-erofs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-erofs linux-erofs/ https://lore.kernel.org/linux-erofs \
		linux-erofs@lists.ozlabs.org linux-erofs@ozlabs.org
	public-inbox-index linux-erofs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linux-erofs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git