From nobody Sat Jul 25 00:10:53 2026 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B99446D2A3 for ; Tue, 21 Jul 2026 16:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784652481; cv=none; b=ivEhvLuNTpRiwkFHUx6m/+as1+ZMrCLnXar5pQaB70gxjY1XhXX9WkNmvi1VLMkT0ZG/9cZ+P9QTnfn1ip5JkLhw85i92xgzI6p3R/wde8gIRx0BuRz9gFWFXZKZM60G+1/QrGfh0AVGbUWUESqSK9Hzb4lJ1APXWNaFpMKf6zY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784652481; c=relaxed/simple; bh=zU3SHSNtlh6iRlKpu4FIBcqI1XLxDvPM4GqbKIiucMc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=s5fxZLwhBHjl/7tFIZ1ndwsqEymjH3iP6zbDL4y35vNflS8dir9XEZ5MShQC/2aDE89QaQELCVQu5QVZANXkcu39gNfPiX6cAb0m+TpmQdSBtiAiGNQNsqqjcWtKgzVhAsNWrTURRsvh//YPcaPEkmmo/6HoLjY0bTtXBKPRds0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ixB/DsGn; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ixB/DsGn" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c9e0b89e228so5342249a12.1 for ; Tue, 21 Jul 2026 09:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784652477; x=1785257277; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=inz+NczIyfD75/aT4SMO9AaIVsqUIFXw6/sFSpbA0SM=; b=ixB/DsGnqk67NWkvZhwKSC/IFW5y1+XQMgg67sfFH7uAcTXKAKHmrOdmpETt1cggfW WhAR0393sQzkCQ48igRov4bsabvTCgiP0yWxxR7WrL6zhSV7JhTRLm7uzdQcotbAgOGR e8OYUuyzY/5AFTf+aeZyXwlQVamck23p+BHfDXwQTAXP+BX3FqQF2pgdNaun6xdoipWz kWdYpw0l9civsS/BZfFg75YVFT9rsDh+xgmYYl8ftw7FWl5l8JjK0RpL0LscCjjsOVn/ gTjN/ftvUyqY2RzisTVDW9Ykha6ScEmE+4P071WT/gwlCdBli6auRLjga78kKNgwm53W ZpQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784652477; x=1785257277; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=inz+NczIyfD75/aT4SMO9AaIVsqUIFXw6/sFSpbA0SM=; b=DEiKaXX78UTxBSnkHpm4ChZ+BFWhQ1eeGh+Z2Wrx+V05tzjQZzjAGEo73HuT4U70J/ P0H4lDu2KFl667BB4RUYZgrdFc6ObO5cJcUPdQJhhAl4GKjeEfEUyptzNIOSmQbxrrnW DIQVUcp+oi/G9BOVNAaNzPQ3SwlppmCBxMfIkueuzpBJrnZakdYYgw4ixvkCc3mZnmCU kerm/siMzMtvGTpiNTg5jdntAl7uPSnRU5L57YYIIznT2Zz4K6BoV4NTso6yvcbb8vQZ sEmyDq+1MGgu92EHdMByGqCENjSqGWT6axZmwGcQljQTsEm+/NK545vZQnivwDShs+RO EbyA== X-Gm-Message-State: AOJu0YyY5qQo5IZFlvcmZ1x/zCdbI/QnQDaWStevkn6Q1LOkIou2gze6 lfPERlgUB1PkuEw3QdULMyYC5rzuBije2UZwY/NrMnD6JSUM29hDADMm6tb0dw== X-Gm-Gg: AfdE7cnMf2aIodN9wEYcDt7UBowv0SVB8TbUDGIkxSaEbgLXTYv6ZiEv/p9V8z7/g2e Jq3VLF2IJx58vv0zo+rFfI+0mjoaywpUNMAG1oSTS2YShW/Z1lID16pm4jjKpgCB6ykDaiLt+Qs qXNEuSBG0/UzoIJywONZfsjcLIblzYVQVgDsP2/gptXgXx9Mwu3OKBnXp8J39DvTcxi4nesvwQs uyWo4NQnqDAQz0PHwOOwUFgVcAU1JNTVojxvN28ZqrfzMTP9IeGhmnPGRnFxvscgvLb5aJh86S5 Dj7Vpfm93Gpjus51QbT6Tm36zOno02TSwUGpdNB/s9pX0aJ3OnDslDOaxABpsGYT69uSN5LeoKU oQyuOam/6xtahsZt/OsduH6khwNuYEouOGI7fuONOpb3ug1uQaOqYsA1fHPc5GKGz5ZsJgXs5BR LLo0DyiEPVEjcLrf5VKMOEXnnwbxDvyWsRdV2azIxuP341N85FLyKNcU0GKEf00COkOYJpweyYa x7Lti3y+CxHK9N4WiQ2Optd5UYg X-Received: by 2002:a05:6a21:1f87:b0:3c3:990b:2292 with SMTP id adf61e73a8af0-3c3ad9e2445mr20674940637.57.1784652477045; Tue, 21 Jul 2026 09:47:57 -0700 (PDT) Received: from daehojeong-desktop.mtv.corp.google.com ([2a00:79e0:2e7c:8:911:9a85:99a8:c518]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3147e1cf8fasm479226eec.31.2026.07.21.09.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 09:47:55 -0700 (PDT) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong Subject: [PATCH] fsck.f2fs: flush device buffer before zone transition on zoned storage Date: Tue, 21 Jul 2026 09:47:52 -0700 Message-ID: <20260721164752.3853201-1-daeho43@gmail.com> X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Daeho Jeong On zoned storage devices (F2FS_ZONED_HM), fsck.f2fs opens block devices with buffered I/O (O_RDWR). When a curseg fills up its current zone and moves to a new zone in find_next_free_block(), pending buffered writes to the previous zone may still reside in the OS page cache / I/O queue. As a result, issuing a write to the newly allocated zone can happen before the device hardware finishes committing all blocks of the previous zone, causing the hardware to see an additional open zone request that exceeds the device's max open zone limit (e.g. open zones exceeded error). Fix this by calling f2fs_fsync_device() right before allocating a new zone when crossing zone boundaries (!(segno % segs_per_zone)). This flushes all pending writes to physical media, ensuring the device hardware auto-closes (FULL) the previous zone before opening the new zone. Signed-off-by: Daeho Jeong --- fsck/mount.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fsck/mount.c b/fsck/mount.c index 6f640a0..3bd40fe 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -3073,6 +3073,9 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u6= 4 *to, int left, if (!(segno % segs_per_zone)) { u64 new_blkaddr =3D SM_I(sbi)->main_blkaddr; =20 + if (c.zoned_model =3D=3D F2FS_ZONED_HM) + f2fs_fsync_device(); + ret =3D find_next_free_block(sbi, &new_blkaddr, 0, want_type, true); if (ret) --=20 2.55.0.229.g6434b31f56-goog