From nobody Fri Dec 19 13:29:05 2025 Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) (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 2071C3B8D43 for ; Sat, 6 Dec 2025 10:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765017260; cv=none; b=Jy6o29Ypbd3XfeMcz9KQPlPjJ1pAIBfMfpFCgKMUNSS+C23H0LAv92WNrnErYIHYjTLnOMcDZK9TrATx4UR7x3qMoM9Z/rEWdNGW8fqQpIK2tF4Hf4hRHZrQoZ9m/LFy/7mNMaUuhRf17z3YNHAg5a3Gl6MmhNBQSPjroxpv1UE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765017260; c=relaxed/simple; bh=YYFeMbcfEC1DPzkXiGCYeaBD9ix59lgbMidCt3uW31U=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=WghS5ywB5RfmmLBP42hq7PVmtcs0Z9n2e23G3JwYpbbmhLlU1hN96icBF2bR27Uv3wuv5qOb6izcuEM5t435aL3r1lgIQDCxbYm+zTICzq/INRo7j4FPtrQ7tM5iCmSvOF1vSextQNVtgaF09+zRw7OHWmA5JABLoehXkQCIerY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f71.google.com with SMTP id 006d021491bc7-65747d01bb0so4379719eaf.0 for ; Sat, 06 Dec 2025 02:34:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765017258; x=1765622058; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EK5gfKvoYGBAhkQUvSP2VchuZzQJQ33v4i6x03w1gAw=; b=iVsZE1VIuEynk/Urzny155AnRq2qoKih0oJSfYa4rdda0gnTqdujATsjLRZynWUBpu WgncVpp3NBCPuysloRCyLZsZ8L7AEZJRvBahCcEFUupNknaVFYW2orAKTn+rESLVkT+t DuzP+ZTzgS1GTKdmc16bCNTQQFfGlGJl496bovPXAc5K1rMxstT1oZPA05uwo8/LROl9 IZ10YZKKQswb0JsE+QnuRVn1AYWA/t8LcopepeBB7axiJtKRTinrqi+IXKVQeKacTaP+ zyYHLPoIHomi+GsqpVruJdWXkGDWNZdjntrzgybPxw3WOx7xLTXcqNqG46wRXXMYzaBR uk5g== X-Gm-Message-State: AOJu0YzEtRe6/HAg9A3VkrdXiKmrlL2sQXgXYdQ4tpjCJTgQCRP26E7V V99n5j37cYn3JptlZmHfBHLNEXD55yOksTv5iiQAauHjRYTr7ZbLQhXaws1aRjVCXPYjO7O7RHN wj/d4EMTUQ4z/N7mPU6Os32FypQY6JGINYvAEk5hPf13vjUIpVvTh+PNSFt0= X-Google-Smtp-Source: AGHT+IGEMO6IQstl987pJN5ExVi4wJIc6CPv1l2c+B4tKJdSM5Vg5AxhldRCqCXJ540cA3Ug7vuY7gUwZcJ1WA9Op95prVgS2+5T Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:2295:b0:659:9a49:8eba with SMTP id 006d021491bc7-6599a9630afmr891384eaf.62.1765017258290; Sat, 06 Dec 2025 02:34:18 -0800 (PST) Date: Sat, 06 Dec 2025 02:34:18 -0800 In-Reply-To: <69332cf9.a70a0220.243dc6.0011.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <693406aa.a70a0220.38f243.0022.GAE@google.com> Subject: Forwarded: [PATCH] f2fs: fix infinite loop in block_operations() on CP error From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] f2fs: fix infinite loop in block_operations() on CP error Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master When IO errors occur and CP_ERROR_FLAG is set, the retry loops in block_operations() can spin forever. The sync functions (f2fs_sync_dirty_in= odes, f2fs_sync_inode_meta, f2fs_sync_node_pages) may return success even though dirty pages remain due to IO errors, causing infinite retry loops. The hung task traces show: f2fs: block_ops check DIRTY_IMETA=3D1 f2fs: block_ops retry_flush_quotas cnt=3D0 f2fs: block_ops retry_flush_dents dirty_dents=3D0 f2fs: block_ops check DIRTY_IMETA=3D1 ... (repeats forever) Add f2fs_cp_error() checks after each sync operation in block_operations() to break out of retry loops when the filesystem is in error state. Reported-by: syzbot+4235e4d7b6fd75704528@syzkaller.appspotmail.com Signed-off-by: Deepanshu Kartikey --- fs/f2fs/checkpoint.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index bbe07e3a6c75..a6f831ed3d9b 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1236,6 +1236,8 @@ static int block_operations(struct f2fs_sb_info *sbi) f2fs_do_quota_sync(sbi->sb, -1); up_read(&sbi->sb->s_umount); } + if (unlikely(f2fs_cp_error(sbi))) + return -EIO; cond_resched(); goto retry_flush_quotas; } @@ -1247,6 +1249,8 @@ static int block_operations(struct f2fs_sb_info *sbi) err =3D f2fs_sync_dirty_inodes(sbi, DIR_INODE, true); if (err) return err; + if (unlikely(f2fs_cp_error(sbi))) + return -EIO; cond_resched(); goto retry_flush_quotas; } @@ -1263,6 +1267,8 @@ static int block_operations(struct f2fs_sb_info *sbi) err =3D f2fs_sync_inode_meta(sbi); if (err) return err; + if (unlikely(f2fs_cp_error(sbi))) + return -EIO; cond_resched(); goto retry_flush_quotas; } @@ -1280,6 +1286,11 @@ static int block_operations(struct f2fs_sb_info *sbi) f2fs_unlock_all(sbi); return err; } + if (unlikely(f2fs_cp_error(sbi))) { + f2fs_up_write(&sbi->node_change); + f2fs_unlock_all(sbi); + return -EIO; + } cond_resched(); goto retry_flush_nodes; } --=20 2.43.0