From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 1BBF1391845 for ; Fri, 17 Jul 2026 10:40:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784284816; cv=none; b=Xz6hrTowOkqzUclss2pnC2XywsfIK9Mau/6ZfFcw2uM7sEMutv9+QXtRuWCRzESHAF7h/CRgVuO8s5ypluv+HA5u/oqXt0J9HODXToucGE0++UTQSDfG3VOkYfsoCMQdIn5b84f4LgBBBVbt+tt++ygz1TPGQ6eWlCGD1t8ef2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784284816; c=relaxed/simple; bh=hRp7ZDSj39hQz+qZSkot6zSokk47V5imHaPDTgeAMX8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sQqM79D1y5ATYstx/gHHGSgbB1kPzwZSZy4ltYNqtseANITZ4v5nooOcqENO9jx4GuwG58t26Ol+4OX6HyVZ4WK8n5UbKLARBB1S5PUAAKp4QseEIp+it0uqov220OksriumWSawPWg1nx/rcuWmRvzUlG5UZ7rcQczZwql9HpA= 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=rsV9cVD1; arc=none smtp.client-ip=209.85.221.45 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="rsV9cVD1" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-4759b4f0897so2403767f8f.1 for ; Fri, 17 Jul 2026 03:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784284813; x=1784889613; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=hRp7ZDSj39hQz+qZSkot6zSokk47V5imHaPDTgeAMX8=; b=rsV9cVD1mGeScW+zNSaz+w+szoRPAlpAljuwAsVU9GQrfucabWAF/knsdjUNwGm4/C 6WUTYhaQ0Gd2o4f2BdB35YyGgPotRF91VfF71SwzbpMMoxEggjF1ZNeC7c0btngx7cdO Sl1Fv+gd3psjMpEKE4gNNufOquBDdq0A+DIpOgoHQdXU6R4/gM8TANCfJNv6Th36gWjK dwjxGEA+U0H/CyQd0DlW0vu5eLNz5bW9QQp1aUmKmDj0ecdIEev3lMKo6jMOgj0Pn4FP NJaMeHbpwVqTRgdjnVuzm8+qBxy4Pv/Ggxmzht3fvQIGwnGfUnMox/qvR6I5qeivJIEU hMhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784284813; x=1784889613; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hRp7ZDSj39hQz+qZSkot6zSokk47V5imHaPDTgeAMX8=; b=Hv+di2q+qSehfq0KDFeAkEgyYbEZf8Pdaup8PhEtQEl7y9Chs/e+bxS8ZFLNwiPinm xK6LFy7zJKp+H6WbDKvIHSxW02MA3LZSZo+Z58Ntufn8dnT1CODsRwJXQct/Y7XYIlxp l3vpYUqmiiLc6wNdciMK0zdwHr27MxqryAw+oEVvnBBXL5aGH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6ZeyRoWuowkNCeT9ZPA2 n/s007/Hsa1Wn X-Received: by 2002:a5d:5d08:0:b0:475:5e4b:588e with SMTP id ffacd0b85a97d-47f6230cacdmr2744381f8f.20.1784284813109; Fri, 17 Jul 2026 03:40:13 -0700 (PDT) Received: from localhost (90-182-112-124.rcp.o2.cz. [90.182.112.124]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63e496ffsm2853619f8f.3.2026.07.17.03.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 03:40:12 -0700 (PDT) Date: Fri, 17 Jul 2026 12:40:10 +0200 From: Joshua Crofts To: Ryusuke Konishi Cc: Viacheslav Dubeyko , linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+cae54346a70bbceeff2c@syzkaller.appspotmail.com Subject: Re: [PATCH] nilfs2: fix infinite loop in nilfs_clean_segments() Message-ID: <20260717124010.00001374@gmail.com> In-Reply-To: References: <20260717074710.1397-1-joshua.crofts1@gmail.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 17 Jul 2026 19:34:21 +0900 Ryusuke Konishi wrote: > On Fri, Jul 17, 2026 at 4:49=E2=80=AFPM Joshua Crofts wrote: > > > > syzbot reported a hung task in nilfs_transaction_begin(). This occurs > > because the cleaner ioctl falls into an infinite loop if > > nilfs_segctor_construct() repeatedly returns -EROFS (e.g. the device > > is remounted as read-only after an I/O error). > > > > Currently in nilfs_clean_segments(), if err is non-zero, it logs the > > error and sleeps but doesn't abort when it encounters a terminal error > > like -EROFS. This causes the thread to loop forever. > > > > Fix this by breaking out of the loop if nilfs_segctor_construct() > > returns -EROFS. This matches the behaviour in > > nilfs_segctor_write_out(), which also handles -EROFS. > > > > Reported-by: syzbot+cae54346a70bbceeff2c@syzkaller.appspotmail.com > > Closes: https://syzkaller.appspot.com/bug?extid=3Dcae54346a70bbceeff2c > > Fixes: 9ff05123e3bf ("nilfs2: segment constructor") > > Assisted-by: gemini:gemini-3.1-pro > > Signed-off-by: Joshua Crofts > > --- > > As much as I've tried, syzbot is unable to test this and always fails > > with "FATAL: Kernel too old". Nevertheless, I've tested the patch with > > the same reproducer in QEMU and the system didn't hang. =20 >=20 > Thanks for the patch, Joshua! > This fix correctly addresses the issue reported by syzbot. >=20 > I have one request regarding the loop exit: > Could you modify the patch to jump to the out_unlock label instead of > using break? > This is to prevent discard commands from being sent to the underlying > block device when the operation has failed and the filesystem state > has degraded to read-only. Yes, no problem, that makes more sense. Will send a new version in a bit. --=20 Kind regards, Joshua Crofts