[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250723101825.607184-2-chizhiling@163.com>
Date: Wed, 23 Jul 2025 18:18:23 +0800
From: Chi Zhiling <chizhiling@....com>
To: akpm@...ux-foundation.org,
willy@...radead.org
Cc: linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Chi Zhiling <chizhiling@...inos.cn>
Subject: [RFC PATCH 1/3] mm/filemap: Do not use is_partially_uptodate for entire folio
From: Chi Zhiling <chizhiling@...inos.cn>
When reading the entire folio, we should not use is_partially_uptodate()
to determine if the folio is up-to-date. If the folio is not marked as
uptodate, then it is not safe to treat the entire folio as up-to-date,
even if the partial check returns true.
If all data in a folio is actually up-to-date but the folio lacks the
uptodate flag, this could cause issues during pipe reads
This change adds a condition to skip the partial check for the entire folio
case, ensuring that we only consider a folio as up-to-date for the entire
range if it is marked as uptodate.
Signed-off-by: Chi Zhiling <chizhiling@...inos.cn>
---
mm/filemap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/filemap.c b/mm/filemap.c
index bada249b9fb7..af12d1cecc7d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2446,6 +2446,9 @@ static bool filemap_range_uptodate(struct address_space *mapping,
pos -= folio_pos(folio);
}
+ if (pos == 0 && count >= folio_size(folio))
+ return false;
+
return mapping->a_ops->is_partially_uptodate(folio, pos, count);
}
--
2.43.0
Powered by blists - more mailing lists