stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: get out of a repeat loop when getting a locked data page
@ 2023-03-23 21:39 Jaegeuk Kim
  2023-03-26 13:47 ` [f2fs-dev] " Chao Yu
  2023-07-17 17:34 ` patchwork-bot+f2fs
  0 siblings, 2 replies; 13+ messages in thread
From: Jaegeuk Kim @ 2023-03-23 21:39 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim, stable

https://bugzilla.kernel.org/show_bug.cgi?id=216050

Somehow we're getting a page which has a different mapping.
Let's avoid the infinite loop.

Cc: <stable@vger.kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/data.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index bf51e6e4eb64..80702c93e885 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1329,18 +1329,14 @@ struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,
 {
 	struct address_space *mapping = inode->i_mapping;
 	struct page *page;
-repeat:
+
 	page = f2fs_get_read_data_page(inode, index, 0, for_write, NULL);
 	if (IS_ERR(page))
 		return page;
 
 	/* wait for read completion */
 	lock_page(page);
-	if (unlikely(page->mapping != mapping)) {
-		f2fs_put_page(page, 1);
-		goto repeat;
-	}
-	if (unlikely(!PageUptodate(page))) {
+	if (unlikely(page->mapping != mapping || !PageUptodate(page))) {
 		f2fs_put_page(page, 1);
 		return ERR_PTR(-EIO);
 	}
-- 
2.40.0.348.gf938b09366-goog


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

end of thread, other threads:[~2023-07-17 17:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 21:39 [PATCH] f2fs: get out of a repeat loop when getting a locked data page Jaegeuk Kim
2023-03-26 13:47 ` [f2fs-dev] " Chao Yu
2023-03-27 15:30   ` Jaegeuk Kim
2023-03-27 16:22     ` Matthew Wilcox
2023-04-05 16:39       ` Jaegeuk Kim
2023-04-05 20:47         ` Jaegeuk Kim
2023-04-06  1:50         ` Chao Yu
2023-04-06  3:18           ` Jaegeuk Kim
2023-04-10  9:57             ` Chao Yu
2023-04-10 23:24               ` Jaegeuk Kim
2023-04-11  8:49                 ` Chao Yu
2023-03-30 13:23     ` Chao Yu
2023-07-17 17:34 ` patchwork-bot+f2fs

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).