From nobody Fri Apr 3 01:23:09 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 C168939C624 for ; Thu, 26 Mar 2026 04:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774499198; cv=none; b=aFKCZtjSPf+hZVZJZzVTjTHBNrSCbYIcv00vsKQBovQM0HcQk1JlVyX7W7tobKUQ3ouOrq1xInGMLHyDxLSQovk5mM3Nrh1E14T+PpSFKZBwQOime42ia3QMXoXQOw43UM4OItgv1M0FmyBfpMMb3L7RBKjw4TYqG3lJowX+wyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774499198; c=relaxed/simple; bh=LfmsDSimfNLAP1d8qO95mcnTvsc3RAlnQ1lb56DFPb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kHXVIniFo6Y4nD6xXQq5BA2RNndKNs4XpPRmtyDvaqZlQYldE5MF08Fc9ycqxLjxkUNTawXr4uAoKUU2asBMLeTAN8TukVQrBHfvaviFGZd6nzPiAOvxfQPSXJLyd46T/QX7szUsgMQdH6tirazU0UET+SgPDs4NZTtA8HPess8= 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=Wj02fdEE; arc=none smtp.client-ip=209.85.210.180 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="Wj02fdEE" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-82c28f0a4ecso395159b3a.3 for ; Wed, 25 Mar 2026 21:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774499196; x=1775103996; 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=AmfSH7HkX/xcQ9XCAKF7moP1QxoElg9HQnMlOT+HTDA=; b=Wj02fdEETw5crlawpXEI3FW5trUaLaUPl2Fif/KoiVfYqtTIPviL0X5K7i8caPCsKk PgE4azkTpC9HmoT0NVS1S7Rve2yvR5RAdq0mvHwOTVQfAxbgCeCUQHIiygtnHjjjW5SV Qc+mW0QysW5YKq+xJiOPkgpoWTCTx5nHsESEgBvj+svCjs1jrAXCBkFazd4vAzPI7B7q BX62FvnF5SZKuItyCatwrRxMTE1u3NcsR0phECPMK6MybmmlcMMw1OpwFrB7QQxccnpT jihqRWitdgAmNquUnW6ugV6+6f1EGovXD9G/4WXqgwlpDKpiQwRmd8NvOvvjEiz3rjPu Wvpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774499196; x=1775103996; 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=AmfSH7HkX/xcQ9XCAKF7moP1QxoElg9HQnMlOT+HTDA=; b=gbkQpxWlKgfVhAbWUUFE2r437iSUDFlCT37p8PugkgAJ0AaAaCwu5hfCR4iVGxby0g 5rELeZiPSUYRJfBzRNMcznnHi16DO4bQD5GFY5N610GqdnBHLzxnwwGiAM7iwAovUubV Nc/pQQDsakUilGI84N6meHH6h7ieoG9HDfI9Si89/jv4aObICmpJpfK0DS/uuCwkQ5kx /Tx6/EsUp10FT4Xq46PqbsI7JnwQVFxV3GGOW9SwaabKSJ8xD1p6bUD1Nhru78A3Y9Wt uUt44HIL9ds6+6bv5y1lG8hajbu3mo/UDJwF66T2SrB+oEFQ1w91QmlJpbcbTeiIw7Y0 hbSw== X-Forwarded-Encrypted: i=1; AJvYcCXiGHSdw8PMmvzIThwyM4aqFll8FKu5L7r3DgV4zHRsXD7B+0iloVz7DFsLzc02wSYpmVFeJNnaXzQMkvg=@vger.kernel.org X-Gm-Message-State: AOJu0YwBuoY2gorLr4paB/ALQVW+yG2VXxJm0fDm0BiYyptr1ElOXRcC cpMWcO23iV7BGCKHthMId5vMt86TlJJqxfznshrvKgstcCrJY4VjD6k1vgJEvbWuELI= X-Gm-Gg: ATEYQzwJFE8o71MXYBnZDAt1vjG8X4xjQB5s0/DfhwjII8lT3MhBTzsXtD56/B6UDvp up9P59Zhe+6iWSf1T/5KU+oJnt8Kt22sL1fnA9GTQbUjzylfbG2i4nPKzNU7fZtqNIiJOYmuFke s0eWMFnLq4xj6PzcL6XVw7rN6PjVX2tZzVC760hPcWaP8BtwmpLzM7qfT/F0y94T9QgebpeGtsK ta1SBwboFr7fphz5MmgBTKbTFrXO/Cvni9V/p79LY/+sQyH7yUNUBDZA2AUs1izck5HCeXPoDs3 vrM8fEMmjK6BFtDk6hiCHI7iAyw/PbWu4LxuwySN5Qu/VWLTjCF9QO8MfL/mCXWssd12tjbpRDN 4WRnhdy9uaw+JzrlSkHVp9h/aC5Cd9Zp1azF3OVxIzzIdlQr1IDRf0NZ0rBTZ0037fGmUyU6JJr uPl15rlDi5A849Bs72lkT+Zk2TRWCu+RMNtTsqPkcxtP4= X-Received: by 2002:a05:6a00:286:b0:82c:70a8:faee with SMTP id d2e1a72fcca58-82c70a90084mr3957397b3a.6.1774499196118; Wed, 25 Mar 2026 21:26:36 -0700 (PDT) Received: from ArchDesktopLeo ([2400:a840:5c41:0:e012:ea6c:986:40a8]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82c7d404342sm1258716b3a.61.2026.03.25.21.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 21:26:35 -0700 (PDT) From: Leo Timmins To: pasha.tatashin@soleen.com, rppt@kernel.org, linux-kernel@vger.kernel.org Cc: pratyush@kernel.org, akpm@linux-foundation.org, Leo Timmins Subject: [PATCH v3 2/2] liveupdate: initialize incoming FLB state before finish Date: Thu, 26 Mar 2026 12:25:35 +0800 Message-ID: <20260326042546.8031-3-leotimmins1974@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260326042546.8031-1-leotimmins1974@gmail.com> References: <20260326042546.8031-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. Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound g= lobal state") Reviewed-by: Pasha Tatashin Signed-off-by: Leo Timmins Suggested-by: Leo Timmins --- 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