From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (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 E67292D0620 for ; Wed, 3 Jun 2026 03:36:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780457781; cv=none; b=bXykTcNhj1sOEY94Cj2frHlODhgh0QEmQpY13GmXgncedumnCA6m7MGNHZ7RZrhXXpCqJA9y2ZxiiWIefOUsa2XUTetPTw+bxmQPhkzjl6qA3MTvy7lVpc7lHqNE1RTEZ/EYwLLp/Zo2j8IaXYy45dMXA4I1RMVMdWlTJ1aI5t8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780457781; c=relaxed/simple; bh=noOVctoYLEpp5/tFmimRHVYFFJBZUnwifX9RyyUloZ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gsRnnkSe8O3Rnvolx3y5prGIRVFRon/WIMzsBdwgf0vJ9lIoBXP6N5I2AQ4iNzRhJ6FYDIiBvTTBoxt5HRw5zODJrJb3JpxgC9THkjYibaES8l4MOamQffuQ14K3i6UZL22DnWfUSGusMo0KfQ7qqE0Xqr5/SWFhWdvwPZO/XR8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=gRh227QF; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="gRh227QF" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-8cceaa6f75bso77470886d6.0 for ; Tue, 02 Jun 2026 20:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1780457779; x=1781062579; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=FAC+XywUjSvRcC/lmO2OhZjlflNjORbFaO72oWGwvQo=; b=gRh227QFDV2MZY5onYTh7KGRhVlSyJpJNEpnTbHtRAean1NwNpbS3NvBuRr91yXNXE 7VEBUkbNOX2jbJ4LtZpsXZw0jl4g9VD6bQJtXkIstazmTXOeyfZLHKW4tHQ4jsG7kXE2 J3klAWdAFiCPuW030iIqPDnIqgD8CBELJmxZHzEUupOzToj/zAP8qOYmiLDKIdJZD+n9 p89nJMrqMPfQWs/3h7FvjF/OLjCO228UiSkuHMbtwR6sAoRizPGPXLxLv+kAXb3NKadf 2V4xQxfc1QWQSyyn+t0NEUQT8iQIOWIABULljEusHKXJkUbSywUx8YvgrC3V4j1GlKOA rDTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780457779; x=1781062579; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FAC+XywUjSvRcC/lmO2OhZjlflNjORbFaO72oWGwvQo=; b=tH2asxDJpSTRUV6B59VedB0dOmnT1aHGjg6BAv5iOXKecplluVozSflzp34iLCh3Cw TPsb9rcqbBZUQFoDJi8xG7v6OCFSDScqvpOsa98IybkLlZF/LjHAiquGCnmDSV5gT8mF +lsVgI/inQjdYICiQfUaq3xlBWMedTOnYiX4if82otBjodnpFXmHq3OwOW2bBjUsjxEv YypSd/we9RQ9j3QJrK5jrOJkNS96XTvHLmjTvl1R72EW4F+BjOmgueaNGIAybLseg0uP UfSuwbFvVaS11y+ZuWFmk+agjG7nQmGX7b5kIYNwp4BDKLOhKT3P7z8JjUa/I/21qKhM dpcg== X-Forwarded-Encrypted: i=1; AFNElJ/nRM1lAPzn3ff/Ly3s1KJ3Gt/WOSaUFbWDIF+vokX3i6hlHfS2Uvj/hicByOKxTBcxmjQN1lFyN8/GtcA=@vger.kernel.org X-Gm-Message-State: AOJu0YxwPvT6xNgT5/1vwAykdycG8NQB/0odO3zOJ7XckF0BafPCYvYB CH3v5nO+pVJcPe0N/rta0ZgHwHiisxxxPIUveT0NfI1lpmXMsKZTcdq5nESP7FC7GSzMWGdTVAl gBkR3 X-Gm-Gg: Acq92OHMubjmnbuosJHrBs2k3IKspbpvLCpZ9H6JC9vW5/e3nZx7ejZL7DyLkdCKMH3 aeQ/pEVXmRQ/RTInsAUZM0xZD6Ci2Gqr84e2jzKzh3JIVhBcBkPXCllra/yshvLOGs61XVjaN0K xiU9feo/Bkg8+zSEoZNf7zIXlP9btSGUIru8qCQckpAwtRXICAuPVBW9XOjqTJveuthFkO3bfmc 8JFdNSrSfF8b12DWEKH2Q6L1NLB4OwoO/uubO56sQnk5RyUMTxMpCNqv6Y5aidLet0fOde7M6gK FB3p6QuvqSToauvNAfGxmQvPbpR0pa6sCBAx52tNrNpuOqldJY//IUKFSLJUXYb5RjIOg73fTmK VIu6cq26eGfK8WLn+N1FtFv65mbwuIhY3RaTaezuX9klfRNAlCeoWomIyBhShKvWT2xzYpwVeHo tsWJEZYE0v/+w4jDkreo6q/cGOCsmDvvySxtdqxKzUx0pZT54sRQeFfvkb6tsKATRW6o2eqSsR X-Received: by 2002:a05:6214:dce:b0:8cc:ead5:f377 with SMTP id 6a1803df08f44-8cece16781emr20800526d6.38.1780457779010; Tue, 02 Jun 2026 20:36:19 -0700 (PDT) Received: from plex ([71.181.43.54]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ceccda2601sm9573956d6.6.2026.06.02.20.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 20:36:18 -0700 (PDT) Date: Wed, 3 Jun 2026 03:36:17 +0000 From: Pasha Tatashin To: David Matlack Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Morton , Mike Rapoport , Pasha Tatashin , Pratyush Yadav Subject: Re: [PATCH 2/2] liveupdate: Remember FLB retrieve() status Message-ID: References: <20260528174140.1921129-1-dmatlack@google.com> <20260528174140.1921129-3-dmatlack@google.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260528174140.1921129-3-dmatlack@google.com> On 05-28 17:41, David Matlack wrote: > LUO keeps track of successful retrieve attempts on an FLB. It does so > to avoid multiple retrievals of the same FLB. Multiple retrievals cause > problems because once the FLB is retrieved, the serialized data > structures are likely freed and the FLB is likely in a very different > state from what the code expects. > > All this works well when retrieve succeeds. When it fails, > luo_flb_retrieve_one() returns the error immediately, without ever > storing anywhere that a retrieve was attempted or what its error code > was. If the user attempts to retrieve another file registered with the > same FLB, LUO will attempt to call the FLB's retrieve() callback again. > > The retry is problematic for much of the same reasons listed above. The > FLB is likely in a very different state than what the retrieve logic > normally expects (e.g. some KHO pages may have already been restored and > freed). > > There is no sane way of attempting the retrieve again. Remember the > error retrieve returned and directly return it on a retry. > > This is done by changing the retrieved bool to a retrieve_status > integer. A value of 0 means retrieve was never attempted, a positive > value means it succeeded, and a negative value means it failed and the > error code is the value. > > This is similar to commit f85b1c6af5bc ("liveupdate: luo_file: remember > retrieve() status") which did the same for LUO files. > > Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state") > Assisted-by: Gemini:gemini-3-pro-preview > Signed-off-by: David Matlack Reviewed-by: Pasha Tatashin > --- > include/linux/liveupdate.h | 6 ++++-- > kernel/liveupdate/luo_flb.c | 10 +++++++--- > 2 files changed, 11 insertions(+), 5 deletions(-) > > diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h > index c344bf987b63..63ea5417de84 100644 > --- a/include/linux/liveupdate.h > +++ b/include/linux/liveupdate.h > @@ -173,7 +173,9 @@ struct liveupdate_flb_ops { > * @lock: A mutex that protects all fields within this structure, providing > * the synchronization service for the FLB's ops. > * @finished: True once the FLB's finish() callback has run. > - * @retrieved: True once the FLB's retrieve() callback has run. > + * @retrieve_status: Status code indicating whether retrieve() has been > + * attempted. 0 means not attempted, 1 means successful, > + * and negative value means it failed with that error code. > */ > struct luo_flb_private_state { > refcount_t count; > @@ -181,7 +183,7 @@ struct luo_flb_private_state { > void *obj; > struct mutex lock; > bool finished; > - bool retrieved; > + int retrieve_status; > }; > > /* > diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c > index 7ddef552ff6b..f8852f7e62e5 100644 > --- a/kernel/liveupdate/luo_flb.c > +++ b/kernel/liveupdate/luo_flb.c > @@ -170,7 +170,10 @@ static int luo_flb_retrieve_one(struct liveupdate_flb *flb) > if (private->incoming.finished) > return -ENODATA; > > - if (private->incoming.retrieved) > + if (private->incoming.retrieve_status < 0) > + return private->incoming.retrieve_status; > + > + if (private->incoming.retrieve_status > 0) > return 0; > > if (!fh->active) > @@ -196,12 +199,13 @@ static int luo_flb_retrieve_one(struct liveupdate_flb *flb) > > err = flb->ops->retrieve(&args); > if (err) { > + private->incoming.retrieve_status = err; > module_put(flb->ops->owner); > return err; > } > > private->incoming.obj = args.obj; > - private->incoming.retrieved = true; > + private->incoming.retrieve_status = 1; > > return 0; > } > @@ -215,7 +219,7 @@ void liveupdate_flb_put_incoming(struct liveupdate_flb *flb) > if (!refcount_dec_and_test(&private->incoming.count)) > return; > > - if (!private->incoming.retrieved) { > + if (private->incoming.retrieve_status <= 0) { > int err = luo_flb_retrieve_one(flb); > > if (WARN_ON(err)) > -- > 2.54.0.823.g6e5bcc1fc9-goog >