From nobody Fri Apr 3 04:33:01 2026 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 660D120468E for ; Wed, 25 Mar 2026 04:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774414003; cv=none; b=hAlvQy72AwAZChkAS70PAW9Bp0x8q04X3HNxTlXqmxQqRYTS5erWGzsiMOFsEkIMIqNWOL8Dd9eEQS0RPBmTSm2BJO7KQUvUGX9EDCA5gtO9B9kBzLdfy25jKl6uleZ+0jj7a2FxNUPV+cWm2mngX2/5bmiIuL3n4ylz1NBGZ0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774414003; c=relaxed/simple; bh=GKEHtPdW5KblQGnS6nhPv3FYJXdNOAVvnJalAZnQG/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t5jKERRkVI9X7Ct4SV8xaQsk+Ys05YH8NCIdMDpF3KL1PHU7laazw3fcOYoV+oUqaVPFPr6SjJCbeo8FHIfQJpLQHCKOa9vDz4TbctbW0TK1zrnj6reC09pY5Hcs1p7WwXgEx207skCyleddWYRgxOp8GOul/FDWrS4ltVGlM/I= 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=NS98mHi7; arc=none smtp.client-ip=209.85.215.176 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="NS98mHi7" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-c739d32b72cso4252284a12.2 for ; Tue, 24 Mar 2026 21:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774414002; x=1775018802; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i6/CVpwIhPr8zasCLwcjOrK1yge0U6dAlZZzuCLY914=; b=NS98mHi7Dlm+ul8uMMhAMQn/7dGHune4HpEm7MjmZFeJqN+YkjxnX70CFPGrl2NC9o bf2b4AvmNEJ7nZPnLl/E1WeppYF8QH/Jg5jCeWX7/CpGLPsBFcgJag+3U6j2euOJkVKq 29T/W66gTgQxN1k3x2e2lUy9VzIVSDeb+cBABCFBG7OO1rtNzxqwOBTRXz1D/wDasC9n H3SkCqwJiE6w7wugh828GmdvRuT5YJYUzsBZ3sADida5awu9dDpkLNcyLCbXVAu1bRTQ GXW8w8nbp4W9yDdQnDjAhf8SdDs8M8/mL1i23+5/lw04t37QiKyz+/WiI1xvAKUG1TZP ecuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774414002; x=1775018802; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=i6/CVpwIhPr8zasCLwcjOrK1yge0U6dAlZZzuCLY914=; b=ep6dMkSRKxMp+mDJ6ER0n8P/M7vOVaJNDPZ+3iW/FNK7QjExaUZDONP3JjHqk7IpJT WQslihSNOA8QR0yjb5K0FWMc+M3ny6/Gfa/bjUXU/K/hk1a8jVmCqH07r4fJau1dzua2 2rIWcPhM9CGQrTkaATU2mYq6qBktk0lzSo7zqKycRPqeEVqKV/zpe8eBAwg1gOaersbQ HZ47PebQACMbK4p26VuZdpn2zVuEOnuZwL7McRjjP9kuQYsSJz3mAihUdx+++6ZzMC2S TKKlVSHShNuzLS76rYQkhd/XdnUELyGl6vwqJpco6fc5CtSTgSnA+dkrFsR+WGkdG0+H 4Cxw== X-Forwarded-Encrypted: i=1; AJvYcCUFMtZj50ibjWPzj/r9eHT4oSi55OnFvtG+1szMbT6yu5yA3fUjNJDt+DnvKnvVIN+p8cMPn1OKDnVb1vU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw93hMseOwJiDgQ9ln1rMc/PQnwCunaibJwYKMFk4AoL/NX59HQ AbHwJmn6pfZwWWwtaz1H4IqygSQQrx2UnMY8oDskFtdgu3QeWli1vSVE X-Gm-Gg: ATEYQzxvJHKvfCfey/U3RBVJfeCCGBLI6I6RwFhBrPv4d8nXGgACnQS2CUGirT6eCPL t+bZrSnoloO215ehfAwN7HOZyBKDl8yanso+VOfRpBEhhUdMwasJ9GoC0tpTPlwoKbusExQ/e9Y SJ/NqDVkf3baYYsaMqAVIlMPFAC4vLhHZMZ79BEhC3LtPpMwdxQdDj61Kr+u9wxM+pWK9LgmWHx /YYHvi27ynyFry416hNx6C0LEilP0ZNNJtPtEbkvrpZobFq+Kut2faPvipn7lhrJpRm3m6sLtmr 3ZUDI7HxrQaUK8AnRE1ZA9SmamU0wiU+OjPuJpE3SHsoV+ix7W1OciSKSy0YYrFw36eT7rpfTtZ QDaPyb4uVO/jvKLFhYLha3f/Fg96KWbIxjUlUyxUkLi0X20yk9qrMlgQ3lz4N6aNPLpszHoXCf0 o19No+wTMYYVOlIYPQQEBUBivv+nLNDi+S X-Received: by 2002:a17:902:ea0e:b0:2b0:afad:7ab8 with SMTP id d9443c01a7336-2b0b0ad2382mr25079135ad.29.1774414001613; Tue, 24 Mar 2026 21:46:41 -0700 (PDT) Received: from ArchDesktopLeo ([2400:a840:5c41:0:e012:ea6c:986:40a8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0b0975da7sm14784405ad.44.2026.03.24.21.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 21:46:41 -0700 (PDT) From: Leo Timmins To: Pasha Tatashin , Mike Rapoport Cc: Pratyush Yadav , Andrew Morton , linux-kernel@vger.kernel.org, Leo Timmins Subject: [PATCH v2 2/2] liveupdate: initialize incoming FLB state before finish Date: Wed, 25 Mar 2026 12:46:08 +0800 Message-ID: <20260325044608.8407-3-leotimmins1974@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325044608.8407-1-leotimmins1974@gmail.com> References: <20260325044608.8407-1-leotimmins1974@gmail.com> 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" luo_flb_file_finish_one() decremented incoming.count before making sure that the incoming FLB state had been materialized. If no earlier incoming retrieval had populated that state, the first decrement ran from zero and skipped the last-user finish path. Initialize the incoming FLB state before the first decrement so finish uses the serialized refcount instead of an uninitialized value. v2 - now uses pr_warn instead of WARN_ON Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound g= lobal state") Signed-off-by: Leo Timmins Reviewed-by: Pasha Tatashin --- kernel/liveupdate/luo_flb.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index f52e8114837e..855af655b09b 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -192,10 +192,27 @@ static int luo_flb_retrieve_one(struct liveupdate_flb= *flb) static void luo_flb_file_finish_one(struct liveupdate_flb *flb) { struct luo_flb_private *private =3D luo_flb_get_private(flb); + bool needs_retrieve =3D false; u64 count; =20 - scoped_guard(mutex, &private->incoming.lock) + scoped_guard(mutex, &private->incoming.lock) { + if (!private->incoming.count && !private->incoming.finished) + needs_retrieve =3D true; + } + + if (needs_retrieve) { + int err =3D luo_flb_retrieve_one(flb); + + if (err) { + pr_warn("Failed to retrieve FLB '%s' during finish: %pe\n", + flb->compatible, ERR_PTR(err)); + return; + } + } + + scoped_guard(mutex, &private->incoming.lock) { count =3D --private->incoming.count; + } =20 if (!count) { struct liveupdate_flb_op_args args =3D {0}; --=20 2.53.0