f2fs: zone: fix to wait completion of last bio in zone correctly
authorChao Yu <chao@kernel.org>
Mon, 29 Jan 2024 11:27:40 +0000 (19:27 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 6 Feb 2024 02:58:40 +0000 (18:58 -0800)
It needs to check last zone_pending_bio and wait IO completion before
traverse next fio in io->io_list, otherwise, bio in next zone may be
submitted before all IO completion in current zone.

Fixes: e067dc3c6b9c ("f2fs: maintain six open zones for zoned devices")
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index 65fe48bb17d16bd1394960eb8da4de0a5e42065a..ac82e69a9f5fda66cb4ab6c0ee7b8562fe81a515 100644 (file)
@@ -1010,7 +1010,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
        f2fs_bug_on(sbi, is_read_io(fio->op));
 
        f2fs_down_write(&io->io_rwsem);
-
+next:
 #ifdef CONFIG_BLK_DEV_ZONED
        if (f2fs_sb_has_blkzoned(sbi) && btype < META && io->zone_pending_bio) {
                wait_for_completion_io(&io->zone_wait);
@@ -1020,7 +1020,6 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
        }
 #endif
 
-next:
        if (fio->in_list) {
                spin_lock(&io->io_lock);
                if (list_empty(&io->io_list)) {