From nobody Mon May 25 00:08:42 2026 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 CA6E53CA4AD for ; Wed, 20 May 2026 09:52:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779270735; cv=none; b=VNiQeP230GjJ56O1oFUcneKJslWyrI50s3y8pk/fuMjPfsp/bPJ0qwE0/I5rgV939EZGTsiDh1zqvGullWr8yFBNX2MxrZ2d7pM1EZeSfjc8t4pbgu53fWfpNOUFjy19jGhl+YHJD+qV63TmM77DTT5YpbdcqSVo8Yd434+7xAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779270735; c=relaxed/simple; bh=Fkzrt3ZboqLWldlHF4NGHW4RaNopkSOEvtsuf9kBAN8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NDMuOGRRBnAAwxoNXngueaxQ5XrynSeHMEqPcLTIftSJTXO1X3GzEgtmDRA72z85AsPxSU5kjCAL5yBjaNcaYuY/DWPib4pOOaiBq1qlLJnnhioiWQmpD7NhkEd3rjCLn8bymqY5dW+mx2MvH7hBftDQeOZwNUEWW7INpD51hBg= 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=ns7SyVm7; arc=none smtp.client-ip=209.85.214.174 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="ns7SyVm7" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2ba856db1c0so33621545ad.3 for ; Wed, 20 May 2026 02:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779270733; x=1779875533; 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=V6OcltrWyb15hOrMY3XyGG9Zyef0yGghWRp06lziU4o=; b=ns7SyVm79Uh707Ns+0nHzk5/sAAXi2BK6lxsp3G4ajFFdfHOmV2Kvuy3CNsYEBr8WL t1WBjXeaKlFtM8ar3gz2j/AcYOw/nrSI720eNncjy69WCT4wFqg2PZvpC9MzVRmO4UZJ GeCdBiqdIl+5+mwQdmxYbsi0xRx2dWb6hu2eqVk8QpnrswaMr3oXu6OhvXm79sd+eBqJ X3WBa0D3/4FougzNfWZCfiPbDgH7CYuQagenhCbmEx2NtfzrVu8BBusOAmjY3Wmuk6CJ gIDOpXDCTOudzNzVElvI16F9A1RIBFejrzckLnUfyK2rNDucGYL5/gGoflc09w4BNnHu nt0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779270733; x=1779875533; 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=V6OcltrWyb15hOrMY3XyGG9Zyef0yGghWRp06lziU4o=; b=b6jeSyau2CXpplqbLsKd30scONW+zL8eZcrLoIVzkcbxplrY37fCjZ8hwEjPVIMale EEDWc+1GwZNfPgtHhuk57Krot3kOSwtPahyV8py+DUhOFz5xOPgHEh+inIdbElyvuV4/ yBXNqPASg4kaSRb2oX3WFcApgaUpV5pcxM9XNhHiTKo8Z4gaI86sFAzHycjmS3+pjyRa 7z2BCGAgfW0mYary7zDUHN8ozNptP0p9nvGM9D7IVl2Wrf9BEpf2/Kar1Jqb3yyzbKWQ 9l+NyfjEAnf8r0FgJo1JZMNTD9aNd7B5pMV6mTZZ+1Ezo4o8Q75djx8fjg34iSdfr/Ga jr4w== X-Forwarded-Encrypted: i=1; AFNElJ+YhQEd7aerBtw9epTIqMqxZA2uvSe0l5yWiqZ+COMP4c0ZqHa/wf2S6l+o6xip322vQVLuDnaF73iKPXE=@vger.kernel.org X-Gm-Message-State: AOJu0YwoY9I7yGAGvyFRNaCBUcyY3xfdpLxJoHC9zxrv+9rez5upZgqD ys3iPqlNpPXpfmcfZonuDOvMbMm/Se2xfhpstpAUi4rbQOh1Lnqs+6PJ X-Gm-Gg: Acq92OH0CIArwX9hNBUDdjCtg4NcSYS0pDcWNFLpdUvTUjznwJ3DDXTvUOdtnn6oIGP Qf63+lLyFTV0glTYqSXYwEl8iope0e9OriE5m/yKW/JCyjOQc4pLzGpvBloRYj7Emktk4+kbfu0 4tfX3+aLlnB7nCvCstf50o2VIYaYdu75ykHpyN/eL5eksEgxkFuxg4lKD8fzGBulwegWa0JxTnq 4xcZNT0iJaLBp2Nq27+yJ3vvVCVWfUMBvRZxwFkBqIjcPUm5qhlVnYMFoSpJBuAjs1jGwShBVLV Dm3qgZjcK7GcN6052jr90KuP2Lh9shfV/REZX4Z84P8QEBlhuEsPVmRiTev0j3WejJk7rEYaXzs CuxfRqi/9dKoWdFG897Zz/hBpl4vL8uYwh8re5nRrKVQWMp3WGiemvYMpKTgG57HmiVDndGeEok ROEniIz7aEV083lkzoAp6nCTs8/x+FFqcaEzz31p8yEUYmP/VzYTp9iw0A5+YZ6njWkUk= X-Received: by 2002:a17:902:f08d:b0:2bd:2051:13ed with SMTP id d9443c01a7336-2bd7e87ef1amr164409155ad.23.1779270733069; Wed, 20 May 2026 02:52:13 -0700 (PDT) Received: from qiwenjie-ThinkCentre-M760t.mioffice.cn ([43.224.245.179]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5cfe498asm218656325ad.39.2026.05.20.02.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 02:52:12 -0700 (PDT) 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] f2fs: fix missing read bio submission on large folio error Date: Wed, 20 May 2026 17:52:04 +0800 Message-ID: <20260520095204.1175117-1-qwjhust@gmail.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" From: Wenjie Qi 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 Reviewed-by: Chao Yu --- 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 8d4f1e75dee..836edb7899d 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2495,7 +2495,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 (!IS_IMMUTABLE(inode) || f2fs_compressed_file(inode)) { if (folio) @@ -2611,18 +2611,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); --=20 2.43.0