From nobody Sun May 24 21:39:30 2026 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.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 B82852701DC for ; Thu, 21 May 2026 09:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779354202; cv=none; b=bnlX/LRLgk4zknyqqPGXfPW51MqPETVylkHoc3nb+UbAeyRpCvsVW0XKP+TVikRJ7Ktu1NVczf0lHyFmTwCugrzsUMkDNE2vq4PP9aQa6pFwF4NCEAOLURVcobAMs8wbhZb8Ah3wpCn2eHfty2sX0eBGytKJE8nU26KUc5EeTnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779354202; c=relaxed/simple; bh=F35SmdyEn18w0BwvL6c6gUMjea29dQocEzBliAspxpY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CdTqOblYj5DAqGRR+vAWTGHmnNJIHH6Uz5zd+GjU3nVO52m+lYLp/TU4XHvs3uRfOrQoVjhE2FZoMjke+ALAwQJ13FuwlnE1iaxTQZPHlH+w2Ze9ZcazYQ0y7f5c2nNkm8Fc8YTIG8mmI+4TRaQHk5UOwB6JRKU0rCCavgh9NLU= 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=UwZyG5vl; arc=none smtp.client-ip=209.85.214.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="UwZyG5vl" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2bd2c147abaso34914895ad.3 for ; Thu, 21 May 2026 02:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779354200; x=1779959000; 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; bh=lMOEzf7qD9FCwd1qxFHb+6cxh09diPSf6meFFWcrdgY=; b=UwZyG5vlDpeEMJiOiAv4Md2Uj++9QbuzCV7RUkPTUjsQVoYpZgZCqUg7KRKEmy7rZD 6Z3cN6KuS1QsPWQEhVOuaVWy8+rsBw558i1XcrnpahfGgqBErJVL378kqZPWvpXWjNJS 4ixFszgm3tA96CvJ9Uc/gpODZH7LMuSX7HWgmMInZrt/JlVMY6j9Wsbfvjvev7dMTDK1 ieMkcZIRfHBT4hWt61EquHPVKgwXppQVinGgQ1GlKNPUoAzRlK1zPZIta+/DCRp3T5xS sCiD/f57vLRb/3BsZtE7O2Oz3zceRoT9nb8d9a8rjp0q2j45BDkb24fjcvsyWZzZhNLu OKng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779354200; x=1779959000; 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; bh=lMOEzf7qD9FCwd1qxFHb+6cxh09diPSf6meFFWcrdgY=; b=sZOvbye2NB5vmK+t6fBK+DMgPsMbipYQdGc56v91o40qP7Rp2oWSZq7V4eAxdJCKBb 6/QuFZHYBru5zi+phY6Zih+3ypdSn7vePiZz+/dHGltmDUq97lGHHVFFT4KGvGh4LHu/ lx3PKA+6eTzzdmRbw+cAAngauy8+jTDl4HCU3uRQ5EIIkqiRbUJUz6q1rlOIqpj7WZA/ 0yTOUlOfEbRbqmav8wSVlTyiriQ2kPzc/ba8AjiHrFCrEzw+QEzvgOx0EiTY5QsIwhv+ Al4C8xKcdzeV8zaSYf1FyOo/TmJ8oVu52Ys3ObdHvZQ73p+i860bxNjDBRxu34mHTMvl 2dFg== X-Forwarded-Encrypted: i=1; AFNElJ966QU8K7tRQ3H9odS1PD3itCGUXzQrklmDWNm4tNc3fwRJSolEiWotaGd7kAP2R6Rf6O4lSw8F1wjBkUs=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2IPrgOaT4hYc5E22lCgolyn9YO+Cg7JD1bFDMkfFlp06omNAt UG5gVE4gSTs80De8tXIkNJJtfz7VHofMvxAW2Ot1sc99+4LE69CVgzrY X-Gm-Gg: Acq92OHPQs5/Pyrv+5xVf4UKsD9hVSMu47EFNAimGnqxrumbBjiC5VJS+2M+rblyDE0 348aTDaBFxC8C/M16nUe0L1Hpa6cu982wZvgpMwc8S6w5om5u+RckbFqiu5JUHOtOYiZoxTJKYK VaneDzRAatrt+CbZ/T9ALobqZV/mWTDA93RgXaewxTdsMV8u/RIEYCM89PJ2zmuZZD1C3GVQUle G3ogQ781EddxflsO4lMyPMHtOqQ7y9kGUP3dlgRe9Ogc+FmBId3rzdpER/rEbO2Wl3GdOSTXnGN rLEMFU5qCz5ukiw8onZxoBnXtMWcF3WktZKW6vvDL0yG+T9YQdqjv+dROdtMmkygnpDNlsHeoem eCSCwn9bwqr27BKtTNg6lGAK7SrUwT3sfQp2rXSd6GNlZOyS+E9ODO57DNvcgHQmEknFVAmivxK atQgFZDPNtPoV7T1p00ywjrRokzfmsBAf2+cDhIrKPMsW/hhWsFrgYeO/2bC3EJAfNW5oU/e5nA bV8Spah X-Received: by 2002:a17:902:c94f:b0:2bd:2de3:5181 with SMTP id d9443c01a7336-2bea2fc1cc0mr19850435ad.9.1779354199829; Thu, 21 May 2026 02:03:19 -0700 (PDT) Received: from qiwenjie-ThinkCentre-M760t.mioffice.cn ([43.224.245.241]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bea9174954sm4239855ad.16.2026.05.21.02.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 02:03:19 -0700 (PDT) From: Wenjie Qi X-Google-Original-From: Wenjie Qi To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, qiwenjie@xiaomi.com, qwjhust@gmail.com Subject: [PATCH v2] f2fs: fix missing read bio submission on large folio error Date: Thu, 21 May 2026 17:03:13 +0800 Message-ID: <20260521090313.1918698-1-qiwenjie@xiaomi.com> X-Mailer: git-send-email 2.43.0 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" f2fs_read_data_large_folio() can keep a read bio across multiple readahead folios. If a later folio hits an error before any of its blocks are added to the bio, folio_in_bio is false and the current error path returns immediately after ending that folio. This can leave the bio accumulated for earlier folios unsubmitted. Those folios then never receive read completion, and readers can wait indefinitely on the locked folios. Route errors through the common out path so any pending bio is submitted before returning. Stop consuming more readahead folios once an error is seen, and only wait on and clear the current folio when it was actually added to the bio. Fixes: a5d8b9d94e18 ("f2fs: fix to unlock folio in f2fs_read_data_large_fol= io()") Signed-off-by: Wenjie Qi --- Changes in v2: - Rebase on current jaegeuk/f2fs.git dev branch. Tested with a local-only fault hook which injected -EIO when f2fs_read_data_large_folio() had a pending read bio but the current readahead folio had not been added to it. Without this fix, a 256MiB immutable file read timed out after 20 seconds. With this fix, the same read completed without hanging. fs/f2fs/data.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index bdcf396038f8..9c6440a7db0e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2529,7 +2529,7 @@ static int f2fs_read_data_large_folio(struct inode *i= node, unsigned nrpages; struct f2fs_folio_state *ffs; int ret =3D 0; - bool folio_in_bio; + bool folio_in_bio =3D false; =20 if (f2fs_compressed_file(inode)) { if (folio) @@ -2645,18 +2645,17 @@ static int f2fs_read_data_large_folio(struct inode = *inode, } trace_f2fs_read_folio(folio, DATA); err_out: - if (!folio_in_bio) { + if (!folio_in_bio) folio_end_read(folio, !ret); - if (ret) - return ret; - } + if (ret) + goto out; if (rac) { folio =3D readahead_folio(rac); goto next_folio; } out: f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA); - if (ret) { + if (ret && folio_in_bio) { /* Wait bios and clear uptodate. */ folio_lock(folio); folio_clear_uptodate(folio); base-commit: 520760b9f9156bf9698de38dc44c614fad68a1f9 --=20 2.43.0